diff options
Diffstat (limited to 'server/controllers/services.ts')
-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 | } | ||