diff options
Diffstat (limited to 'server.rb')
-rw-r--r-- | server.rb | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -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 |