mirror of
https://codeberg.org/keyoxide/keyoxide-web.git
synced 2024-12-22 14:59:29 -07:00
Simulate ActivityPub actor
This commit is contained in:
parent
f54375cc05
commit
04f4a65a09
2 changed files with 49 additions and 0 deletions
|
@ -57,4 +57,46 @@ router.get('/privacy', (req, res) => {
|
||||||
res.render(`article`, { title: `Privacy policy`, content: content })
|
res.render(`article`, { title: `Privacy policy`, content: content })
|
||||||
})
|
})
|
||||||
|
|
||||||
|
router.get('/.well-known/webfinger', (req, res) => {
|
||||||
|
if (!(process.env.DOMAIN && process.env.ACTIVITYPUB_PUBLICKEY)) {
|
||||||
|
res.status(404).send('<body><pre>Cannot GET /.well-known/webfinger</pre></body>')
|
||||||
|
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('/users/keyoxide', (req, res) => {
|
||||||
|
if (!(process.env.DOMAIN && process.env.ACTIVITYPUB_PUBLICKEY)) {
|
||||||
|
res.status(404).send('<body><pre>Cannot GET /keyoxide</pre></body>')
|
||||||
|
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_PUBLICKEY}`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
res.type('application/activity+json').json(body)
|
||||||
|
})
|
||||||
|
|
||||||
export default router
|
export default router
|
||||||
|
|
|
@ -5,6 +5,13 @@
|
||||||
# Domain of Keyoxide instance
|
# Domain of Keyoxide instance
|
||||||
#DOMAIN=
|
#DOMAIN=
|
||||||
|
|
||||||
|
# Public key used for the simulated ActivityPub actor named Keyoxide on the instance
|
||||||
|
# Obtained through:
|
||||||
|
# $ openssl genrsa -out private.pem 2048
|
||||||
|
# $ openssl rsa -in private.pem -outform PEM -pubout -out public.pem
|
||||||
|
# $ while read -r line; do echo -nE "$line\n" ; done < public.pem > public-oneline.pem
|
||||||
|
#ACTIVITYPUB_PUBLICKEY=
|
||||||
|
|
||||||
# Domain for DOIP Proxy server
|
# Domain for DOIP Proxy server
|
||||||
# Source code for the server can be found here https://codeberg.org/keyoxide/doip-proxy
|
# Source code for the server can be found here https://codeberg.org/keyoxide/doip-proxy
|
||||||
#PROXY_HOSTNAME=
|
#PROXY_HOSTNAME=
|
||||||
|
|
Loading…
Reference in a new issue