From 580c684f792d6fab16c58b9a08d566cd03c72ca4 Mon Sep 17 00:00:00 2001 From: pdp8 Date: Fri, 6 Oct 2023 15:02:59 +0200 Subject: announce to fixed, find_file replaced with find_object, CONTENT_LENGHT included in signature verification --- client.rb | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'client.rb') diff --git a/client.rb b/client.rb index 7b93c83..01124bc 100644 --- a/client.rb +++ b/client.rb @@ -41,12 +41,11 @@ end post '/share' do # TODO protected! - src = find_file params['id'] + src, object = find_object params['id'] object = JSON.load_file(src) - recipients = ['https://www.w3.org/ns/activitystreams#Public'] - recipients += JSON.load_file(FOLLOWERS)['orderedItems'] - recipients << object['attributedTo'] - create_activity 'Announce', object, recipients + to = ['https://www.w3.org/ns/activitystreams#Public', FOLLOWERS_URL] + to << object['attributedTo'] + create_activity 'Announce', object, to dest = src.sub('inbox/', 'outbox/') FileUtils.mkdir_p File.dirname(dest) FileUtils.mv src, dest @@ -59,7 +58,7 @@ post '/undo' do # TODO: generalize for announce activity = JSON.load_file(activity_file) next unless activity['id'] == params['id'] - object_file = find_file activity['object']['id'] + object_file, object = find_object activity['object']['id'] create_activity 'Undo', params['id'], activity['to'] FileUtils.rm(activity_file) FileUtils.rm(object_file) -- cgit v1.2.3