aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/webfinger.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-11-14 17:31:26 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-11-27 19:40:51 +0100
commit350e31d6b64e4973dfa5e9f7b46841cb09aeb1ad (patch)
treef4191f3c04a5230fcf8ca3d6ca3248643fc4151d /server/controllers/webfinger.ts
parente34c85e527100c0b5c44567bd951e95be41b8d7e (diff)
downloadPeerTube-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.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}