summaryrefslogtreecommitdiff
path: root/server.rb
diff options
context:
space:
mode:
Diffstat (limited to 'server.rb')
-rw-r--r--server.rb19
1 files changed, 15 insertions, 4 deletions
diff --git a/server.rb b/server.rb
index f337820..666b59e 100644
--- a/server.rb
+++ b/server.rb
@@ -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)