aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/services.ts
diff options
context:
space:
mode:
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}