summaryrefslogtreecommitdiff
path: root/activitypub.rb
blob: 5148a27e99c855741eecc668d7fee52884034d45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# frozen_string_literal: true

require 'uri'
require 'base64'
require 'digest/sha2'
require 'sinatra'

SOCIAL_DIR = '/srv/social/'
PUBLIC_DIR = File.join(SOCIAL_DIR, 'public')
PRIVATE_DIR = File.join(SOCIAL_DIR, 'private')
OUTBOX_DIR = File.join(PUBLIC_DIR, 'outbox')
TAGS_DIR = File.join(PUBLIC_DIR, 'tags')

INBOX = File.join(PRIVATE_DIR, 'inbox.json')
FOLLOWERS = File.join(PUBLIC_DIR, 'followers.json')
FOLLOWING = File.join(PUBLIC_DIR, 'following.json')
OUTBOX = File.join(PUBLIC_DIR, 'outbox.json')
SHARED = File.join(PUBLIC_DIR, 'shared.json')
# VISITED = File.join(PRIVATE_DIR, 'visited')

USER = 'pdp8'
SOCIAL_DOMAIN = 'social.pdp8.info'
MENTION = "#{USER}@#{SOCIAL_DOMAIN}"
WEBFINGER = File.join(PUBLIC_DIR, MENTION + '.json')

SOCIAL_URL = "https://#{SOCIAL_DOMAIN}"
ACTOR = File.join(SOCIAL_URL, USER)
OUTBOX_URL = File.join(SOCIAL_URL, 'outbox')
TAGS_URL = File.join(SOCIAL_URL, 'tags')

CONTENT_TYPE = 'application/activity+json'
# CONTENT_TYPE = 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'

enable :sessions
set :session_secret, File.read('.secret').chomp
set :default_content_type, CONTENT_TYPE
set :port, 9292

require_relative 'helpers'
require_relative 'client'
require_relative 'server'