summaryrefslogtreecommitdiff
path: root/server.rb
diff options
context:
space:
mode:
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