summaryrefslogtreecommitdiff
path: root/social
diff options
context:
space:
mode:
authorpdp8 <pdp8@pdp8.info>2023-05-20 22:07:53 +0200
committerpdp8 <pdp8@pdp8.info>2023-05-20 22:07:53 +0200
commita20dbc5497ffc460cf14a175da985315080853dd (patch)
tree2dcba806635781dd26452c27157e5274cc4da58c /social
parentd2c4d3b49e6b790d14f6dcb94c2ae0641559d2cf (diff)
social inbox
Diffstat (limited to 'social')
-rwxr-xr-xsocial16
1 files changed, 16 insertions, 0 deletions
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