summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpdp8 <pdp8@pdp8.info>2023-07-17 21:58:43 +0200
committerpdp8 <pdp8@pdp8.info>2023-07-17 21:58:43 +0200
commitbd7e17e927824461c1af167fae292906b6212894 (patch)
treeedf5a941ea494e9ce6f2a35fc7c712489613d18e
parent8596528d9c0c07cc46279679f61729a3c06d902e (diff)
threads fixed(?)
-rw-r--r--client.rb19
-rw-r--r--public/pdp8.json43
2 files changed, 51 insertions, 11 deletions
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": "<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"
+ }
+}