redirect webfinger of domain to instance actor
(Johann150 yells at cloud)
This commit is contained in:
parent
5f9fb28fc2
commit
bed6a1e2d8
1 changed files with 12 additions and 2 deletions
|
@ -101,12 +101,22 @@ router.get(webFingerPath, async ctx => {
|
|||
isSuspended: false,
|
||||
} : 422;
|
||||
|
||||
if (typeof ctx.query.resource !== 'string') {
|
||||
let resource = ctx.query.resource;
|
||||
|
||||
if (typeof resource !== 'string') {
|
||||
ctx.status = 400;
|
||||
return;
|
||||
}
|
||||
|
||||
const query = generateQuery(ctx.query.resource.toLowerCase());
|
||||
resource = resource.toLowerCase();
|
||||
|
||||
// Mastodon sometimes only checks for the domain name,
|
||||
// which should be rewritten to the instance actor.
|
||||
if (`https://${config.host}`.toLowerCase() === resource) {
|
||||
resource = `acct:instance.actor@${config.host}`;
|
||||
}
|
||||
|
||||
const query = generateQuery(resource);
|
||||
|
||||
if (typeof query === 'number') {
|
||||
ctx.status = query;
|
||||
|
|
Loading…
Reference in a new issue