diff options
author | pdp8 <pdp8@pdp8.info> | 2023-07-24 17:34:43 +0200 |
---|---|---|
committer | pdp8 <pdp8@pdp8.info> | 2023-07-24 17:34:43 +0200 |
commit | 0f039c1b813653869033e961810942f479a28685 (patch) | |
tree | 3268286b6cc892b1af4bfdf34921f9040600973a /server.rb | |
parent | a509c55faca368709044133199f71fb862b1e605 (diff) |
public outbox, inbox/outbox threads
Diffstat (limited to 'server.rb')
-rw-r--r-- | server.rb | 19 |
1 files changed, 15 insertions, 4 deletions
@@ -24,19 +24,30 @@ get '/' do redirect 'https://pdp8.info' end +get '/outbox' do + files = Dir[File.join('outbox', 'create', '*.json')] + Dir[File.join('outbox', 'announce', '*.json')] + activities = files.collect { |f| JSON.parse(File.read(f)) } + ids = activities.sort_by { |a| a['published'] }.collect { |a| a['id'] } + { '@context' => 'https://www.w3.org/ns/activitystreams', + 'id' => 'https://social.pdp8.info/outbox', + 'type' => 'OrderedCollection', + 'totalItems' => ids.size, + 'orderedItems' => ids }.to_json +end + get '/pdp8', provides: 'html' do redirect 'https://pdp8.info' end +get '/pdp8' do + send_file(File.join(PUBLIC_DIR, 'pdp8.json'), type: CONTENT_TYPE) +end + get '/.well-known/webfinger' do halt 404 unless request['resource'] == "acct:#{MENTION}" send_file(WEBFINGER, type: 'application/jrd+json') end -get '/pdp8' do - send_file(File.join(PUBLIC_DIR, 'pdp8.json'), type: CONTENT_TYPE) -end - ['/following', '/followers'].each do |path| get path do send_file(File.join(PUBLIC_DIR, path) + '.json', type: CONTENT_TYPE) |