]>
Commit | Line | Data |
---|---|---|
b4055e1c C |
1 | import { VideoModel } from '../models/video/video' |
2 | import { VideoCommentModel } from '../models/video/video-comment' | |
3 | import { VideoCommentCreate } from '../../shared/models/videos/video-comment.model' | |
2158ac90 | 4 | import { VideoCreate, VideoImportCreate } from '../../shared/models/videos' |
b4055e1c C |
5 | import { UserModel } from '../models/account/user' |
6 | import { VideoTorrentObject } from '../../shared/models/activitypub/objects' | |
7 | import { ActivityCreate } from '../../shared/models/activitypub' | |
8 | import { ActorModel } from '../models/activitypub/actor' | |
9 | import { VideoCommentObject } from '../../shared/models/activitypub/objects/video-comment-object' | |
2158ac90 RK |
10 | import { VideoFileModel } from '@server/models/video/video-file' |
11 | import { PathLike } from 'fs-extra' | |
26d6bf65 | 12 | import { MUser } from '@server/types/models' |
b4055e1c C |
13 | |
14 | export type AcceptResult = { | |
15 | accepted: boolean | |
16 | errorMessage?: string | |
17 | } | |
18 | ||
19 | // Can be filtered by plugins | |
20 | function isLocalVideoAccepted (object: { | |
a1587156 C |
21 | videoBody: VideoCreate |
22 | videoFile: Express.Multer.File & { duration?: number } | |
b4055e1c C |
23 | user: UserModel |
24 | }): AcceptResult { | |
25 | return { accepted: true } | |
26 | } | |
27 | ||
28 | function isLocalVideoThreadAccepted (_object: { | |
a1587156 C |
29 | commentBody: VideoCommentCreate |
30 | video: VideoModel | |
b4055e1c C |
31 | user: UserModel |
32 | }): AcceptResult { | |
33 | return { accepted: true } | |
34 | } | |
35 | ||
36 | function isLocalVideoCommentReplyAccepted (_object: { | |
a1587156 C |
37 | commentBody: VideoCommentCreate |
38 | parentComment: VideoCommentModel | |
39 | video: VideoModel | |
b4055e1c C |
40 | user: UserModel |
41 | }): AcceptResult { | |
42 | return { accepted: true } | |
43 | } | |
44 | ||
45 | function isRemoteVideoAccepted (_object: { | |
a1587156 C |
46 | activity: ActivityCreate |
47 | videoAP: VideoTorrentObject | |
b4055e1c C |
48 | byActor: ActorModel |
49 | }): AcceptResult { | |
50 | return { accepted: true } | |
51 | } | |
52 | ||
53 | function isRemoteVideoCommentAccepted (_object: { | |
a1587156 C |
54 | activity: ActivityCreate |
55 | commentAP: VideoCommentObject | |
b4055e1c C |
56 | byActor: ActorModel |
57 | }): AcceptResult { | |
58 | return { accepted: true } | |
59 | } | |
60 | ||
2158ac90 RK |
61 | function isPreImportVideoAccepted (object: { |
62 | videoImportBody: VideoImportCreate | |
63 | user: MUser | |
64 | }): AcceptResult { | |
65 | return { accepted: true } | |
66 | } | |
67 | ||
68 | function isPostImportVideoAccepted (object: { | |
69 | videoFilePath: PathLike | |
70 | videoFile: VideoFileModel | |
71 | user: MUser | |
72 | }): AcceptResult { | |
73 | return { accepted: true } | |
74 | } | |
75 | ||
b4055e1c C |
76 | export { |
77 | isLocalVideoAccepted, | |
78 | isLocalVideoThreadAccepted, | |
79 | isRemoteVideoAccepted, | |
80 | isRemoteVideoCommentAccepted, | |
2158ac90 RK |
81 | isLocalVideoCommentReplyAccepted, |
82 | isPreImportVideoAccepted, | |
83 | isPostImportVideoAccepted | |
b4055e1c | 84 | } |