Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Fix videos list user NSFW policy

Chocobozzzd1a63fc7ac58
diff --git a/client/src/app/shared/video/video-miniature.component.ts b/client/src/app/shared/video/video-miniature.component.ts
index 27098f4b4a..7e8692b0be 100644
--- a/client/src/app/shared/video/video-miniature.component.ts
+++ b/client/src/app/shared/video/video-miniature.component.ts
@@ -16,12 +16,14 @@ export class VideoMiniatureComponent implements OnInit {
@Input() video: Video
@Input() ownerDisplayType: OwnerDisplayType = 'account'
- isVideoBlur: boolean
-
private ownerDisplayTypeChosen: 'account' | 'videoChannel'
constructor (private serverService: ServerService) { }
+ get isVideoBlur () {
+ return this.video.isVideoNSFWForUser(this.user, this.serverService.getConfig())
+ }
+
ngOnInit () {
if (this.ownerDisplayType === 'account' || this.ownerDisplayType === 'videoChannel') {
this.ownerDisplayTypeChosen = this.ownerDisplayType
@@ -38,8 +40,6 @@ export class VideoMiniatureComponent implements OnInit {
} else {
this.ownerDisplayTypeChosen = 'videoChannel'
}
-
- this.isVideoBlur = this.video.isVideoNSFWForUser(this.user, this.serverService.getConfig())
}
displayOwnerAccount () {
diff --git a/client/webpack/webpack.video-embed.js b/client/webpack/webpack.video-embed.js
index 12ab6a639c..909048cca8 100644
--- a/client/webpack/webpack.video-embed.js
+++ b/client/webpack/webpack.video-embed.js
@@ -39,7 +39,7 @@ module.exports = function () {
publicPath: '/client/standalone/videos/'
},
- // devtool: 'source-map',
+ devtool: process.env.NODE_ENV === 'production' ? false : 'source-map',
module: {
diff --git a/server/helpers/express-utils.ts b/server/helpers/express-utils.ts
index 9cf8fbeac2..8a9cee8c57 100644
--- a/server/helpers/express-utils.ts
+++ b/server/helpers/express-utils.ts
@@ -6,6 +6,7 @@ import { User } from '../../shared/models/users'
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
@@ -13,7 +14,7 @@ function buildNSFWFilter (res: express.Response, paramNSFW?: string) {
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.nsfwPolicy === 'do_not_list') return false