mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-03 17:59:37 +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
|
@ -2,6 +2,7 @@ import { buildAspectRatio } from '@peertube/peertube-core-utils'
|
|||
import {
|
||||
LiveVideoCreate,
|
||||
LiveVideoLatencyMode,
|
||||
NSFWFlag,
|
||||
ThumbnailType,
|
||||
ThumbnailType_Type,
|
||||
VideoCreate,
|
||||
|
@ -56,9 +57,9 @@ export type ThumbnailOptions = {
|
|||
type ChaptersOption = { timecode: number, title: string }[]
|
||||
|
||||
type VideoAttributeHookFilter =
|
||||
'filter:api.video.user-import.video-attribute.result' |
|
||||
'filter:api.video.upload.video-attribute.result' |
|
||||
'filter:api.video.live.video-attribute.result'
|
||||
| 'filter:api.video.user-import.video-attribute.result'
|
||||
| 'filter:api.video.upload.video-attribute.result'
|
||||
| 'filter:api.video.live.video-attribute.result'
|
||||
|
||||
export class LocalVideoCreator {
|
||||
private readonly lTags: LoggerTagsFn
|
||||
|
@ -76,28 +77,30 @@ export class LocalVideoCreator {
|
|||
private videoFile: MVideoFile
|
||||
private videoPath: string
|
||||
|
||||
constructor (private readonly options: {
|
||||
lTags: LoggerTagsFn
|
||||
constructor (
|
||||
private readonly options: {
|
||||
lTags: LoggerTagsFn
|
||||
|
||||
videoFile: {
|
||||
path: string
|
||||
probe: FfprobeData
|
||||
videoFile: {
|
||||
path: string
|
||||
probe: FfprobeData
|
||||
}
|
||||
|
||||
videoAttributes: VideoAttributes
|
||||
liveAttributes: LiveAttributes
|
||||
|
||||
channel: MChannelAccountLight
|
||||
user: MUser
|
||||
videoAttributeResultHook: VideoAttributeHookFilter
|
||||
thumbnails: ThumbnailOptions
|
||||
|
||||
chapters: ChaptersOption | undefined
|
||||
fallbackChapters: {
|
||||
fromDescription: boolean
|
||||
finalFallback: ChaptersOption | undefined
|
||||
}
|
||||
}
|
||||
|
||||
videoAttributes: VideoAttributes
|
||||
liveAttributes: LiveAttributes
|
||||
|
||||
channel: MChannelAccountLight
|
||||
user: MUser
|
||||
videoAttributeResultHook: VideoAttributeHookFilter
|
||||
thumbnails: ThumbnailOptions
|
||||
|
||||
chapters: ChaptersOption | undefined
|
||||
fallbackChapters: {
|
||||
fromDescription: boolean
|
||||
finalFallback: ChaptersOption | undefined
|
||||
}
|
||||
}) {
|
||||
) {
|
||||
this.videoFilePath = options.videoFile?.path
|
||||
this.videoFileProbe = options.videoFile?.probe
|
||||
|
||||
|
@ -284,7 +287,11 @@ export class LocalVideoCreator {
|
|||
commentsPolicy: buildCommentsPolicy(videoInfo),
|
||||
downloadEnabled: videoInfo.downloadEnabled ?? CONFIG.DEFAULTS.PUBLISH.DOWNLOAD_ENABLED,
|
||||
waitTranscoding: videoInfo.waitTranscoding || false,
|
||||
|
||||
nsfw: videoInfo.nsfw || false,
|
||||
nsfwSummary: videoInfo.nsfwSummary,
|
||||
nsfwFlags: videoInfo.nsfwFlags || NSFWFlag.NONE,
|
||||
|
||||
description: videoInfo.description,
|
||||
support: videoInfo.support,
|
||||
privacy: videoInfo.privacy || VideoPrivacy.PRIVATE,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue