aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-03-19 10:35:15 +0100
committerChocobozzz <me@florianbigard.com>2019-03-19 10:35:15 +0100
commitdae86118ed5d4026d04acb9d0e36829b9ad8eb4e (patch)
treea5bf9c4487240bf75a9b328cad459a0587f90dea /server/helpers
parente65c0c5b1fab9c3d93f51721b2458cf5cf471f20 (diff)
downloadPeerTube-dae86118ed5d4026d04acb9d0e36829b9ad8eb4e.tar.gz
PeerTube-dae86118ed5d4026d04acb9d0e36829b9ad8eb4e.tar.zst
PeerTube-dae86118ed5d4026d04acb9d0e36829b9ad8eb4e.zip
Cleanup express locals typings
Diffstat (limited to 'server/helpers')
-rw-r--r--server/helpers/express-utils.ts5
1 files changed, 2 insertions, 3 deletions
diff --git a/server/helpers/express-utils.ts b/server/helpers/express-utils.ts
index 9a72ee96d..fef2da313 100644
--- a/server/helpers/express-utils.ts
+++ b/server/helpers/express-utils.ts
@@ -5,7 +5,6 @@ import { logger } from './logger'
5import { deleteFileAsync, generateRandomString } from './utils' 5import { deleteFileAsync, generateRandomString } from './utils'
6import { extname } from 'path' 6import { extname } from 'path'
7import { isArray } from './custom-validators/misc' 7import { isArray } from './custom-validators/misc'
8import { UserModel } from '../models/account/user'
9 8
10function buildNSFWFilter (res?: express.Response, paramNSFW?: string) { 9function buildNSFWFilter (res?: express.Response, paramNSFW?: string) {
11 if (paramNSFW === 'true') return true 10 if (paramNSFW === 'true') return true
@@ -13,7 +12,7 @@ function buildNSFWFilter (res?: express.Response, paramNSFW?: string) {
13 if (paramNSFW === 'both') return undefined 12 if (paramNSFW === 'both') return undefined
14 13
15 if (res && res.locals.oauth) { 14 if (res && res.locals.oauth) {
16 const user: UserModel = res.locals.oauth.token.User 15 const user = res.locals.oauth.token.User
17 16
18 // User does not want NSFW videos 17 // User does not want NSFW videos
19 if (user.nsfwPolicy === 'do_not_list') return false 18 if (user.nsfwPolicy === 'do_not_list') return false
@@ -100,7 +99,7 @@ function createReqFiles (
100} 99}
101 100
102function isUserAbleToSearchRemoteURI (res: express.Response) { 101function isUserAbleToSearchRemoteURI (res: express.Response) {
103 const user: UserModel = res.locals.oauth ? res.locals.oauth.token.User : undefined 102 const user = res.locals.oauth ? res.locals.oauth.token.User : undefined
104 103
105 return CONFIG.SEARCH.REMOTE_URI.ANONYMOUS === true || 104 return CONFIG.SEARCH.REMOTE_URI.ANONYMOUS === true ||
106 (CONFIG.SEARCH.REMOTE_URI.USERS === true && user !== undefined) 105 (CONFIG.SEARCH.REMOTE_URI.USERS === true && user !== undefined)