aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/services.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-02-21 16:44:18 +0100
committerChocobozzz <me@florianbigard.com>2018-02-21 16:44:43 +0100
commite8cb44090e654fda339506dccfcec7fea8722723 (patch)
tree2a36d264cf44cededff0e272919316a3feabcbc1 /server/controllers/services.ts
parent276d03ed1a469fd4e3579f92392b6f9a1567d1ca (diff)
downloadPeerTube-e8cb44090e654fda339506dccfcec7fea8722723.tar.gz
PeerTube-e8cb44090e654fda339506dccfcec7fea8722723.tar.zst
PeerTube-e8cb44090e654fda339506dccfcec7fea8722723.zip
Add links to comment mentions
Diffstat (limited to 'server/controllers/services.ts')
-rw-r--r--server/controllers/services.ts9
1 files changed, 9 insertions, 0 deletions
diff --git a/server/controllers/services.ts b/server/controllers/services.ts
index 3ac78a5df..c272edccd 100644
--- a/server/controllers/services.ts
+++ b/server/controllers/services.ts
@@ -1,6 +1,7 @@
1import * as express from 'express' 1import * as express from 'express'
2import { CONFIG, EMBED_SIZE, PREVIEWS_SIZE } from '../initializers' 2import { CONFIG, EMBED_SIZE, PREVIEWS_SIZE } from '../initializers'
3import { asyncMiddleware, oembedValidator } from '../middlewares' 3import { asyncMiddleware, oembedValidator } from '../middlewares'
4import { accountsNameWithHostGetValidator } from '../middlewares/validators'
4import { VideoModel } from '../models/video/video' 5import { VideoModel } from '../models/video/video'
5 6
6const servicesRouter = express.Router() 7const servicesRouter = express.Router()
@@ -9,6 +10,10 @@ servicesRouter.use('/oembed',
9 asyncMiddleware(oembedValidator), 10 asyncMiddleware(oembedValidator),
10 generateOEmbed 11 generateOEmbed
11) 12)
13servicesRouter.use('/redirect/accounts/:nameWithHost',
14 asyncMiddleware(accountsNameWithHostGetValidator),
15 redirectToAccountUrl
16)
12 17
13// --------------------------------------------------------------------------- 18// ---------------------------------------------------------------------------
14 19
@@ -62,3 +67,7 @@ function generateOEmbed (req: express.Request, res: express.Response, next: expr
62 67
63 return res.json(json) 68 return res.json(json)
64} 69}
70
71function redirectToAccountUrl (req: express.Request, res: express.Response, next: express.NextFunction) {
72 return res.redirect(res.locals.account.Actor.url)
73}