From e8cb44090e654fda339506dccfcec7fea8722723 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 21 Feb 2018 16:44:18 +0100 Subject: Add links to comment mentions --- server/controllers/services.ts | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'server/controllers/services.ts') 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 @@ import * as express from 'express' import { CONFIG, EMBED_SIZE, PREVIEWS_SIZE } from '../initializers' import { asyncMiddleware, oembedValidator } from '../middlewares' +import { accountsNameWithHostGetValidator } from '../middlewares/validators' import { VideoModel } from '../models/video/video' const servicesRouter = express.Router() @@ -9,6 +10,10 @@ servicesRouter.use('/oembed', asyncMiddleware(oembedValidator), generateOEmbed ) +servicesRouter.use('/redirect/accounts/:nameWithHost', + asyncMiddleware(accountsNameWithHostGetValidator), + redirectToAccountUrl +) // --------------------------------------------------------------------------- @@ -62,3 +67,7 @@ function generateOEmbed (req: express.Request, res: express.Response, next: expr return res.json(json) } + +function redirectToAccountUrl (req: express.Request, res: express.Response, next: express.NextFunction) { + return res.redirect(res.locals.account.Actor.url) +} -- cgit v1.2.3