mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 10:49:28 +02:00
Improve NSFW system
* Add NSFW flags to videos so the publisher can add more NSFW context * Add NSFW summary to videos, similar to content warning system so the publisher has a free text to describe NSFW aspect of its video * Add additional "warn" NSFW policy: the video thumbnail is not blurred and we display a tag below the video miniature, the video player includes the NSFW warning (with context if available) and it also prevent autoplay * "blur" NSFW settings inherits "warn" policy and also blur the video thumbnail * Add NSFW flag settings to users so they can have more granular control about what content they want to hide, warn or display
This commit is contained in:
parent
fac6b15ada
commit
dd4027a10f
181 changed files with 5081 additions and 2061 deletions
|
@ -77,6 +77,7 @@ import { VideoPlaylistModel } from '../video/video-playlist.js'
|
|||
import { VideoModel } from '../video/video.js'
|
||||
import { UserNotificationSettingModel } from './user-notification-setting.js'
|
||||
import { UserExportModel } from './user-export.js'
|
||||
import { isNSFWFlagsValid } from '@server/helpers/custom-validators/videos.js'
|
||||
|
||||
enum ScopeNames {
|
||||
FOR_ME_API = 'FOR_ME_API',
|
||||
|
@ -316,6 +317,30 @@ export class UserModel extends SequelizeModel<UserModel> {
|
|||
@Column(DataType.ENUM(...Object.values(NSFW_POLICY_TYPES)))
|
||||
nsfwPolicy: NSFWPolicyType
|
||||
|
||||
@AllowNull(false)
|
||||
@Default(0)
|
||||
@Is('UserNSFWFlagsDisplayed', value => throwIfNotValid(value, isNSFWFlagsValid, 'NSFW flags'))
|
||||
@Column
|
||||
nsfwFlagsDisplayed: number
|
||||
|
||||
@AllowNull(false)
|
||||
@Default(0)
|
||||
@Is('UserNSFWFlagsHidden', value => throwIfNotValid(value, isNSFWFlagsValid, 'NSFW flags'))
|
||||
@Column
|
||||
nsfwFlagsHidden: number
|
||||
|
||||
@AllowNull(false)
|
||||
@Default(0)
|
||||
@Is('nsfwFlagsBlurred', value => throwIfNotValid(value, isNSFWFlagsValid, 'NSFW flags'))
|
||||
@Column
|
||||
nsfwFlagsBlurred: number
|
||||
|
||||
@AllowNull(false)
|
||||
@Default(0)
|
||||
@Is('UserNSFWFlagsWarned', value => throwIfNotValid(value, isNSFWFlagsValid, 'NSFW flags'))
|
||||
@Column
|
||||
nsfwFlagsWarned: number
|
||||
|
||||
@AllowNull(false)
|
||||
@Is('p2pEnabled', value => throwIfNotValid(value, isUserP2PEnabledValid, 'P2P enabled'))
|
||||
@Column
|
||||
|
@ -974,6 +999,10 @@ export class UserModel extends SequelizeModel<UserModel> {
|
|||
emailVerified: this.emailVerified,
|
||||
|
||||
nsfwPolicy: this.nsfwPolicy,
|
||||
nsfwFlagsDisplayed: this.nsfwFlagsDisplayed,
|
||||
nsfwFlagsHidden: this.nsfwFlagsHidden,
|
||||
nsfwFlagsWarned: this.nsfwFlagsWarned,
|
||||
nsfwFlagsBlurred: this.nsfwFlagsBlurred,
|
||||
|
||||
p2pEnabled: this.p2pEnabled,
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue