diff options
Diffstat (limited to 'server/controllers')
-rw-r--r-- | server/controllers/api/index.ts | 4 | ||||
-rw-r--r-- | server/controllers/api/server/follows.ts | 20 | ||||
-rw-r--r-- | server/controllers/api/server/index.ts | 8 |
3 files changed, 16 insertions, 16 deletions
diff --git a/server/controllers/api/index.ts b/server/controllers/api/index.ts index 876c911c7..b00fb7467 100644 --- a/server/controllers/api/index.ts +++ b/server/controllers/api/index.ts | |||
@@ -4,13 +4,13 @@ import { badRequest } from '../../helpers' | |||
4 | 4 | ||
5 | import { oauthClientsRouter } from './oauth-clients' | 5 | import { oauthClientsRouter } from './oauth-clients' |
6 | import { configRouter } from './config' | 6 | import { configRouter } from './config' |
7 | import { applicationRouter } from './server' | 7 | import { serverRouter } from './server' |
8 | import { usersRouter } from './users' | 8 | import { usersRouter } from './users' |
9 | import { videosRouter } from './videos' | 9 | import { videosRouter } from './videos' |
10 | 10 | ||
11 | const apiRouter = express.Router() | 11 | const apiRouter = express.Router() |
12 | 12 | ||
13 | apiRouter.use('/application', applicationRouter) | 13 | apiRouter.use('/server', serverRouter) |
14 | apiRouter.use('/oauth-clients', oauthClientsRouter) | 14 | apiRouter.use('/oauth-clients', oauthClientsRouter) |
15 | apiRouter.use('/config', configRouter) | 15 | apiRouter.use('/config', configRouter) |
16 | apiRouter.use('/users', usersRouter) | 16 | apiRouter.use('/users', usersRouter) |
diff --git a/server/controllers/api/server/follows.ts b/server/controllers/api/server/follows.ts index e00787f02..520d4d858 100644 --- a/server/controllers/api/server/follows.ts +++ b/server/controllers/api/server/follows.ts | |||
@@ -15,9 +15,9 @@ import { ensureUserHasRight } from '../../../middlewares/user-right' | |||
15 | import { followValidator } from '../../../middlewares/validators/servers' | 15 | import { followValidator } from '../../../middlewares/validators/servers' |
16 | import { followersSortValidator, followingSortValidator } from '../../../middlewares/validators/sort' | 16 | import { followersSortValidator, followingSortValidator } from '../../../middlewares/validators/sort' |
17 | 17 | ||
18 | const applicationFollowsRouter = express.Router() | 18 | const serverFollowsRouter = express.Router() |
19 | 19 | ||
20 | applicationFollowsRouter.get('/following', | 20 | serverFollowsRouter.get('/following', |
21 | paginationValidator, | 21 | paginationValidator, |
22 | followingSortValidator, | 22 | followingSortValidator, |
23 | setFollowingSort, | 23 | setFollowingSort, |
@@ -25,15 +25,15 @@ applicationFollowsRouter.get('/following', | |||
25 | asyncMiddleware(listFollowing) | 25 | asyncMiddleware(listFollowing) |
26 | ) | 26 | ) |
27 | 27 | ||
28 | applicationFollowsRouter.post('/follow', | 28 | serverFollowsRouter.post('/follow', |
29 | authenticate, | 29 | authenticate, |
30 | ensureUserHasRight(UserRight.MANAGE_APPLICATION_FOLLOW), | 30 | ensureUserHasRight(UserRight.MANAGE_SERVER_FOLLOW), |
31 | followValidator, | 31 | followValidator, |
32 | setBodyHostsPort, | 32 | setBodyHostsPort, |
33 | asyncMiddleware(follow) | 33 | asyncMiddleware(follow) |
34 | ) | 34 | ) |
35 | 35 | ||
36 | applicationFollowsRouter.get('/followers', | 36 | serverFollowsRouter.get('/followers', |
37 | paginationValidator, | 37 | paginationValidator, |
38 | followersSortValidator, | 38 | followersSortValidator, |
39 | setFollowersSort, | 39 | setFollowersSort, |
@@ -44,21 +44,21 @@ applicationFollowsRouter.get('/followers', | |||
44 | // --------------------------------------------------------------------------- | 44 | // --------------------------------------------------------------------------- |
45 | 45 | ||
46 | export { | 46 | export { |
47 | applicationFollowsRouter | 47 | serverFollowsRouter |
48 | } | 48 | } |
49 | 49 | ||
50 | // --------------------------------------------------------------------------- | 50 | // --------------------------------------------------------------------------- |
51 | 51 | ||
52 | async function listFollowing (req: express.Request, res: express.Response, next: express.NextFunction) { | 52 | async function listFollowing (req: express.Request, res: express.Response, next: express.NextFunction) { |
53 | const applicationAccount = await getServerAccount() | 53 | const serverAccount = await getServerAccount() |
54 | const resultList = await db.AccountFollow.listFollowingForApi(applicationAccount.id, req.query.start, req.query.count, req.query.sort) | 54 | const resultList = await db.AccountFollow.listFollowingForApi(serverAccount.id, req.query.start, req.query.count, req.query.sort) |
55 | 55 | ||
56 | return res.json(getFormattedObjects(resultList.data, resultList.total)) | 56 | return res.json(getFormattedObjects(resultList.data, resultList.total)) |
57 | } | 57 | } |
58 | 58 | ||
59 | async function listFollowers (req: express.Request, res: express.Response, next: express.NextFunction) { | 59 | async function listFollowers (req: express.Request, res: express.Response, next: express.NextFunction) { |
60 | const applicationAccount = await getServerAccount() | 60 | const serverAccount = await getServerAccount() |
61 | const resultList = await db.AccountFollow.listFollowersForApi(applicationAccount.id, req.query.start, req.query.count, req.query.sort) | 61 | const resultList = await db.AccountFollow.listFollowersForApi(serverAccount.id, req.query.start, req.query.count, req.query.sort) |
62 | 62 | ||
63 | return res.json(getFormattedObjects(resultList.data, resultList.total)) | 63 | return res.json(getFormattedObjects(resultList.data, resultList.total)) |
64 | } | 64 | } |
diff --git a/server/controllers/api/server/index.ts b/server/controllers/api/server/index.ts index 011b971ed..8dc1a0031 100644 --- a/server/controllers/api/server/index.ts +++ b/server/controllers/api/server/index.ts | |||
@@ -1,12 +1,12 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { applicationFollowsRouter } from './follows' | 2 | import { serverFollowsRouter } from './follows' |
3 | 3 | ||
4 | const applicationRouter = express.Router() | 4 | const serverRouter = express.Router() |
5 | 5 | ||
6 | applicationRouter.use('/', applicationFollowsRouter) | 6 | serverRouter.use('/', serverFollowsRouter) |
7 | 7 | ||
8 | // --------------------------------------------------------------------------- | 8 | // --------------------------------------------------------------------------- |
9 | 9 | ||
10 | export { | 10 | export { |
11 | applicationRouter | 11 | serverRouter |
12 | } | 12 | } |