diff options
author | pdp8 <pdp8@pdp8.info> | 2023-05-20 22:07:53 +0200 |
---|---|---|
committer | pdp8 <pdp8@pdp8.info> | 2023-05-20 22:07:53 +0200 |
commit | a20dbc5497ffc460cf14a175da985315080853dd (patch) | |
tree | 2dcba806635781dd26452c27157e5274cc4da58c | |
parent | d2c4d3b49e6b790d14f6dcb94c2ae0641559d2cf (diff) |
social inbox
-rwxr-xr-x | social | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -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 |