aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares')
-rw-r--r--server/middlewares/activitypub.ts4
-rw-r--r--server/middlewares/index.ts2
-rw-r--r--server/middlewares/servers.ts (renamed from server/middlewares/pods.ts)0
-rw-r--r--server/middlewares/sort.ts7
-rw-r--r--server/middlewares/validators/index.ts2
-rw-r--r--server/middlewares/validators/servers.ts (renamed from server/middlewares/validators/pods.ts)2
-rw-r--r--server/middlewares/validators/video-channels.ts4
-rw-r--r--server/middlewares/validators/videos.ts4
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 @@
1import { NextFunction, Request, Response, RequestHandler } from 'express' 1import { NextFunction, Request, Response, RequestHandler } from 'express'
2import { ActivityPubSignature } from '../../shared' 2import { ActivityPubSignature } from '../../shared'
3import { isSignatureVerified, logger } from '../helpers' 3import { isSignatureVerified, logger } from '../helpers'
4import { fetchRemoteAccountAndCreatePod } from '../helpers/activitypub' 4import { fetchRemoteAccountAndCreateServer } from '../helpers/activitypub'
5import { database as db, ACTIVITY_PUB_ACCEPT_HEADER } from '../initializers' 5import { database as db, ACTIVITY_PUB_ACCEPT_HEADER } from '../initializers'
6import { each, eachSeries, waterfall } from 'async' 6import { 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'
3export * from './async' 3export * from './async'
4export * from './oauth' 4export * from './oauth'
5export * from './pagination' 5export * from './pagination'
6export * from './pods' 6export * from './servers'
7export * from './search' 7export * from './search'
8export * from './sort' 8export * from './sort'
9export * from './user-right' 9export * 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'
4import { SortType } from '../helpers' 4import { SortType } from '../helpers'
5import { database } from '../initializers' 5import { database } from '../initializers'
6 6
7function 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
13function setUsersSort (req: express.Request, res: express.Response, next: express.NextFunction) { 7function 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
72export { 66export {
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'
2export * from './oembed' 2export * from './oembed'
3export * from './activitypub' 3export * from './activitypub'
4export * from './pagination' 4export * from './pagination'
5export * from './pods' 5export * from './servers'
6export * from './sort' 6export * from './sort'
7export * from './users' 7export * from './users'
8export * from './videos' 8export * 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 @@
1import * as express from 'express' 1import * as express from 'express'
2import { body } from 'express-validator/check' 2import { body } from 'express-validator/check'
3import { isEachUniqueHostValid } from '../../helpers/custom-validators/pods' 3import { isEachUniqueHostValid } from '../../helpers/custom-validators/servers'
4import { isTestInstance } from '../../helpers/core-utils' 4import { isTestInstance } from '../../helpers/core-utils'
5import { CONFIG } from '../../initializers/constants' 5import { CONFIG } from '../../initializers/constants'
6import { logger } from '../../helpers/logger' 6import { 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