]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - shared/models/server/job.model.ts
Add ability for auth plugins to hook tokens validity
[github/Chocobozzz/PeerTube.git] / shared / models / server / job.model.ts
CommitLineData
8dc8a34e
C
1import { SendEmailOptions } from './emailer.model'
2import { VideoResolution } from '@shared/models'
e307e4fc 3import { ContextType } from '../activitypub/context'
8dc8a34e 4
94831479 5export type JobState = 'active' | 'completed' | 'failed' | 'waiting' | 'delayed'
94a5ff8a 6
a1587156
C
7export type JobType =
8 | 'activitypub-http-unicast'
9 | 'activitypub-http-broadcast'
10 | 'activitypub-http-fetcher'
11 | 'activitypub-follow'
12 | 'video-file-import'
13 | 'video-transcoding'
14 | 'email'
15 | 'video-import'
16 | 'videos-views'
17 | 'activitypub-refresher'
18 | 'video-redundancy'
5cd80545
C
19
20export interface Job {
21 id: number
22 state: JobState
94a5ff8a 23 type: JobType
a1587156
C
24 data: any
25 error: any
1061c73f
C
26 createdAt: Date | string
27 finishedOn: Date | string
28 processedOn: Date | string
5cd80545 29}
8dc8a34e
C
30
31export type ActivitypubHttpBroadcastPayload = {
32 uris: string[]
33 signatureActorId?: number
34 body: any
35 contextType?: ContextType
36}
37
38export type ActivitypubFollowPayload = {
39 followerActorId: number
40 name: string
41 host: string
42 isAutoFollow?: boolean
43 assertIsChannel?: boolean
44}
45
46export type FetchType = 'activity' | 'video-likes' | 'video-dislikes' | 'video-shares' | 'video-comments' | 'account-playlists'
47export type ActivitypubHttpFetcherPayload = {
48 uri: string
49 type: FetchType
50 videoId?: number
51 accountId?: number
52}
53
54export type ActivitypubHttpUnicastPayload = {
55 uri: string
56 signatureActorId?: number
57 body: any
58 contextType?: ContextType
59}
60
61export type RefreshPayload = {
62 type: 'video' | 'video-playlist' | 'actor'
63 url: string
64}
65
66export type EmailPayload = SendEmailOptions
67
68export type VideoFileImportPayload = {
69 videoUUID: string
70 filePath: string
71}
72
73export type VideoImportYoutubeDLPayload = {
74 type: 'youtube-dl'
75 videoImportId: number
76
77 generateThumbnail: boolean
78 generatePreview: boolean
79
80 fileExt?: string
81}
82export type VideoImportTorrentPayload = {
83 type: 'magnet-uri' | 'torrent-file'
84 videoImportId: number
85}
86export type VideoImportPayload = VideoImportYoutubeDLPayload | VideoImportTorrentPayload
87
88export type VideoRedundancyPayload = {
89 videoId: number
90}
91
92// Video transcoding payloads
93
94interface BaseTranscodingPayload {
95 videoUUID: string
96 isNewVideo?: boolean
97}
98
99interface HLSTranscodingPayload extends BaseTranscodingPayload {
100 type: 'hls'
101 isPortraitMode?: boolean
102 resolution: VideoResolution
103 copyCodecs: boolean
104}
105
106export interface NewResolutionTranscodingPayload extends BaseTranscodingPayload {
107 type: 'new-resolution'
108 isPortraitMode?: boolean
109 resolution: VideoResolution
110}
111
112export interface MergeAudioTranscodingPayload extends BaseTranscodingPayload {
113 type: 'merge-audio'
114 resolution: VideoResolution
115}
116
117export interface OptimizeTranscodingPayload extends BaseTranscodingPayload {
118 type: 'optimize'
119}
120
121export type VideoTranscodingPayload =
122 HLSTranscodingPayload
123 | NewResolutionTranscodingPayload
124 | OptimizeTranscodingPayload
125 | MergeAudioTranscodingPayload