diff options
author | pdp8 <pdp8@pdp8.info> | 2023-09-09 16:02:50 +0200 |
---|---|---|
committer | pdp8 <pdp8@pdp8.info> | 2023-09-09 16:02:50 +0200 |
commit | 3a87028b34c969744f6c63ba73947cfa32156e7d (patch) | |
tree | 67b46c322a13b5c3c51c0309d71fe6241876a880 /helpers.rb | |
parent | 9ecb046ed70c9431f97eab1d761aa9fb22f8f73c (diff) |
update and clean-inbox added, no outbox send for delete, recursive create for objects with activities (lemmy)
Diffstat (limited to 'helpers.rb')
-rw-r--r-- | helpers.rb | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -1,5 +1,10 @@ require 'English' helpers do + def save_item(item, path) + FileUtils.mkdir_p File.dirname(path) + File.open(path, 'w+') { |f| f.puts item.to_json } + end + # add date and id, save def save_activity(activity, box) date = Time.now.utc.iso8601 @@ -24,9 +29,7 @@ helpers do def save_object(object, box) object = fetch(object) if object.is_a? String and object.match(/^http/) return unless object and object['type'] != 'Person' - # File.open(File.join(INBOX[:dir]), 'visited', 'w+').open { |f| f.puts object['id'] } - return if box == INBOX and object['id'] and File.readlines(File.join(INBOX[:dir], 'visited'), - chomp: true).include? object['id'] + return if box == INBOX and object['id'] and File.readlines(VISITED, chomp: true).include? object['id'] object['@context'] = 'https://www.w3.org/ns/activitystreams' if object['attributedTo'] |