aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares/validators')
-rw-r--r--server/middlewares/validators/index.ts1
-rw-r--r--server/middlewares/validators/object-storage-proxy.ts20
2 files changed, 21 insertions, 0 deletions
diff --git a/server/middlewares/validators/index.ts b/server/middlewares/validators/index.ts
index 899da229a..9bc8887ff 100644
--- a/server/middlewares/validators/index.ts
+++ b/server/middlewares/validators/index.ts
@@ -11,6 +11,7 @@ export * from './follows'
11export * from './jobs' 11export * from './jobs'
12export * from './logs' 12export * from './logs'
13export * from './metrics' 13export * from './metrics'
14export * from './object-storage-proxy'
14export * from './oembed' 15export * from './oembed'
15export * from './pagination' 16export * from './pagination'
16export * from './plugins' 17export * from './plugins'
diff --git a/server/middlewares/validators/object-storage-proxy.ts b/server/middlewares/validators/object-storage-proxy.ts
new file mode 100644
index 000000000..bbd77f262
--- /dev/null
+++ b/server/middlewares/validators/object-storage-proxy.ts
@@ -0,0 +1,20 @@
1import express from 'express'
2import { CONFIG } from '@server/initializers/config'
3import { HttpStatusCode } from '@shared/models'
4
5const ensurePrivateObjectStorageProxyIsEnabled = [
6 (req: express.Request, res: express.Response, next: express.NextFunction) => {
7 if (CONFIG.OBJECT_STORAGE.PROXY.PROXIFY_PRIVATE_FILES !== true) {
8 return res.fail({
9 message: 'Private object storage proxy is not enabled',
10 status: HttpStatusCode.BAD_REQUEST_400
11 })
12 }
13
14 return next()
15 }
16]
17
18export {
19 ensurePrivateObjectStorageProxyIsEnabled
20}