2019-07-18 07:28:37 -05:00
|
|
|
import { VideoModel } from '../models/video/video'
|
|
|
|
import { VideoCommentModel } from '../models/video/video-comment'
|
|
|
|
import { VideoCommentCreate } from '../../shared/models/videos/video-comment.model'
|
2020-05-14 04:10:26 -05:00
|
|
|
import { VideoCreate, VideoImportCreate } from '../../shared/models/videos'
|
2019-07-18 07:28:37 -05:00
|
|
|
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'
|
2020-05-14 04:10:26 -05:00
|
|
|
import { VideoFileModel } from '@server/models/video/video-file'
|
|
|
|
import { PathLike } from 'fs-extra'
|
|
|
|
import { MUser } from '@server/typings/models'
|
2019-07-18 07:28:37 -05:00
|
|
|
|
|
|
|
export type AcceptResult = {
|
|
|
|
accepted: boolean
|
|
|
|
errorMessage?: string
|
|
|
|
}
|
|
|
|
|
|
|
|
// Can be filtered by plugins
|
|
|
|
function isLocalVideoAccepted (object: {
|
2020-01-31 09:56:52 -06:00
|
|
|
videoBody: VideoCreate
|
|
|
|
videoFile: Express.Multer.File & { duration?: number }
|
2019-07-18 07:28:37 -05:00
|
|
|
user: UserModel
|
|
|
|
}): AcceptResult {
|
|
|
|
return { accepted: true }
|
|
|
|
}
|
|
|
|
|
|
|
|
function isLocalVideoThreadAccepted (_object: {
|
2020-01-31 09:56:52 -06:00
|
|
|
commentBody: VideoCommentCreate
|
|
|
|
video: VideoModel
|
2019-07-18 07:28:37 -05:00
|
|
|
user: UserModel
|
|
|
|
}): AcceptResult {
|
|
|
|
return { accepted: true }
|
|
|
|
}
|
|
|
|
|
|
|
|
function isLocalVideoCommentReplyAccepted (_object: {
|
2020-01-31 09:56:52 -06:00
|
|
|
commentBody: VideoCommentCreate
|
|
|
|
parentComment: VideoCommentModel
|
|
|
|
video: VideoModel
|
2019-07-18 07:28:37 -05:00
|
|
|
user: UserModel
|
|
|
|
}): AcceptResult {
|
|
|
|
return { accepted: true }
|
|
|
|
}
|
|
|
|
|
|
|
|
function isRemoteVideoAccepted (_object: {
|
2020-01-31 09:56:52 -06:00
|
|
|
activity: ActivityCreate
|
|
|
|
videoAP: VideoTorrentObject
|
2019-07-18 07:28:37 -05:00
|
|
|
byActor: ActorModel
|
|
|
|
}): AcceptResult {
|
|
|
|
return { accepted: true }
|
|
|
|
}
|
|
|
|
|
|
|
|
function isRemoteVideoCommentAccepted (_object: {
|
2020-01-31 09:56:52 -06:00
|
|
|
activity: ActivityCreate
|
|
|
|
commentAP: VideoCommentObject
|
2019-07-18 07:28:37 -05:00
|
|
|
byActor: ActorModel
|
|
|
|
}): AcceptResult {
|
|
|
|
return { accepted: true }
|
|
|
|
}
|
|
|
|
|
2020-05-14 04:10:26 -05:00
|
|
|
function isPreImportVideoAccepted (object: {
|
|
|
|
videoImportBody: VideoImportCreate
|
|
|
|
user: MUser
|
|
|
|
}): AcceptResult {
|
|
|
|
return { accepted: true }
|
|
|
|
}
|
|
|
|
|
|
|
|
function isPostImportVideoAccepted (object: {
|
|
|
|
videoFilePath: PathLike
|
|
|
|
videoFile: VideoFileModel
|
|
|
|
user: MUser
|
|
|
|
}): AcceptResult {
|
|
|
|
return { accepted: true }
|
|
|
|
}
|
|
|
|
|
2019-07-18 07:28:37 -05:00
|
|
|
export {
|
|
|
|
isLocalVideoAccepted,
|
|
|
|
isLocalVideoThreadAccepted,
|
|
|
|
isRemoteVideoAccepted,
|
|
|
|
isRemoteVideoCommentAccepted,
|
2020-05-14 04:10:26 -05:00
|
|
|
isLocalVideoCommentReplyAccepted,
|
|
|
|
isPreImportVideoAccepted,
|
|
|
|
isPostImportVideoAccepted
|
2019-07-18 07:28:37 -05:00
|
|
|
}
|