summaryrefslogtreecommitdiff
path: root/server.rb
diff options
context:
space:
mode:
authorpdp8 <pdp8@pdp8.info>2023-07-30 15:07:28 +0200
committerpdp8 <pdp8@pdp8.info>2023-07-30 15:07:28 +0200
commit3a8be7b1606885b3b94bc22a6d775a6527e1c07d (patch)
tree3aed49446c69d4a0c66e5f2eb6fca7ca181ef80e /server.rb
parentfbd4fccc70622e664e2f795315c848d68aed365e (diff)
note parsing, tag links
Diffstat (limited to 'server.rb')
-rw-r--r--server.rb15
1 files changed, 13 insertions, 2 deletions
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