import { deleteFileAsync, generateRandomString } from './utils'
import { extname } from 'path'
import { isArray } from './custom-validators/misc'
+import { UserModel } from '../models/account/user'
function buildNSFWFilter (res: express.Response, paramNSFW?: string) {
if (paramNSFW === 'true') return true
if (paramNSFW === 'both') return undefined
if (res.locals.oauth) {
- const user: User = res.locals.oauth.token.User
+ const user: UserModel = res.locals.oauth.token.User
+
// User does not want NSFW videos
- if (user && user.nsfwPolicy === 'do_not_list') return false
+ if (user.nsfwPolicy === 'do_not_list') return false
+
+ // Both
+ return undefined
}
if (CONFIG.INSTANCE.DEFAULT_NSFW_POLICY === 'do_not_list') return false