mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-06 03:50:26 +02:00
Add server plugin filter hooks for import with torrent and url (#2621)
* Add server plugin filter hooks for import with torrent and url * WIP: pre and post-import filter hooks * Rebased * Cleanup filters to accept imports Co-authored-by: Chocobozzz <me@florianbigard.com>
This commit is contained in:
parent
7405b6ba89
commit
2158ac9034
10 changed files with 261 additions and 43 deletions
|
@ -1,12 +1,15 @@
|
|||
import { VideoModel } from '../models/video/video'
|
||||
import { VideoCommentModel } from '../models/video/video-comment'
|
||||
import { VideoCommentCreate } from '../../shared/models/videos/video-comment.model'
|
||||
import { VideoCreate } from '../../shared/models/videos'
|
||||
import { VideoCreate, VideoImportCreate } from '../../shared/models/videos'
|
||||
import { UserModel } from '../models/account/user'
|
||||
import { VideoTorrentObject } from '../../shared/models/activitypub/objects'
|
||||
import { ActivityCreate } from '../../shared/models/activitypub'
|
||||
import { ActorModel } from '../models/activitypub/actor'
|
||||
import { VideoCommentObject } from '../../shared/models/activitypub/objects/video-comment-object'
|
||||
import { VideoFileModel } from '@server/models/video/video-file'
|
||||
import { PathLike } from 'fs-extra'
|
||||
import { MUser } from '@server/typings/models'
|
||||
|
||||
export type AcceptResult = {
|
||||
accepted: boolean
|
||||
|
@ -55,10 +58,27 @@ function isRemoteVideoCommentAccepted (_object: {
|
|||
return { accepted: true }
|
||||
}
|
||||
|
||||
function isPreImportVideoAccepted (object: {
|
||||
videoImportBody: VideoImportCreate
|
||||
user: MUser
|
||||
}): AcceptResult {
|
||||
return { accepted: true }
|
||||
}
|
||||
|
||||
function isPostImportVideoAccepted (object: {
|
||||
videoFilePath: PathLike
|
||||
videoFile: VideoFileModel
|
||||
user: MUser
|
||||
}): AcceptResult {
|
||||
return { accepted: true }
|
||||
}
|
||||
|
||||
export {
|
||||
isLocalVideoAccepted,
|
||||
isLocalVideoThreadAccepted,
|
||||
isRemoteVideoAccepted,
|
||||
isRemoteVideoCommentAccepted,
|
||||
isLocalVideoCommentReplyAccepted
|
||||
isLocalVideoCommentReplyAccepted,
|
||||
isPreImportVideoAccepted,
|
||||
isPostImportVideoAccepted
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue