From ffade03e9d3f77e41f44882c39eb6b12b3b05e63 Mon Sep 17 00:00:00 2001 From: pdp8 Date: Fri, 3 May 2024 11:57:42 +0200 Subject: storage paths from id --- client.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'client.rb') 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) -- cgit v1.2.3