diff options
Diffstat (limited to 'server/middlewares')
-rw-r--r-- | server/middlewares/activitypub.ts | 4 | ||||
-rw-r--r-- | server/middlewares/index.ts | 2 | ||||
-rw-r--r-- | server/middlewares/servers.ts (renamed from server/middlewares/pods.ts) | 0 | ||||
-rw-r--r-- | server/middlewares/sort.ts | 7 | ||||
-rw-r--r-- | server/middlewares/validators/index.ts | 2 | ||||
-rw-r--r-- | server/middlewares/validators/servers.ts (renamed from server/middlewares/validators/pods.ts) | 2 | ||||
-rw-r--r-- | server/middlewares/validators/video-channels.ts | 4 | ||||
-rw-r--r-- | server/middlewares/validators/videos.ts | 4 |
8 files changed, 9 insertions, 16 deletions
diff --git a/server/middlewares/activitypub.ts b/server/middlewares/activitypub.ts index bed2bfeab..0ea522e5c 100644 --- a/server/middlewares/activitypub.ts +++ b/server/middlewares/activitypub.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import { NextFunction, Request, Response, RequestHandler } from 'express' | 1 | import { NextFunction, Request, Response, RequestHandler } from 'express' |
2 | import { ActivityPubSignature } from '../../shared' | 2 | import { ActivityPubSignature } from '../../shared' |
3 | import { isSignatureVerified, logger } from '../helpers' | 3 | import { isSignatureVerified, logger } from '../helpers' |
4 | import { fetchRemoteAccountAndCreatePod } from '../helpers/activitypub' | 4 | import { fetchRemoteAccountAndCreateServer } from '../helpers/activitypub' |
5 | import { database as db, ACTIVITY_PUB_ACCEPT_HEADER } from '../initializers' | 5 | import { database as db, ACTIVITY_PUB_ACCEPT_HEADER } from '../initializers' |
6 | import { each, eachSeries, waterfall } from 'async' | 6 | import { each, eachSeries, waterfall } from 'async' |
7 | 7 | ||
@@ -14,7 +14,7 @@ async function checkSignature (req: Request, res: Response, next: NextFunction) | |||
14 | 14 | ||
15 | // We don't have this account in our database, fetch it on remote | 15 | // We don't have this account in our database, fetch it on remote |
16 | if (!account) { | 16 | if (!account) { |
17 | const accountResult = await fetchRemoteAccountAndCreatePod(signatureObject.creator) | 17 | const accountResult = await fetchRemoteAccountAndCreateServer(signatureObject.creator) |
18 | 18 | ||
19 | if (!accountResult) { | 19 | if (!accountResult) { |
20 | return res.sendStatus(403) | 20 | return res.sendStatus(403) |
diff --git a/server/middlewares/index.ts b/server/middlewares/index.ts index 40480450b..aafcad2d9 100644 --- a/server/middlewares/index.ts +++ b/server/middlewares/index.ts | |||
@@ -3,7 +3,7 @@ export * from './activitypub' | |||
3 | export * from './async' | 3 | export * from './async' |
4 | export * from './oauth' | 4 | export * from './oauth' |
5 | export * from './pagination' | 5 | export * from './pagination' |
6 | export * from './pods' | 6 | export * from './servers' |
7 | export * from './search' | 7 | export * from './search' |
8 | export * from './sort' | 8 | export * from './sort' |
9 | export * from './user-right' | 9 | export * from './user-right' |
diff --git a/server/middlewares/pods.ts b/server/middlewares/servers.ts index eaf9aa144..eaf9aa144 100644 --- a/server/middlewares/pods.ts +++ b/server/middlewares/servers.ts | |||
diff --git a/server/middlewares/sort.ts b/server/middlewares/sort.ts index 20ae341f0..279b29e65 100644 --- a/server/middlewares/sort.ts +++ b/server/middlewares/sort.ts | |||
@@ -4,12 +4,6 @@ import * as express from 'express' | |||
4 | import { SortType } from '../helpers' | 4 | import { SortType } from '../helpers' |
5 | import { database } from '../initializers' | 5 | import { database } from '../initializers' |
6 | 6 | ||
7 | function setPodsSort (req: express.Request, res: express.Response, next: express.NextFunction) { | ||
8 | if (!req.query.sort) req.query.sort = '-createdAt' | ||
9 | |||
10 | return next() | ||
11 | } | ||
12 | |||
13 | function setUsersSort (req: express.Request, res: express.Response, next: express.NextFunction) { | 7 | function setUsersSort (req: express.Request, res: express.Response, next: express.NextFunction) { |
14 | if (!req.query.sort) req.query.sort = '-createdAt' | 8 | if (!req.query.sort) req.query.sort = '-createdAt' |
15 | 9 | ||
@@ -70,7 +64,6 @@ function setBlacklistSort (req: express.Request, res: express.Response, next: ex | |||
70 | // --------------------------------------------------------------------------- | 64 | // --------------------------------------------------------------------------- |
71 | 65 | ||
72 | export { | 66 | export { |
73 | setPodsSort, | ||
74 | setUsersSort, | 67 | setUsersSort, |
75 | setVideoAbusesSort, | 68 | setVideoAbusesSort, |
76 | setVideoChannelsSort, | 69 | setVideoChannelsSort, |
diff --git a/server/middlewares/validators/index.ts b/server/middlewares/validators/index.ts index 92a4bad28..3f5afe5b3 100644 --- a/server/middlewares/validators/index.ts +++ b/server/middlewares/validators/index.ts | |||
@@ -2,7 +2,7 @@ export * from './account' | |||
2 | export * from './oembed' | 2 | export * from './oembed' |
3 | export * from './activitypub' | 3 | export * from './activitypub' |
4 | export * from './pagination' | 4 | export * from './pagination' |
5 | export * from './pods' | 5 | export * from './servers' |
6 | export * from './sort' | 6 | export * from './sort' |
7 | export * from './users' | 7 | export * from './users' |
8 | export * from './videos' | 8 | export * from './videos' |
diff --git a/server/middlewares/validators/pods.ts b/server/middlewares/validators/servers.ts index e17369a6f..95b69b789 100644 --- a/server/middlewares/validators/pods.ts +++ b/server/middlewares/validators/servers.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { body } from 'express-validator/check' | 2 | import { body } from 'express-validator/check' |
3 | import { isEachUniqueHostValid } from '../../helpers/custom-validators/pods' | 3 | import { isEachUniqueHostValid } from '../../helpers/custom-validators/servers' |
4 | import { isTestInstance } from '../../helpers/core-utils' | 4 | import { isTestInstance } from '../../helpers/core-utils' |
5 | import { CONFIG } from '../../initializers/constants' | 5 | import { CONFIG } from '../../initializers/constants' |
6 | import { logger } from '../../helpers/logger' | 6 | import { logger } from '../../helpers/logger' |
diff --git a/server/middlewares/validators/video-channels.ts b/server/middlewares/validators/video-channels.ts index 53416a857..f0ead24e3 100644 --- a/server/middlewares/validators/video-channels.ts +++ b/server/middlewares/validators/video-channels.ts | |||
@@ -50,7 +50,7 @@ const videoChannelsUpdateValidator = [ | |||
50 | // We need to make additional checks | 50 | // We need to make additional checks |
51 | if (res.locals.videoChannel.isOwned() === false) { | 51 | if (res.locals.videoChannel.isOwned() === false) { |
52 | return res.status(403) | 52 | return res.status(403) |
53 | .json({ error: 'Cannot update video channel of another pod' }) | 53 | .json({ error: 'Cannot update video channel of another server' }) |
54 | .end() | 54 | .end() |
55 | } | 55 | } |
56 | 56 | ||
@@ -113,7 +113,7 @@ function checkUserCanDeleteVideoChannel (res: express.Response, callback: () => | |||
113 | // Retrieve the user who did the request | 113 | // Retrieve the user who did the request |
114 | if (res.locals.videoChannel.isOwned() === false) { | 114 | if (res.locals.videoChannel.isOwned() === false) { |
115 | return res.status(403) | 115 | return res.status(403) |
116 | .json({ error: 'Cannot remove video channel of another pod.' }) | 116 | .json({ error: 'Cannot remove video channel of another server.' }) |
117 | .end() | 117 | .end() |
118 | } | 118 | } |
119 | 119 | ||
diff --git a/server/middlewares/validators/videos.ts b/server/middlewares/validators/videos.ts index 10b426df3..158b475e3 100644 --- a/server/middlewares/validators/videos.ts +++ b/server/middlewares/validators/videos.ts | |||
@@ -127,7 +127,7 @@ const videosUpdateValidator = [ | |||
127 | // We need to make additional checks | 127 | // We need to make additional checks |
128 | if (video.isOwned() === false) { | 128 | if (video.isOwned() === false) { |
129 | return res.status(403) | 129 | return res.status(403) |
130 | .json({ error: 'Cannot update video of another pod' }) | 130 | .json({ error: 'Cannot update video of another server' }) |
131 | .end() | 131 | .end() |
132 | } | 132 | } |
133 | 133 | ||
@@ -250,7 +250,7 @@ function checkUserCanDeleteVideo (userId: number, res: express.Response, callbac | |||
250 | // Retrieve the user who did the request | 250 | // Retrieve the user who did the request |
251 | if (res.locals.video.isOwned() === false) { | 251 | if (res.locals.video.isOwned() === false) { |
252 | return res.status(403) | 252 | return res.status(403) |
253 | .json({ error: 'Cannot remove video of another pod, blacklist it' }) | 253 | .json({ error: 'Cannot remove video of another server, blacklist it' }) |
254 | .end() | 254 | .end() |
255 | } | 255 | } |
256 | 256 | ||