This commit is contained in:
syuilo 2018-04-05 15:54:12 +09:00
parent fc15249aa4
commit d3ed2761b9

View File

@ -1,11 +1,12 @@
import * as express from 'express';
import config from '../config';
import parseAcct from '../acct/parse';
import User from '../models/user';
const express = require('express');
const app = express();
app.get('/.well-known/webfinger', async (req, res) => {
app.get('/.well-known/webfinger', async (req: express.Request, res: express.Response) => {
if (typeof req.query.resource !== 'string') {
return res.sendStatus(400);
}
@ -34,13 +35,15 @@ app.get('/.well-known/webfinger', async (req, res) => {
return res.json({
subject: `acct:${user.username}@${config.host}`,
links: [
{
links: [{
rel: 'self',
type: 'application/activity+json',
href: `${config.url}/@${user.username}`
}
]
}, {
rel: 'http://webfinger.net/rel/profile-page',
type: 'text/html',
href: `${config.url}/@${user.username}`
}]
});
});