diff options
author | Chocobozzz <me@florianbigard.com> | 2018-02-21 16:44:18 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-02-21 16:44:43 +0100 |
commit | e8cb44090e654fda339506dccfcec7fea8722723 (patch) | |
tree | 2a36d264cf44cededff0e272919316a3feabcbc1 /server/controllers | |
parent | 276d03ed1a469fd4e3579f92392b6f9a1567d1ca (diff) | |
download | PeerTube-e8cb44090e654fda339506dccfcec7fea8722723.tar.gz PeerTube-e8cb44090e654fda339506dccfcec7fea8722723.tar.zst PeerTube-e8cb44090e654fda339506dccfcec7fea8722723.zip |
Add links to comment mentions
Diffstat (limited to 'server/controllers')
-rw-r--r-- | server/controllers/services.ts | 9 |
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 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { CONFIG, EMBED_SIZE, PREVIEWS_SIZE } from '../initializers' | 2 | import { CONFIG, EMBED_SIZE, PREVIEWS_SIZE } from '../initializers' |
3 | import { asyncMiddleware, oembedValidator } from '../middlewares' | 3 | import { asyncMiddleware, oembedValidator } from '../middlewares' |
4 | import { accountsNameWithHostGetValidator } from '../middlewares/validators' | ||
4 | import { VideoModel } from '../models/video/video' | 5 | import { VideoModel } from '../models/video/video' |
5 | 6 | ||
6 | const servicesRouter = express.Router() | 7 | const servicesRouter = express.Router() |
@@ -9,6 +10,10 @@ servicesRouter.use('/oembed', | |||
9 | asyncMiddleware(oembedValidator), | 10 | asyncMiddleware(oembedValidator), |
10 | generateOEmbed | 11 | generateOEmbed |
11 | ) | 12 | ) |
13 | servicesRouter.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 | |||
71 | function redirectToAccountUrl (req: express.Request, res: express.Response, next: express.NextFunction) { | ||
72 | return res.redirect(res.locals.account.Actor.url) | ||
73 | } | ||