summaryrefslogtreecommitdiff
path: root/client.rb
diff options
context:
space:
mode:
authorpdp8 <pdp8@pdp8.info>2024-05-03 11:57:42 +0200
committerpdp8 <pdp8@pdp8.info>2024-05-03 11:57:42 +0200
commitffade03e9d3f77e41f44882c39eb6b12b3b05e63 (patch)
tree7cab80e5760996ca74e883d4794992d75a74e8b3 /client.rb
parent97d98fd5481359b96215f8a50d032c8fe96e9add (diff)
storage paths from id
Diffstat (limited to 'client.rb')
-rw-r--r--client.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/client.rb b/client.rb
index 891a1d8..c47000d 100644
--- a/client.rb
+++ b/client.rb
@@ -10,7 +10,7 @@ end
post '/unfollow' do
protected!
params['id'] = actor params['mention'] if params['mention']
- following = Dir[File.join(OUTBOX[:dir], 'follow', '*.json')].collect { |f| JSON.load_file(f) }
+ following = Dir[File.join(OUTBOX_DIR, 'follow', '*.json')].collect { |f| JSON.load_file(f) }
activity = following.find { |a| a['object'] == params['id'] }
activity ||= {
'@context' => 'https://www.w3.org/ns/activitystreams',
@@ -38,7 +38,8 @@ post '/undo' do # TODO: generalize for announce
activity = JSON.load_file(activity_file)
next unless activity['id'] == params['id']
- object_file, object = find_object activity['object']['id']
+ object_file = File.join(dir, activity['object']['id'].sub('https://', ''))
+ # object_file, object = find_object activity['object']['id']
create_activity 'Undo', params['id'], activity['to']
FileUtils.rm(activity_file)
FileUtils.rm(object_file)