mirror of
https://codeberg.org/keyoxide/keyoxide-web.git
synced 2024-12-22 14:59:29 -07:00
Fix alias lookup, hardcoded domain, and content-type header
This commit is contained in:
parent
cb67d65e53
commit
946d9c5e5a
1 changed files with 18 additions and 10 deletions
|
@ -55,23 +55,31 @@ router.get('/.well-known/webfinger', (req, res) => {
|
||||||
return
|
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`
|
||||||
|
}, {
|
||||||
|
rel: 'self',
|
||||||
|
type: 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"',
|
||||||
|
href: `https://${process.env.DOMAIN}/users/keyoxide`
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
if (!req.query.resource) {
|
if (!req.query.resource) {
|
||||||
res.status(400).send()
|
res.status(400).send()
|
||||||
return
|
return
|
||||||
} else if (req.query.resource !== 'acct:keyoxide@keyoxide.org') {
|
} else if (![body.subject, ...body.aliases].includes(req.query.resource)) {
|
||||||
res.status(404).send()
|
res.status(404).send()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const body = {
|
res.set('Content-Type', 'application/jrd+json')
|
||||||
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)
|
res.json(body)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue