From bd7e17e927824461c1af167fae292906b6212894 Mon Sep 17 00:00:00 2001 From: pdp8 Date: Mon, 17 Jul 2023 21:58:43 +0200 Subject: threads fixed(?) --- client.rb | 19 ++++++++----------- public/pdp8.json | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 11 deletions(-) create mode 100644 public/pdp8.json diff --git a/client.rb b/client.rb index 386175d..3ee3a7e 100644 --- a/client.rb +++ b/client.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true # client-server -post '/' do +post '/' do # TODO protected! Time.now.strftime('%Y-%m-%dT%H:%M:%S.%N') @@ -86,7 +86,7 @@ post '/unfollow' do redirect(params['anchor'] || '/inbox') end -post '/share' do +post '/share' do # TODO protected! selection(params).each { |f| FileUtils.mv f, f.sub(%r{/inbox/}, '/shared/') } outbox 'Announce', params['id'], public @@ -112,15 +112,12 @@ end collection.each do |object| object['indent'] = 0 object['replies'] = [] - if object['inReplyTo'].nil? || collection.select { |o| o['id'] == object['inReplyTo'] }.empty? - @threads << object - else - collection.select { |o| o['id'] == object['inReplyTo'] }.each do |o| - next unless o['indent'] - - object['indent'] = o['indent'] + 2 - o['replies'] << object - end + @threads << object if object['inReplyTo'].nil? || collection.select { |o| o['id'] == object['inReplyTo'] }.empty? + end + collection.each do |object| + collection.select { |o| o['id'] == object['inReplyTo'] }.each do |o| + object['indent'] = o['indent'] + 2 + o['replies'] << object end end erb :collection diff --git a/public/pdp8.json b/public/pdp8.json new file mode 100644 index 0000000..c066ea6 --- /dev/null +++ b/public/pdp8.json @@ -0,0 +1,43 @@ +{ + "@context": [ + "https://www.w3.org/ns/activitystreams" + ], + "id": "https://social.pdp8.info/pdp8", + "type": "Person", + "preferredUsername": "pdp8", + "name": "pdp8", + "inbox": "https://social.pdp8.info/inbox", + "outbox": "https://social.pdp8.info/outbox", + "following": "https://social.pdp8.info/following", + "followers": "https://social.pdp8.info/followers", + "manuallyApprovesFollowers": false, + "icon": { + "type": "Image", + "url": "https://pdp8.info/pdp8.png" + }, + "attachment": [ + { + "type": "PropertyValue", + "name": "Web", + "value": "pdp8.info" + }, + { + "type": "PropertyValue", + "name": "Fediverse", + "value": "@pdp8@social.pdp8.info" + }, + { + "type": "PropertyValue", + "name": "Matrix", + "value": "@pdp8:matrix.pdp8.info" + } + ], + "endpoints": { + "sharedInbox": "https://social.pdp8.info/inbox" + }, + "publicKey": { + "id": "https://social.pdp8.info/pdp8#main-key", + "owner": "https://social.pdp8.info/pdp8", + "publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArDawzSl+XcJ+96sIrx+E\nsDoUQzSvoKazCgw7qOMaOGi7XxJ8riBvdRBlJ4zOEfQaxcaQgGn5JntOofqkeWvk\nIykOAzYfwY6HoUm7i1eZME2quO+CkMMq9SX9/DOqggOYtiVC9DX5FxXe5YHK7Q/n\nbo1iB6rgVS43wT0PnI6uduY4cUlvhRkX4Iht0N1GTrBlGKloRQ96KTzp+U9xF7bp\nKO87Y4yftv+d6L3ZZBfTRgWOtDXG8E4Vdvsq0aPQNBtazq0fwtBbk2G4mZtCMqyT\nvLZh8w+YPn1ICoQsKukU/q7eG29UJCz/QdZndkuv5iIm+H/c8gicGllw9rNQP2G0\nBQIDAQAB\n-----END PUBLIC KEY-----\n" + } +} -- cgit v1.2.3