From a0512473ec1c19643dae4889a321602901df79bc Mon Sep 17 00:00:00 2001 From: pdp8 Date: Mon, 12 Feb 2024 23:34:55 +0100 Subject: omit empty objects in outbox --- helpers.rb | 58 ++++++++++++++++++++++++++++++---------------------------- 1 file changed, 30 insertions(+), 28 deletions(-) (limited to 'helpers.rb') diff --git a/helpers.rb b/helpers.rb index 4bce51f..7126160 100644 --- a/helpers.rb +++ b/helpers.rb @@ -237,35 +237,37 @@ helpers do JSON.load_file(f) end.select { |a| a['to'].include?('https://www.w3.org/ns/activitystreams#Public') }.sort_by { |a| a['published'] }.reverse.collect { |a| a['object'] }.each do |object| object = fetch(object) if object.is_a? String - mention = mention object['attributedTo'] - html += "
" - if activity == 'announce' - html += "#{mention} " - end - html += "#{object['published']} - #{object['content']}" - if object['attachment'] - object['attachment'].each do |att| - w = 1024 - h = 768 - case att['mediaType'] - when /audio/ - html += "
" - when /image/ - if activity == 'create' - w, h = `/etc/profiles/per-user/ch/bin/identify -format "%w %h" #{att['url'].sub( - 'https://media.pdp8.info', '/srv/media' - )}`.chomp.split(' ') end - html += "