From a20dbc5497ffc460cf14a175da985315080853dd Mon Sep 17 00:00:00 2001 From: pdp8 Date: Sat, 20 May 2023 22:07:53 +0200 Subject: social inbox --- social | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/social b/social index 2a57153..db1685c 100755 --- a/social +++ b/social @@ -22,6 +22,20 @@ def post path, body puts(response.body, response.code) end +def get path + uri = URI.parse(File.join SOCIAL_URL, path) + http = Net::HTTP.new(uri.host, uri.port) + http.use_ssl = true + header = { 'Accept' => 'text/plain' } + request = Net::HTTP::Get.new(uri.request_uri, header) + usr = File.read(".usr").chomp + pwd = File.read(".pwd").chomp + request.basic_auth(usr, pwd) + response = http.request(request) + # TODO return error if response.code > 400 + puts(response.code, response.body) +end + # cmd = ARGV.shift case ARGV.shift when "post" @@ -30,4 +44,6 @@ when "follow" post "follow", ARGV.join(" ") when "unfollow" post "unfollow", ARGV.join(" ") +when "inbox" + get "inbox" end -- cgit v1.2.3