require 'uri' require 'base64' require 'digest/sha2' require 'time' require 'rack/protection' require 'sinatra' SOCIAL_DIR = '/srv/social/' PUBLIC_DIR = File.join(SOCIAL_DIR, 'public') PRIVATE_DIR = File.join(SOCIAL_DIR, 'private') FOLLOWERS = File.join(PUBLIC_DIR, 'followers.json') FOLLOWING = File.join(PUBLIC_DIR, 'following.json') 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) INBOX = { dir: File.join(SOCIAL_DIR, 'inbox') } OUTBOX = { dir: File.join(SOCIAL_DIR, 'outbox'), url: File.join(SOCIAL_URL, 'outbox') } TAGS = { dir: File.join(PUBLIC_DIR, 'tags'), url: File.join(SOCIAL_URL, 'tags') } FOLLOWERS_URL = 'https://social.pdp8.info/followers' VISITED = File.join(INBOX[:dir], 'visited') ACTIVITIES = %i[create announce follow accept undo delete like update move] CONTENT_TYPE = 'application/activity+json' use Rack::Protection enable :sessions set :environment, :production set :session_secret, File.read('.secret').chomp set :default_content_type, CONTENT_TYPE set :port, 9292 require_relative 'helpers' require_relative 'server' require_relative 'client' require_relative 'create'