mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-03 17:59:37 +02:00

* 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
83 lines
1.6 KiB
TypeScript
83 lines
1.6 KiB
TypeScript
import { pick } from '@peertube/peertube-core-utils'
|
|
import {
|
|
VideoChannelsSearchQueryAfterSanitize,
|
|
VideoPlaylistsSearchQueryAfterSanitize,
|
|
VideosCommonQueryAfterSanitize,
|
|
VideosSearchQueryAfterSanitize
|
|
} from '@peertube/peertube-models'
|
|
|
|
function pickCommonVideoQuery (query: VideosCommonQueryAfterSanitize) {
|
|
return pick(query, [
|
|
'start',
|
|
'count',
|
|
'sort',
|
|
'nsfw',
|
|
'nsfwFlagsIncluded',
|
|
'nsfwFlagsExcluded',
|
|
'isLive',
|
|
'categoryOneOf',
|
|
'licenceOneOf',
|
|
'languageOneOf',
|
|
'host',
|
|
'privacyOneOf',
|
|
'tagsOneOf',
|
|
'tagsAllOf',
|
|
'isLocal',
|
|
'include',
|
|
'skipCount',
|
|
'hasHLSFiles',
|
|
'hasWebVideoFiles',
|
|
'search',
|
|
'excludeAlreadyWatched',
|
|
'autoTagOneOf'
|
|
])
|
|
}
|
|
|
|
function pickSearchVideoQuery (query: VideosSearchQueryAfterSanitize) {
|
|
return {
|
|
...pickCommonVideoQuery(query),
|
|
|
|
...pick(query, [
|
|
'searchTarget',
|
|
'host',
|
|
'startDate',
|
|
'endDate',
|
|
'originallyPublishedStartDate',
|
|
'originallyPublishedEndDate',
|
|
'durationMin',
|
|
'durationMax',
|
|
'uuids'
|
|
])
|
|
}
|
|
}
|
|
|
|
function pickSearchChannelQuery (query: VideoChannelsSearchQueryAfterSanitize) {
|
|
return pick(query, [
|
|
'searchTarget',
|
|
'search',
|
|
'start',
|
|
'count',
|
|
'sort',
|
|
'host',
|
|
'handles'
|
|
])
|
|
}
|
|
|
|
function pickSearchPlaylistQuery (query: VideoPlaylistsSearchQueryAfterSanitize) {
|
|
return pick(query, [
|
|
'searchTarget',
|
|
'search',
|
|
'start',
|
|
'count',
|
|
'sort',
|
|
'host',
|
|
'uuids'
|
|
])
|
|
}
|
|
|
|
export {
|
|
pickCommonVideoQuery,
|
|
pickSearchVideoQuery,
|
|
pickSearchPlaylistQuery,
|
|
pickSearchChannelQuery
|
|
}
|