summaryrefslogtreecommitdiff
path: root/server.rb
diff options
context:
space:
mode:
authorpdp8 <pdp8@pdp8.info>2023-09-04 10:41:32 +0200
committerpdp8 <pdp8@pdp8.info>2023-09-04 10:41:32 +0200
commit9ecb046ed70c9431f97eab1d761aa9fb22f8f73c (patch)
tree58cf2e4420dd0888dd6a0c94b44d0665a67d819f /server.rb
parent485d71e69cb5b56d3ccf8b5eb82ef6af9d172485 (diff)
ignore visited objects
Diffstat (limited to 'server.rb')
-rw-r--r--server.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/server.rb b/server.rb
index 9fd9e11..7319efa 100644
--- a/server.rb
+++ b/server.rb
@@ -64,16 +64,19 @@ end
helpers do
def create
+ @count ||= 0
@object ||= @activity['object']
+
@object = if @object['type'] == 'Like' # lemmy likes
save_object @object['object'], INBOX
else
save_object @object, INBOX
end
- return unless @object and @object['inReplyTo']
+ return unless @object and @object['inReplyTo'] and @count < 5
# recursive thread download
@object = @object['inReplyTo']
+ @count += 1
create
end
@@ -100,7 +103,7 @@ helpers do
when 'Follow'
update_collection FOLLOWERS, @activity['object']['actor'], true
when 'Create', 'Announce'
- file = find_file @activity['object']['id']
+ file = find_file @activity['object']['object']
FileUtils.rm(file) if file
else
halt 501