1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-03 01:39: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:
Chocobozzz 2025-04-24 14:51:07 +02:00
parent fac6b15ada
commit dd4027a10f
No known key found for this signature in database
GPG key ID: 583A612D890159BE
181 changed files with 5081 additions and 2061 deletions

View file

@ -5,7 +5,7 @@ import { buildDigest } from './peertube-crypto.js'
import type { signJsonLDObject } from './peertube-jsonld.js'
import { doJSONRequest } from './requests.js'
export type ContextFilter = <T> (arg: T) => Promise<T>
export type ContextFilter = <T>(arg: T) => Promise<T>
export function buildGlobalHTTPHeaders (
body: any,
@ -18,11 +18,11 @@ export function buildGlobalHTTPHeaders (
}
}
export async function activityPubContextify <T> (data: T, type: ContextType, contextFilter: ContextFilter) {
export async function activityPubContextify<T> (data: T, type: ContextType, contextFilter: ContextFilter) {
return { ...await getContextData(type, contextFilter), ...data }
}
export async function signAndContextify <T> (options: {
export async function signAndContextify<T> (options: {
byActor: { url: string, privateKey: string }
data: T
contextType: ContextType | null
@ -65,9 +65,9 @@ export function hasAPPublic (toOrCC: string[]) {
// Private
// ---------------------------------------------------------------------------
type ContextValue = { [ id: string ]: (string | { '@type': string, '@id': string }) }
type ContextValue = { [id: string]: string | { '@type': string, '@id': string } }
const contextStore: { [ id in ContextType ]: (string | { [ id: string ]: string })[] } = {
const contextStore: { [id in ContextType]: (string | { [id: string]: string })[] } = {
Video: buildContext({
Hashtag: 'as:Hashtag',
category: 'sc:category',
@ -93,6 +93,7 @@ const contextStore: { [ id in ContextType ]: (string | { [ id: string ]: string
},
Infohash: 'pt:Infohash',
SensitiveTag: 'pt:SensitiveTag',
tileWidth: {
'@type': 'sc:Number',