diff options
author | Chocobozzz <me@florianbigard.com> | 2023-02-15 16:36:04 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-02-15 16:36:04 +0100 |
commit | 5bfe684e76d32a7745671635f8a75f932bd522e4 (patch) | |
tree | 2da9c6607d1032c288417765ccb5145c9dc13ca7 /server/controllers/webfinger.ts | |
parent | 2a950cde896fdf8baa804ce2349f4db21cae5034 (diff) | |
download | PeerTube-5bfe684e76d32a7745671635f8a75f932bd522e4.tar.gz PeerTube-5bfe684e76d32a7745671635f8a75f932bd522e4.tar.zst PeerTube-5bfe684e76d32a7745671635f8a75f932bd522e4.zip |
Move webfinger controller in well known router
Diffstat (limited to 'server/controllers/webfinger.ts')
-rw-r--r-- | server/controllers/webfinger.ts | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/server/controllers/webfinger.ts b/server/controllers/webfinger.ts deleted file mode 100644 index 29ce01166..000000000 --- a/server/controllers/webfinger.ts +++ /dev/null | |||
@@ -1,44 +0,0 @@ | |||
1 | import cors from 'cors' | ||
2 | import express from 'express' | ||
3 | import { WEBSERVER } from '@server/initializers/constants' | ||
4 | import { asyncMiddleware } from '../middlewares' | ||
5 | import { webfingerValidator } from '../middlewares/validators' | ||
6 | |||
7 | const webfingerRouter = express.Router() | ||
8 | |||
9 | webfingerRouter.use(cors()) | ||
10 | |||
11 | webfingerRouter.get('/.well-known/webfinger', | ||
12 | asyncMiddleware(webfingerValidator), | ||
13 | webfingerController | ||
14 | ) | ||
15 | |||
16 | // --------------------------------------------------------------------------- | ||
17 | |||
18 | export { | ||
19 | webfingerRouter | ||
20 | } | ||
21 | |||
22 | // --------------------------------------------------------------------------- | ||
23 | |||
24 | function webfingerController (req: express.Request, res: express.Response) { | ||
25 | const actor = res.locals.actorUrl | ||
26 | |||
27 | const json = { | ||
28 | subject: req.query.resource, | ||
29 | aliases: [ actor.url ], | ||
30 | links: [ | ||
31 | { | ||
32 | rel: 'self', | ||
33 | type: 'application/activity+json', | ||
34 | href: actor.url | ||
35 | }, | ||
36 | { | ||
37 | rel: 'http://ostatus.org/schema/1.0/subscribe', | ||
38 | template: WEBSERVER.URL + '/remote-interaction?uri={uri}' | ||
39 | } | ||
40 | ] | ||
41 | } | ||
42 | |||
43 | return res.json(json) | ||
44 | } | ||