diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-11-14 17:31:26 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-11-27 19:40:51 +0100 |
commit | 350e31d6b64e4973dfa5e9f7b46841cb09aeb1ad (patch) | |
tree | f4191f3c04a5230fcf8ca3d6ca3248643fc4151d /server/controllers/webfinger.ts | |
parent | e34c85e527100c0b5c44567bd951e95be41b8d7e (diff) | |
download | PeerTube-350e31d6b64e4973dfa5e9f7b46841cb09aeb1ad.tar.gz PeerTube-350e31d6b64e4973dfa5e9f7b46841cb09aeb1ad.tar.zst PeerTube-350e31d6b64e4973dfa5e9f7b46841cb09aeb1ad.zip |
Follow works
Diffstat (limited to 'server/controllers/webfinger.ts')
-rw-r--r-- | server/controllers/webfinger.ts | 39 |
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 @@ | |||
1 | import * as express from 'express' | ||
2 | |||
3 | import { CONFIG, PREVIEWS_SIZE, EMBED_SIZE } from '../initializers' | ||
4 | import { oembedValidator } from '../middlewares' | ||
5 | import { VideoInstance } from '../models' | ||
6 | import { webfingerValidator } from '../middlewares/validators/webfinger' | ||
7 | import { AccountInstance } from '../models/account/account-interface' | ||
8 | |||
9 | const webfingerRouter = express.Router() | ||
10 | |||
11 | webfingerRouter.use('/.well-known/webfinger', | ||
12 | webfingerValidator, | ||
13 | webfingerController | ||
14 | ) | ||
15 | |||
16 | // --------------------------------------------------------------------------- | ||
17 | |||
18 | export { | ||
19 | webfingerRouter | ||
20 | } | ||
21 | |||
22 | // --------------------------------------------------------------------------- | ||
23 | |||
24 | function 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 | } | ||