From 97d98fd5481359b96215f8a50d032c8fe96e9add Mon Sep 17 00:00:00 2001 From: pdp8 Date: Thu, 2 May 2024 14:34:10 +0200 Subject: VISITED handling --- server.rb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'server.rb') diff --git a/server.rb b/server.rb index 0d92f8c..9197ce5 100644 --- a/server.rb +++ b/server.rb @@ -65,6 +65,8 @@ helpers do save_inbox_object return unless @object and @object['inReplyTo'] and @count < 5 + return if File.readlines(VISITED, chomp: true).include?(@object['inReplyTo']) + # recursive thread download @object = @object['inReplyTo'] @count += 1 @@ -132,7 +134,7 @@ helpers do def handle_activity type = @activity['type'].downcase.to_sym - # save_item @activity, File.join(INBOX[:dir], @activity['type'].downcase, activity_name) + save_item @activity, File.join(INBOX[:dir], @activity['type'].downcase, activity_name) if ACTIVITIES.include? type send(type) else @@ -157,11 +159,11 @@ helpers do # if @activity['type'] != 'Update' && (@object['id'] and File.readlines(VISITED, chomp: true).include? @object['id']) # return # end - if @object['id'] and File.readlines(VISITED, chomp: true).include? @object['id'] - return unless @activity['type'] = 'Update' - - FileUtils.rm_f find_object(@object['id'])[0] - + if @object['id'] and File.readlines(VISITED, chomp: true).include? @object['id'] && !(@activity['type'] = 'Update') + return + # + # FileUtils.rm_f find_object(@object['id'])[0] + # end save_item @object, File.join(INBOX[:dir], 'object', @object['type'].downcase, activity_name) -- cgit v1.2.3