summaryrefslogtreecommitdiff
path: root/client.rb
diff options
context:
space:
mode:
Diffstat (limited to 'client.rb')
-rw-r--r--client.rb11
1 files changed, 5 insertions, 6 deletions
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)