X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fcontrollers%2Fwebfinger.ts;h=5c308d9ad1f0b8a8dcce864e6a4121a830ff7110;hb=ebefc902f59be6c5542c19ff706e310d9dddf75f;hp=78e5dee79747a31c21592d4ceae71f021ace3ed5;hpb=165cdc75bf1942ed687f78094c2bd366839a7c99;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/controllers/webfinger.ts b/server/controllers/webfinger.ts index 78e5dee79..5c308d9ad 100644 --- a/server/controllers/webfinger.ts +++ b/server/controllers/webfinger.ts @@ -1,10 +1,12 @@ +import * as cors from 'cors' import * as express from 'express' -import { asyncMiddleware } from '../middlewares/async' -import { webfingerValidator } from '../middlewares/validators/webfinger' -import { AccountInstance } from '../models/account/account-interface' +import { asyncMiddleware } from '../middlewares' +import { webfingerValidator } from '../middlewares/validators' const webfingerRouter = express.Router() +webfingerRouter.use(cors()) + webfingerRouter.get('/.well-known/webfinger', asyncMiddleware(webfingerValidator), webfingerController @@ -18,20 +20,20 @@ export { // --------------------------------------------------------------------------- -function webfingerController (req: express.Request, res: express.Response, next: express.NextFunction) { - const account: AccountInstance = res.locals.account +function webfingerController (req: express.Request, res: express.Response) { + const actor = res.locals.actorUrl const json = { subject: req.query.resource, - aliases: [ account.url ], + aliases: [ actor.url ], links: [ { rel: 'self', type: 'application/activity+json', - href: account.url + href: actor.url } ] } - return res.json(json).end() + return res.json(json) }