From 3a8be7b1606885b3b94bc22a6d775a6527e1c07d Mon Sep 17 00:00:00 2001 From: pdp8 Date: Sun, 30 Jul 2023 15:07:28 +0200 Subject: note parsing, tag links --- server.rb | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'server.rb') diff --git a/server.rb b/server.rb index fd14356..4eae86b 100644 --- a/server.rb +++ b/server.rb @@ -54,6 +54,10 @@ end end end +get '/tags/:tag' do |tag| + send_file(File.join(PUBLIC_DIR, 'tags', tag) + '.json', type: CONTENT_TYPE) +end + helpers do def create @object ||= @activity['object'] @@ -79,8 +83,15 @@ helpers do end def undo - halt 501 unless @activity['object']['type'] == 'Follow' - update_collection FOLLOWERS, @activity['object']['actor'], true + case @activity['object']['type'] + when 'Follow' + update_collection FOLLOWERS, @activity['object']['actor'], true + when 'Create', 'Announce' + file = find_file @activity['object']['id'] + FileUtils.rm(file) if File.exist? file + else + halt 501 + end end def update -- cgit v1.2.3