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
|
@ -1,11 +1,11 @@
|
|||
import express from 'express'
|
||||
import memoizee from 'memoizee'
|
||||
import { CategoryOverview, ChannelOverview, TagOverview, VideosOverview } from '@peertube/peertube-models'
|
||||
import { logger } from '@server/helpers/logger.js'
|
||||
import { Hooks } from '@server/lib/plugins/hooks.js'
|
||||
import { getServerActor } from '@server/models/application/application.js'
|
||||
import { VideoModel } from '@server/models/video/video.js'
|
||||
import { CategoryOverview, ChannelOverview, TagOverview, VideosOverview } from '@peertube/peertube-models'
|
||||
import { buildNSFWFilter } from '../../helpers/express-utils.js'
|
||||
import express from 'express'
|
||||
import memoizee from 'memoizee'
|
||||
import { buildNSFWFilters } from '../../helpers/express-utils.js'
|
||||
import { MEMOIZE_TTL, OVERVIEWS } from '../../initializers/constants.js'
|
||||
import { apiRateLimiter, asyncMiddleware, optionalAuthenticate, videosOverviewValidator } from '../../middlewares/index.js'
|
||||
import { TagModel } from '../../models/video/tag.js'
|
||||
|
@ -14,11 +14,7 @@ const overviewsRouter = express.Router()
|
|||
|
||||
overviewsRouter.use(apiRateLimiter)
|
||||
|
||||
overviewsRouter.get('/videos',
|
||||
videosOverviewValidator,
|
||||
optionalAuthenticate,
|
||||
asyncMiddleware(getVideosOverview)
|
||||
)
|
||||
overviewsRouter.get('/videos', videosOverviewValidator, optionalAuthenticate, asyncMiddleware(getVideosOverview))
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
|
@ -115,6 +111,8 @@ async function getVideos (
|
|||
const serverActor = await getServerActor()
|
||||
|
||||
const query = await Hooks.wrapObject({
|
||||
...buildNSFWFilters({ res }),
|
||||
|
||||
start: 0,
|
||||
count: 12,
|
||||
sort: '-createdAt',
|
||||
|
@ -122,7 +120,6 @@ async function getVideos (
|
|||
actorId: serverActor.id,
|
||||
orLocalVideos: true
|
||||
},
|
||||
nsfw: buildNSFWFilter(res),
|
||||
user: res.locals.oauth ? res.locals.oauth.token.User : undefined,
|
||||
countVideos: false,
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue