From ad9e39fb815d85e5e718c40540fa75471474fa17 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 25 May 2018 09:57:16 +0200 Subject: Only use account name in routes --- server/controllers/api/accounts.ts | 12 ++++++------ server/controllers/services.ts | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'server/controllers') diff --git a/server/controllers/api/accounts.ts b/server/controllers/api/accounts.ts index ccae0436b..8e937276c 100644 --- a/server/controllers/api/accounts.ts +++ b/server/controllers/api/accounts.ts @@ -8,7 +8,7 @@ import { setDefaultPagination, setDefaultSort } from '../../middlewares' -import { accountsGetValidator, accountsSortValidator, videosSortValidator } from '../../middlewares/validators' +import { accountsNameWithHostGetValidator, accountsSortValidator, videosSortValidator } from '../../middlewares/validators' import { AccountModel } from '../../models/account/account' import { VideoModel } from '../../models/video/video' import { isNSFWHidden } from '../../helpers/express-utils' @@ -24,13 +24,13 @@ accountsRouter.get('/', asyncMiddleware(listAccounts) ) -accountsRouter.get('/:id', - asyncMiddleware(accountsGetValidator), +accountsRouter.get('/:accountName', + asyncMiddleware(accountsNameWithHostGetValidator), getAccount ) -accountsRouter.get('/:id/videos', - asyncMiddleware(accountsGetValidator), +accountsRouter.get('/:accountName/videos', + asyncMiddleware(accountsNameWithHostGetValidator), paginationValidator, videosSortValidator, setDefaultSort, @@ -39,7 +39,7 @@ accountsRouter.get('/:id/videos', asyncMiddleware(listAccountVideos) ) -accountsRouter.get('/:accountId/video-channels', +accountsRouter.get('/:accountName/video-channels', asyncMiddleware(listVideoAccountChannelsValidator), asyncMiddleware(listVideoAccountChannels) ) diff --git a/server/controllers/services.ts b/server/controllers/services.ts index c272edccd..a58a5b8cf 100644 --- a/server/controllers/services.ts +++ b/server/controllers/services.ts @@ -10,7 +10,7 @@ servicesRouter.use('/oembed', asyncMiddleware(oembedValidator), generateOEmbed ) -servicesRouter.use('/redirect/accounts/:nameWithHost', +servicesRouter.use('/redirect/accounts/:accountName', asyncMiddleware(accountsNameWithHostGetValidator), redirectToAccountUrl ) -- cgit v1.2.3