diff options
Diffstat (limited to 'helpers.rb')
-rw-r--r-- | helpers.rb | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -4,7 +4,7 @@ helpers do def save_inbox(item) return unless item['id'] - path = File.join(INBOX_DIR, item['id'].sub('https://', '')) + path = File.join(INBOX_DIR, item['id'].sub('https://', '').sub(%r{/$}, '')) # remove trailing slashes FileUtils.mkdir_p File.dirname(path) File.open(path, 'w+') { |f| f.puts item.to_json } end @@ -235,12 +235,14 @@ helpers do html += '</h2>' Dir[File.join(SOCIAL_DIR, 'outbox', activity, '*.json')].collect do |f| 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| + end.select { |a| a['to'].include?('https://www.w3.org/ns/activitystreams#Public') }.sort_by { |a| a['published'] }.reverse[0..49].collect { |a| a['object'] }.each do |object| object = fetch(object) if object.is_a? String - if object - mention = mention object['attributedTo'] + next unless object + + begin html += '<section>' html += "<h3>#{object['published']}</h3>" + mention = mention object['attributedTo'] if activity == 'announce' html += "<b><a href='#{object['attributedTo']}' target='_blank'>#{mention}</a></b> " end @@ -259,8 +261,11 @@ helpers do end end end + html += '</section>' + rescue StandardError => e + p e + jj object end - html += '</section>' end html += File.read(File.join(SNIPPETS, 'tail.html')) %w[pdp8 pdp8-test].each do |d| @@ -269,5 +274,6 @@ helpers do File.open(out, 'w+') { |f| f.puts(html) } puts `/etc/profiles/per-user/ch/bin/tidy -iqm -w 0 #{out} 2>&1` end + `cd /home/ch/src/wgen && /home/ch/.nix-profile/bin/make` if activity == 'create' # update pictures.html end end |