mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-03 09:49:20 +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
|
@ -11,10 +11,11 @@ import {
|
|||
import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'
|
||||
|
||||
export class SearchCommand extends AbstractCommand {
|
||||
|
||||
searchChannels (options: OverrideCommandOptions & {
|
||||
search: string
|
||||
}) {
|
||||
searchChannels (
|
||||
options: OverrideCommandOptions & {
|
||||
search: string
|
||||
}
|
||||
) {
|
||||
return this.advancedChannelSearch({
|
||||
...options,
|
||||
|
||||
|
@ -22,9 +23,11 @@ export class SearchCommand extends AbstractCommand {
|
|||
})
|
||||
}
|
||||
|
||||
advancedChannelSearch (options: OverrideCommandOptions & {
|
||||
search: VideoChannelsSearchQuery
|
||||
}) {
|
||||
advancedChannelSearch (
|
||||
options: OverrideCommandOptions & {
|
||||
search: VideoChannelsSearchQuery
|
||||
}
|
||||
) {
|
||||
const { search } = options
|
||||
const path = '/api/v1/search/video-channels'
|
||||
|
||||
|
@ -38,9 +41,11 @@ export class SearchCommand extends AbstractCommand {
|
|||
})
|
||||
}
|
||||
|
||||
searchPlaylists (options: OverrideCommandOptions & {
|
||||
search: string
|
||||
}) {
|
||||
searchPlaylists (
|
||||
options: OverrideCommandOptions & {
|
||||
search: string
|
||||
}
|
||||
) {
|
||||
return this.advancedPlaylistSearch({
|
||||
...options,
|
||||
|
||||
|
@ -48,9 +53,11 @@ export class SearchCommand extends AbstractCommand {
|
|||
})
|
||||
}
|
||||
|
||||
advancedPlaylistSearch (options: OverrideCommandOptions & {
|
||||
search: VideoPlaylistsSearchQuery
|
||||
}) {
|
||||
advancedPlaylistSearch (
|
||||
options: OverrideCommandOptions & {
|
||||
search: VideoPlaylistsSearchQuery
|
||||
}
|
||||
) {
|
||||
const { search } = options
|
||||
const path = '/api/v1/search/video-playlists'
|
||||
|
||||
|
@ -64,10 +71,12 @@ export class SearchCommand extends AbstractCommand {
|
|||
})
|
||||
}
|
||||
|
||||
searchVideos (options: OverrideCommandOptions & {
|
||||
search: string
|
||||
sort?: string
|
||||
}) {
|
||||
searchVideos (
|
||||
options: OverrideCommandOptions & {
|
||||
search?: string
|
||||
sort?: string
|
||||
}
|
||||
) {
|
||||
const { search, sort } = options
|
||||
|
||||
return this.advancedVideoSearch({
|
||||
|
@ -80,9 +89,11 @@ export class SearchCommand extends AbstractCommand {
|
|||
})
|
||||
}
|
||||
|
||||
advancedVideoSearch (options: OverrideCommandOptions & {
|
||||
search: VideosSearchQuery
|
||||
}) {
|
||||
advancedVideoSearch (
|
||||
options: OverrideCommandOptions & {
|
||||
search?: VideosSearchQuery
|
||||
}
|
||||
) {
|
||||
const { search } = options
|
||||
const path = '/api/v1/search/videos'
|
||||
|
||||
|
|
|
@ -106,12 +106,23 @@ export class LiveCommand extends AbstractCommand {
|
|||
|
||||
async create (
|
||||
options: OverrideCommandOptions & {
|
||||
fields: Omit<LiveVideoCreate, 'thumbnailfile' | 'previewfile'> & { thumbnailfile?: string | Blob, previewfile?: string | Blob }
|
||||
fields: Omit<LiveVideoCreate, 'channelId' | 'thumbnailfile' | 'previewfile'> & {
|
||||
thumbnailfile?: string | Blob
|
||||
previewfile?: string | Blob
|
||||
channelId?: number
|
||||
}
|
||||
}
|
||||
) {
|
||||
const { fields } = options
|
||||
const path = '/api/v1/videos/live'
|
||||
|
||||
let defaultChannelId = 1
|
||||
|
||||
try {
|
||||
const { videoChannels } = await this.server.users.getMyInfo({ token: options.token })
|
||||
defaultChannelId = videoChannels[0].id
|
||||
} catch (e) { /* empty */ }
|
||||
|
||||
const attaches: any = {}
|
||||
if (fields.thumbnailfile) attaches.thumbnailfile = fields.thumbnailfile
|
||||
if (fields.previewfile) attaches.previewfile = fields.previewfile
|
||||
|
@ -121,7 +132,11 @@ export class LiveCommand extends AbstractCommand {
|
|||
|
||||
path,
|
||||
attaches,
|
||||
fields: omit(fields, [ 'thumbnailfile', 'previewfile' ]),
|
||||
fields: {
|
||||
channelId: defaultChannelId,
|
||||
|
||||
...omit(fields, [ 'thumbnailfile', 'previewfile' ])
|
||||
},
|
||||
implicitToken: true,
|
||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||
}))
|
||||
|
|
|
@ -649,6 +649,8 @@ export class VideosCommand extends AbstractCommand {
|
|||
'count',
|
||||
'sort',
|
||||
'nsfw',
|
||||
'nsfwFlagsExcluded',
|
||||
'nsfwFlagsIncluded',
|
||||
'isLive',
|
||||
'categoryOneOf',
|
||||
'licenceOneOf',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue