/*
Copyright (C) 2021 Yarmo Mackenbach
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU Affero General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option)
any later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
details.
You should have received a copy of the GNU Affero General Public License along
with this program. If not, see
Cannot GET /.well-known/webfinger') return } const body = { subject: `acct:keyoxide@${process.env.DOMAIN}`, aliases: [`https://${process.env.DOMAIN}/users/keyoxide`], links: [{ rel: 'self', type: 'application/activity+json', href: `https://${process.env.DOMAIN}/users/keyoxide` }] } res.json(body) }) router.get('/.well-known/keyoxide/version', async (req, res) => { // TODO Support responding with JSON object when requested const meta = getMetaFromReq(req) return res.status(200).contentType('text/plain').send(meta.keyoxide.semver) }) router.get('/users/keyoxide', (req, res) => { if (!(process.env.DOMAIN && process.env.ACTIVITYPUB_PUBLIC_KEY)) { res.status(404).send('
Cannot GET /keyoxide') return } const body = { '@context': [ 'https://www.w3.org/ns/activitystreams', 'https://w3id.org/security/v1' ], id: `https://${process.env.DOMAIN}/users/keyoxide`, type: 'Application', inbox: `https://${process.env.DOMAIN}/users/keyoxide/inbox`, preferredUsername: `${process.env.DOMAIN}`, publicKey: { id: `https://${process.env.DOMAIN}/users/keyoxide#main-key`, owner: `https://${process.env.DOMAIN}/users/keyoxide`, publicKeyPem: `${process.env.ACTIVITYPUB_PUBLIC_KEY}` } } res.type('application/activity+json').json(body) }) export default router