aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/webfinger.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/webfinger.ts')
-rw-r--r--server/controllers/webfinger.ts39
1 files changed, 39 insertions, 0 deletions
diff --git a/server/controllers/webfinger.ts b/server/controllers/webfinger.ts
new file mode 100644
index 000000000..1c726f0cb
--- /dev/null
+++ b/server/controllers/webfinger.ts
@@ -0,0 +1,39 @@
1import * as express from 'express'
2
3import { CONFIG, PREVIEWS_SIZE, EMBED_SIZE } from '../initializers'
4import { oembedValidator } from '../middlewares'
5import { VideoInstance } from '../models'
6import { webfingerValidator } from '../middlewares/validators/webfinger'
7import { AccountInstance } from '../models/account/account-interface'
8
9const webfingerRouter = express.Router()
10
11webfingerRouter.use('/.well-known/webfinger',
12 webfingerValidator,
13 webfingerController
14)
15
16// ---------------------------------------------------------------------------
17
18export {
19 webfingerRouter
20}
21
22// ---------------------------------------------------------------------------
23
24function webfingerController (req: express.Request, res: express.Response, next: express.NextFunction) {
25 const account: AccountInstance = res.locals.account
26
27 const json = {
28 subject: req.query.resource,
29 aliases: [ account.url ],
30 links: [
31 {
32 rel: 'self',
33 href: account.url
34 }
35 ]
36 }
37
38 return res.json(json).end()
39}