diff options
-rw-r--r-- | client.rb | 19 | ||||
-rw-r--r-- | public/pdp8.json | 43 |
2 files changed, 51 insertions, 11 deletions
@@ -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": "<a href=\"https://pdp8.info\">pdp8.info</a>" + }, + { + "type": "PropertyValue", + "name": "Fediverse", + "value": "<a rel=\"me\" href=\"https://social.pdp8.info/pdp8\">@pdp8@social.pdp8.info</a>" + }, + { + "type": "PropertyValue", + "name": "Matrix", + "value": "<a rel=\"me\" href=\"https://matrix.to/#/@pdp8:matrix.pdp8.info\">@pdp8:matrix.pdp8.info</a>" + } + ], + "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" + } +} |