diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2020-05-14 11:10:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-14 11:10:26 +0200 |
commit | 2158ac90341dc3fcae958540de65032da25c8d6e (patch) | |
tree | a780923d701f3daa130996768e38c1e1b6a0646c /server/lib/moderation.ts | |
parent | 7405b6ba897dbce1b4fd50c92174f1df5ac15adc (diff) | |
download | PeerTube-2158ac90341dc3fcae958540de65032da25c8d6e.tar.gz PeerTube-2158ac90341dc3fcae958540de65032da25c8d6e.tar.zst PeerTube-2158ac90341dc3fcae958540de65032da25c8d6e.zip |
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>
Diffstat (limited to 'server/lib/moderation.ts')
-rw-r--r-- | server/lib/moderation.ts | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/server/lib/moderation.ts b/server/lib/moderation.ts index 55f7a985d..4afebb32a 100644 --- a/server/lib/moderation.ts +++ b/server/lib/moderation.ts | |||
@@ -1,12 +1,15 @@ | |||
1 | import { VideoModel } from '../models/video/video' | 1 | import { VideoModel } from '../models/video/video' |
2 | import { VideoCommentModel } from '../models/video/video-comment' | 2 | import { VideoCommentModel } from '../models/video/video-comment' |
3 | import { VideoCommentCreate } from '../../shared/models/videos/video-comment.model' | 3 | import { VideoCommentCreate } from '../../shared/models/videos/video-comment.model' |
4 | import { VideoCreate } from '../../shared/models/videos' | 4 | import { VideoCreate, VideoImportCreate } from '../../shared/models/videos' |
5 | import { UserModel } from '../models/account/user' | 5 | import { UserModel } from '../models/account/user' |
6 | import { VideoTorrentObject } from '../../shared/models/activitypub/objects' | 6 | import { VideoTorrentObject } from '../../shared/models/activitypub/objects' |
7 | import { ActivityCreate } from '../../shared/models/activitypub' | 7 | import { ActivityCreate } from '../../shared/models/activitypub' |
8 | import { ActorModel } from '../models/activitypub/actor' | 8 | import { ActorModel } from '../models/activitypub/actor' |
9 | import { VideoCommentObject } from '../../shared/models/activitypub/objects/video-comment-object' | 9 | import { VideoCommentObject } from '../../shared/models/activitypub/objects/video-comment-object' |
10 | import { VideoFileModel } from '@server/models/video/video-file' | ||
11 | import { PathLike } from 'fs-extra' | ||
12 | import { MUser } from '@server/typings/models' | ||
10 | 13 | ||
11 | export type AcceptResult = { | 14 | export type AcceptResult = { |
12 | accepted: boolean | 15 | accepted: boolean |
@@ -55,10 +58,27 @@ function isRemoteVideoCommentAccepted (_object: { | |||
55 | return { accepted: true } | 58 | return { accepted: true } |
56 | } | 59 | } |
57 | 60 | ||
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 | |||
58 | export { | 76 | export { |
59 | isLocalVideoAccepted, | 77 | isLocalVideoAccepted, |
60 | isLocalVideoThreadAccepted, | 78 | isLocalVideoThreadAccepted, |
61 | isRemoteVideoAccepted, | 79 | isRemoteVideoAccepted, |
62 | isRemoteVideoCommentAccepted, | 80 | isRemoteVideoCommentAccepted, |
63 | isLocalVideoCommentReplyAccepted | 81 | isLocalVideoCommentReplyAccepted, |
82 | isPreImportVideoAccepted, | ||
83 | isPostImportVideoAccepted | ||
64 | } | 84 | } |