mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 19:42:24 +02:00
add quarantine videos feature (#1637)
* add quarantine videos feature * increase Notification settings test timeout to 20000ms. was completing 7000 locally but timing out after 10000 on travis * fix quarantine video test issues -propagate misspelling -remove skip from server/tests/client.ts * WIP use blacklist for moderator video approval instead of video.quarantine boolean * finish auto-blacklist feature
This commit is contained in:
parent
12fed49eba
commit
7ccddd7b52
58 changed files with 1047 additions and 99 deletions
|
@ -18,10 +18,12 @@ import { join } from 'path'
|
|||
import { isArray } from '../../../helpers/custom-validators/misc'
|
||||
import { FilteredModelAttributes } from 'sequelize-typescript/lib/models/Model'
|
||||
import { VideoChannelModel } from '../../../models/video/video-channel'
|
||||
import { UserModel } from '../../../models/account/user'
|
||||
import * as Bluebird from 'bluebird'
|
||||
import * as parseTorrent from 'parse-torrent'
|
||||
import { getSecureTorrentName } from '../../../helpers/utils'
|
||||
import { readFile, move } from 'fs-extra'
|
||||
import { autoBlacklistVideoIfNeeded } from '../../../lib/video-blacklist'
|
||||
|
||||
const auditLogger = auditLoggerFactory('video-imports')
|
||||
const videoImportsRouter = express.Router()
|
||||
|
@ -85,7 +87,7 @@ async function addTorrentImport (req: express.Request, res: express.Response, to
|
|||
videoName = isArray(parsed.name) ? parsed.name[ 0 ] : parsed.name as string
|
||||
}
|
||||
|
||||
const video = buildVideo(res.locals.videoChannel.id, body, { name: videoName })
|
||||
const video = buildVideo(res.locals.videoChannel.id, body, { name: videoName }, user)
|
||||
|
||||
await processThumbnail(req, video)
|
||||
await processPreview(req, video)
|
||||
|
@ -128,7 +130,7 @@ async function addYoutubeDLImport (req: express.Request, res: express.Response)
|
|||
}).end()
|
||||
}
|
||||
|
||||
const video = buildVideo(res.locals.videoChannel.id, body, youtubeDLInfo)
|
||||
const video = buildVideo(res.locals.videoChannel.id, body, youtubeDLInfo, user)
|
||||
|
||||
const downloadThumbnail = !await processThumbnail(req, video)
|
||||
const downloadPreview = !await processPreview(req, video)
|
||||
|
@ -156,7 +158,7 @@ async function addYoutubeDLImport (req: express.Request, res: express.Response)
|
|||
return res.json(videoImport.toFormattedJSON()).end()
|
||||
}
|
||||
|
||||
function buildVideo (channelId: number, body: VideoImportCreate, importData: YoutubeDLInfo) {
|
||||
function buildVideo (channelId: number, body: VideoImportCreate, importData: YoutubeDLInfo, user: UserModel) {
|
||||
const videoData = {
|
||||
name: body.name || importData.name || 'Unknown name',
|
||||
remote: false,
|
||||
|
@ -218,6 +220,8 @@ function insertIntoDB (
|
|||
const videoCreated = await video.save(sequelizeOptions)
|
||||
videoCreated.VideoChannel = videoChannel
|
||||
|
||||
await autoBlacklistVideoIfNeeded(video, videoChannel.Account.User, t)
|
||||
|
||||
// Set tags to the video
|
||||
if (tags) {
|
||||
const tagInstances = await TagModel.findOrCreateTags(tags, t)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue