diff options
Diffstat (limited to 'server/helpers/express-utils.ts')
-rw-r--r-- | server/helpers/express-utils.ts | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/server/helpers/express-utils.ts b/server/helpers/express-utils.ts index 9a72ee96d..e0a1d56a5 100644 --- a/server/helpers/express-utils.ts +++ b/server/helpers/express-utils.ts | |||
@@ -1,11 +1,11 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import * as multer from 'multer' | 2 | import * as multer from 'multer' |
3 | import { CONFIG, REMOTE_SCHEME } from '../initializers' | 3 | import { REMOTE_SCHEME } from '../initializers/constants' |
4 | import { logger } from './logger' | 4 | import { logger } from './logger' |
5 | import { deleteFileAsync, generateRandomString } from './utils' | 5 | import { deleteFileAsync, generateRandomString } from './utils' |
6 | import { extname } from 'path' | 6 | import { extname } from 'path' |
7 | import { isArray } from './custom-validators/misc' | 7 | import { isArray } from './custom-validators/misc' |
8 | import { UserModel } from '../models/account/user' | 8 | import { CONFIG } from '../initializers/config' |
9 | 9 | ||
10 | function buildNSFWFilter (res?: express.Response, paramNSFW?: string) { | 10 | function buildNSFWFilter (res?: express.Response, paramNSFW?: string) { |
11 | if (paramNSFW === 'true') return true | 11 | if (paramNSFW === 'true') return true |
@@ -13,7 +13,7 @@ function buildNSFWFilter (res?: express.Response, paramNSFW?: string) { | |||
13 | if (paramNSFW === 'both') return undefined | 13 | if (paramNSFW === 'both') return undefined |
14 | 14 | ||
15 | if (res && res.locals.oauth) { | 15 | if (res && res.locals.oauth) { |
16 | const user: UserModel = res.locals.oauth.token.User | 16 | const user = res.locals.oauth.token.User |
17 | 17 | ||
18 | // User does not want NSFW videos | 18 | // User does not want NSFW videos |
19 | if (user.nsfwPolicy === 'do_not_list') return false | 19 | if (user.nsfwPolicy === 'do_not_list') return false |
@@ -59,7 +59,7 @@ function getHostWithPort (host: string) { | |||
59 | return host | 59 | return host |
60 | } | 60 | } |
61 | 61 | ||
62 | function badRequest (req: express.Request, res: express.Response, next: express.NextFunction) { | 62 | function badRequest (req: express.Request, res: express.Response) { |
63 | return res.type('json').status(400).end() | 63 | return res.type('json').status(400).end() |
64 | } | 64 | } |
65 | 65 | ||
@@ -100,7 +100,7 @@ function createReqFiles ( | |||
100 | } | 100 | } |
101 | 101 | ||
102 | function isUserAbleToSearchRemoteURI (res: express.Response) { | 102 | function isUserAbleToSearchRemoteURI (res: express.Response) { |
103 | const user: UserModel = res.locals.oauth ? res.locals.oauth.token.User : undefined | 103 | const user = res.locals.oauth ? res.locals.oauth.token.User : undefined |
104 | 104 | ||
105 | return CONFIG.SEARCH.REMOTE_URI.ANONYMOUS === true || | 105 | return CONFIG.SEARCH.REMOTE_URI.ANONYMOUS === true || |
106 | (CONFIG.SEARCH.REMOTE_URI.USERS === true && user !== undefined) | 106 | (CONFIG.SEARCH.REMOTE_URI.USERS === true && user !== undefined) |