From 2c87584d2d7a2082013bd3829b4cf0e01d8b8e62 Mon Sep 17 00:00:00 2001 From: "Joseph.Roy" Date: Mon, 18 Dec 2023 14:34:22 +0000 Subject: [PATCH] added bind for sinatra --- auth/auth.rb | 2 ++ auth/post.rb | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/auth/auth.rb b/auth/auth.rb index 2afee24..a659f4b 100644 --- a/auth/auth.rb +++ b/auth/auth.rb @@ -11,6 +11,8 @@ require 'sqlite3' require 'jwt' require 'dotenv/load' +set :bind, '0.0.0.0' + TOKEN_SECRET = ENV['JWT_SECRET_KEY'] puts TOKEN_SECRET initialize_database diff --git a/auth/post.rb b/auth/post.rb index f077a3a..450acaa 100644 --- a/auth/post.rb +++ b/auth/post.rb @@ -78,15 +78,17 @@ uri = URI.parse('https://auth.roysathome.net/upload') http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true +puts 'Enter message to send:' +message = gets request = Net::HTTP::Post::Multipart.new( uri.path, - 'file' => UploadIO.new(StringIO.new(file_content), 'application/octet-stream', 'example.txt') + 'file' => UploadIO.new(StringIO.new(message), 'application/octet-stream', 'example.txt') ) request['Authorization'] = "Bearer #{authentication_token}" # Send the request -puts "Sending file of size #{(File.size('./example.txt') / 2**20).round(2)} MB" +#puts "Sending file of size #{(File.size('./example.txt') / 2**20).round(2)} MB" response = http.request(request) #puts response.code