diff options
author | Chocobozzz <me@florianbigard.com> | 2019-02-11 14:09:23 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-02-11 14:09:23 +0100 |
commit | b718fd22374d64534bcfe69932cf562894abed6a (patch) | |
tree | 311d3c67e2a4d1f33ebdd1dc163527de9d33d0f7 /shared/models | |
parent | adb115f5522bea4d52456a9fc5eb4140bb064476 (diff) | |
parent | 501e961199578129629cf0567033d13efced9904 (diff) | |
download | PeerTube-b718fd22374d64534bcfe69932cf562894abed6a.tar.gz PeerTube-b718fd22374d64534bcfe69932cf562894abed6a.tar.zst PeerTube-b718fd22374d64534bcfe69932cf562894abed6a.zip |
Merge branch 'develop' into pr/1285
Diffstat (limited to 'shared/models')
19 files changed, 135 insertions, 50 deletions
diff --git a/shared/models/activitypub/activity.ts b/shared/models/activitypub/activity.ts index 44cb99efb..89994f665 100644 --- a/shared/models/activitypub/activity.ts +++ b/shared/models/activitypub/activity.ts | |||
@@ -5,12 +5,14 @@ import { DislikeObject } from './objects/dislike-object' | |||
5 | import { VideoAbuseObject } from './objects/video-abuse-object' | 5 | import { VideoAbuseObject } from './objects/video-abuse-object' |
6 | import { VideoCommentObject } from './objects/video-comment-object' | 6 | import { VideoCommentObject } from './objects/video-comment-object' |
7 | import { ViewObject } from './objects/view-object' | 7 | import { ViewObject } from './objects/view-object' |
8 | import { APObject } from './objects/object.model' | ||
8 | 9 | ||
9 | export type Activity = ActivityCreate | ActivityUpdate | | 10 | export type Activity = ActivityCreate | ActivityUpdate | |
10 | ActivityDelete | ActivityFollow | ActivityAccept | ActivityAnnounce | | 11 | ActivityDelete | ActivityFollow | ActivityAccept | ActivityAnnounce | |
11 | ActivityUndo | ActivityLike | ActivityReject | 12 | ActivityUndo | ActivityLike | ActivityReject | ActivityView | ActivityDislike | ActivityFlag |
12 | 13 | ||
13 | export type ActivityType = 'Create' | 'Update' | 'Delete' | 'Follow' | 'Accept' | 'Announce' | 'Undo' | 'Like' | 'Reject' | 14 | export type ActivityType = 'Create' | 'Update' | 'Delete' | 'Follow' | 'Accept' | 'Announce' | 'Undo' | 'Like' | 'Reject' | |
15 | 'View' | 'Dislike' | 'Flag' | ||
14 | 16 | ||
15 | export interface ActivityAudience { | 17 | export interface ActivityAudience { |
16 | to: string[] | 18 | to: string[] |
@@ -59,15 +61,34 @@ export interface ActivityReject extends BaseActivity { | |||
59 | 61 | ||
60 | export interface ActivityAnnounce extends BaseActivity { | 62 | export interface ActivityAnnounce extends BaseActivity { |
61 | type: 'Announce' | 63 | type: 'Announce' |
62 | object: string | { id: string } | 64 | object: APObject |
63 | } | 65 | } |
64 | 66 | ||
65 | export interface ActivityUndo extends BaseActivity { | 67 | export interface ActivityUndo extends BaseActivity { |
66 | type: 'Undo', | 68 | type: 'Undo', |
67 | object: ActivityFollow | ActivityLike | ActivityCreate | ActivityAnnounce | 69 | object: ActivityFollow | ActivityLike | ActivityDislike | ActivityCreate | ActivityAnnounce |
68 | } | 70 | } |
69 | 71 | ||
70 | export interface ActivityLike extends BaseActivity { | 72 | export interface ActivityLike extends BaseActivity { |
71 | type: 'Like', | 73 | type: 'Like', |
72 | object: string | 74 | object: APObject |
75 | } | ||
76 | |||
77 | export interface ActivityView extends BaseActivity { | ||
78 | type: 'View', | ||
79 | actor: string | ||
80 | object: APObject | ||
81 | } | ||
82 | |||
83 | export interface ActivityDislike extends BaseActivity { | ||
84 | id: string | ||
85 | type: 'Dislike' | ||
86 | actor: string | ||
87 | object: APObject | ||
88 | } | ||
89 | |||
90 | export interface ActivityFlag extends BaseActivity { | ||
91 | type: 'Flag', | ||
92 | content: string, | ||
93 | object: APObject | ||
73 | } | 94 | } |
diff --git a/shared/models/activitypub/activitypub-ordered-collection.ts b/shared/models/activitypub/activitypub-ordered-collection.ts index dfec0bb76..3de0890bb 100644 --- a/shared/models/activitypub/activitypub-ordered-collection.ts +++ b/shared/models/activitypub/activitypub-ordered-collection.ts | |||
@@ -2,6 +2,9 @@ export interface ActivityPubOrderedCollection<T> { | |||
2 | '@context': string[] | 2 | '@context': string[] |
3 | type: 'OrderedCollection' | 'OrderedCollectionPage' | 3 | type: 'OrderedCollection' | 'OrderedCollectionPage' |
4 | totalItems: number | 4 | totalItems: number |
5 | partOf?: string | ||
6 | orderedItems: T[] | 5 | orderedItems: T[] |
6 | |||
7 | partOf?: string | ||
8 | next?: string | ||
9 | first?: string | ||
7 | } | 10 | } |
diff --git a/shared/models/activitypub/objects/cache-file-object.ts b/shared/models/activitypub/objects/cache-file-object.ts index 0a5125f5b..4b0a3a724 100644 --- a/shared/models/activitypub/objects/cache-file-object.ts +++ b/shared/models/activitypub/objects/cache-file-object.ts | |||
@@ -1,9 +1,9 @@ | |||
1 | import { ActivityVideoUrlObject } from './common-objects' | 1 | import { ActivityVideoUrlObject, ActivityPlaylistUrlObject } from './common-objects' |
2 | 2 | ||
3 | export interface CacheFileObject { | 3 | export interface CacheFileObject { |
4 | id: string | 4 | id: string |
5 | type: 'CacheFile', | 5 | type: 'CacheFile', |
6 | object: string | 6 | object: string |
7 | expires: string | 7 | expires: string |
8 | url: ActivityVideoUrlObject | 8 | url: ActivityVideoUrlObject | ActivityPlaylistUrlObject |
9 | } | 9 | } |
diff --git a/shared/models/activitypub/objects/common-objects.ts b/shared/models/activitypub/objects/common-objects.ts index 118a4f43d..8c89810d6 100644 --- a/shared/models/activitypub/objects/common-objects.ts +++ b/shared/models/activitypub/objects/common-objects.ts | |||
@@ -28,25 +28,47 @@ export type ActivityVideoUrlObject = { | |||
28 | fps: number | 28 | fps: number |
29 | } | 29 | } |
30 | 30 | ||
31 | export type ActivityUrlObject = | 31 | export type ActivityPlaylistSegmentHashesObject = { |
32 | ActivityVideoUrlObject | 32 | type: 'Link' |
33 | | | 33 | name: 'sha256' |
34 | { | 34 | // TODO: remove mimeType (backward compatibility, introduced in v1.1.0) |
35 | type: 'Link' | 35 | mimeType?: 'application/json' |
36 | // TODO: remove mimeType (backward compatibility, introduced in v1.1.0) | 36 | mediaType: 'application/json' |
37 | mimeType?: 'application/x-bittorrent' | 'application/x-bittorrent;x-scheme-handler/magnet' | 37 | href: string |
38 | mediaType: 'application/x-bittorrent' | 'application/x-bittorrent;x-scheme-handler/magnet' | 38 | } |
39 | href: string | 39 | |
40 | height: number | 40 | export type ActivityPlaylistInfohashesObject = { |
41 | } | 41 | type: 'Infohash' |
42 | | | 42 | name: string |
43 | { | 43 | } |
44 | type: 'Link' | 44 | |
45 | // TODO: remove mimeType (backward compatibility, introduced in v1.1.0) | 45 | export type ActivityPlaylistUrlObject = { |
46 | mimeType?: 'text/html' | 46 | type: 'Link' |
47 | mediaType: 'text/html' | 47 | // TODO: remove mimeType (backward compatibility, introduced in v1.1.0) |
48 | href: string | 48 | mimeType?: 'application/x-mpegURL' |
49 | } | 49 | mediaType: 'application/x-mpegURL' |
50 | href: string | ||
51 | tag?: (ActivityPlaylistSegmentHashesObject | ActivityPlaylistInfohashesObject)[] | ||
52 | } | ||
53 | |||
54 | export type ActivityBitTorrentUrlObject = { | ||
55 | type: 'Link' | ||
56 | // TODO: remove mimeType (backward compatibility, introduced in v1.1.0) | ||
57 | mimeType?: 'application/x-bittorrent' | 'application/x-bittorrent;x-scheme-handler/magnet' | ||
58 | mediaType: 'application/x-bittorrent' | 'application/x-bittorrent;x-scheme-handler/magnet' | ||
59 | href: string | ||
60 | height: number | ||
61 | } | ||
62 | |||
63 | export type ActivityHtmlUrlObject = { | ||
64 | type: 'Link' | ||
65 | // TODO: remove mimeType (backward compatibility, introduced in v1.1.0) | ||
66 | mimeType?: 'text/html' | ||
67 | mediaType: 'text/html' | ||
68 | href: string | ||
69 | } | ||
70 | |||
71 | export type ActivityUrlObject = ActivityVideoUrlObject | ActivityPlaylistUrlObject | ActivityBitTorrentUrlObject | ActivityHtmlUrlObject | ||
50 | 72 | ||
51 | export interface ActivityPubAttributedTo { | 73 | export interface ActivityPubAttributedTo { |
52 | type: 'Group' | 'Person' | 74 | type: 'Group' | 'Person' |
diff --git a/shared/models/activitypub/objects/object.model.ts b/shared/models/activitypub/objects/object.model.ts new file mode 100644 index 000000000..3fd33800a --- /dev/null +++ b/shared/models/activitypub/objects/object.model.ts | |||
@@ -0,0 +1 @@ | |||
export type APObject = string | { id: string } | |||
diff --git a/shared/models/activitypub/objects/video-torrent-object.ts b/shared/models/activitypub/objects/video-torrent-object.ts index df07507b4..239822bc4 100644 --- a/shared/models/activitypub/objects/video-torrent-object.ts +++ b/shared/models/activitypub/objects/video-torrent-object.ts | |||
@@ -20,7 +20,8 @@ export interface VideoTorrentObject { | |||
20 | subtitleLanguage: ActivityIdentifierObject[] | 20 | subtitleLanguage: ActivityIdentifierObject[] |
21 | views: number | 21 | views: number |
22 | sensitive: boolean | 22 | sensitive: boolean |
23 | commentsEnabled: boolean | 23 | commentsEnabled: boolean, |
24 | downloadEnabled: boolean, | ||
24 | waitTranscoding: boolean | 25 | waitTranscoding: boolean |
25 | state: VideoState | 26 | state: VideoState |
26 | published: string | 27 | published: string |
diff --git a/shared/models/actors/actor.model.ts b/shared/models/actors/actor.model.ts index 6b3b1b47c..a3953874d 100644 --- a/shared/models/actors/actor.model.ts +++ b/shared/models/actors/actor.model.ts | |||
@@ -10,5 +10,5 @@ export interface Actor { | |||
10 | followersCount: number | 10 | followersCount: number |
11 | createdAt: Date | string | 11 | createdAt: Date | string |
12 | updatedAt: Date | string | 12 | updatedAt: Date | string |
13 | avatar: Avatar | 13 | avatar?: Avatar |
14 | } | 14 | } |
diff --git a/shared/models/server/custom-config.model.ts b/shared/models/server/custom-config.model.ts index 7a3eaa33f..b42ff90c6 100644 --- a/shared/models/server/custom-config.model.ts +++ b/shared/models/server/custom-config.model.ts | |||
@@ -61,6 +61,9 @@ export interface CustomConfig { | |||
61 | '720p': boolean | 61 | '720p': boolean |
62 | '1080p': boolean | 62 | '1080p': boolean |
63 | } | 63 | } |
64 | hls: { | ||
65 | enabled: boolean | ||
66 | } | ||
64 | } | 67 | } |
65 | 68 | ||
66 | import: { | 69 | import: { |
diff --git a/shared/models/server/server-config.model.ts b/shared/models/server/server-config.model.ts index 7031009d9..baafed31f 100644 --- a/shared/models/server/server-config.model.ts +++ b/shared/models/server/server-config.model.ts | |||
@@ -25,11 +25,15 @@ export interface ServerConfig { | |||
25 | 25 | ||
26 | signup: { | 26 | signup: { |
27 | allowed: boolean, | 27 | allowed: boolean, |
28 | allowedForCurrentIP: boolean, | 28 | allowedForCurrentIP: boolean |
29 | requiresEmailVerification: boolean | 29 | requiresEmailVerification: boolean |
30 | } | 30 | } |
31 | 31 | ||
32 | transcoding: { | 32 | transcoding: { |
33 | hls: { | ||
34 | enabled: boolean | ||
35 | } | ||
36 | |||
33 | enabledResolutions: number[] | 37 | enabledResolutions: number[] |
34 | } | 38 | } |
35 | 39 | ||
@@ -48,7 +52,7 @@ export interface ServerConfig { | |||
48 | file: { | 52 | file: { |
49 | size: { | 53 | size: { |
50 | max: number | 54 | max: number |
51 | }, | 55 | } |
52 | extensions: string[] | 56 | extensions: string[] |
53 | } | 57 | } |
54 | } | 58 | } |
@@ -78,4 +82,10 @@ export interface ServerConfig { | |||
78 | videoQuota: number | 82 | videoQuota: number |
79 | videoQuotaDaily: number | 83 | videoQuotaDaily: number |
80 | } | 84 | } |
85 | |||
86 | trending: { | ||
87 | videos: { | ||
88 | intervalDays: number | ||
89 | } | ||
90 | } | ||
81 | } | 91 | } |
diff --git a/shared/models/server/server-stats.model.ts b/shared/models/server/server-stats.model.ts index a6bd2d4d3..74f3de5d3 100644 --- a/shared/models/server/server-stats.model.ts +++ b/shared/models/server/server-stats.model.ts | |||
@@ -5,6 +5,7 @@ export interface ServerStats { | |||
5 | totalLocalVideos: number | 5 | totalLocalVideos: number |
6 | totalLocalVideoViews: number | 6 | totalLocalVideoViews: number |
7 | totalLocalVideoComments: number | 7 | totalLocalVideoComments: number |
8 | totalLocalVideoFilesSize: number | ||
8 | 9 | ||
9 | totalVideos: number | 10 | totalVideos: number |
10 | totalVideoComments: number | 11 | totalVideoComments: number |
diff --git a/shared/models/users/user-notification.model.ts b/shared/models/users/user-notification.model.ts index f41b6f534..186b62612 100644 --- a/shared/models/users/user-notification.model.ts +++ b/shared/models/users/user-notification.model.ts | |||
@@ -22,16 +22,23 @@ export interface VideoInfo { | |||
22 | name: string | 22 | name: string |
23 | } | 23 | } |
24 | 24 | ||
25 | export interface ActorInfo { | ||
26 | id: number | ||
27 | displayName: string | ||
28 | name: string | ||
29 | host: string | ||
30 | avatar?: { | ||
31 | path: string | ||
32 | } | ||
33 | } | ||
34 | |||
25 | export interface UserNotification { | 35 | export interface UserNotification { |
26 | id: number | 36 | id: number |
27 | type: UserNotificationType | 37 | type: UserNotificationType |
28 | read: boolean | 38 | read: boolean |
29 | 39 | ||
30 | video?: VideoInfo & { | 40 | video?: VideoInfo & { |
31 | channel: { | 41 | channel: ActorInfo |
32 | id: number | ||
33 | displayName: string | ||
34 | } | ||
35 | } | 42 | } |
36 | 43 | ||
37 | videoImport?: { | 44 | videoImport?: { |
@@ -45,10 +52,7 @@ export interface UserNotification { | |||
45 | comment?: { | 52 | comment?: { |
46 | id: number | 53 | id: number |
47 | threadId: number | 54 | threadId: number |
48 | account: { | 55 | account: ActorInfo |
49 | id: number | ||
50 | displayName: string | ||
51 | } | ||
52 | video: VideoInfo | 56 | video: VideoInfo |
53 | } | 57 | } |
54 | 58 | ||
@@ -62,18 +66,11 @@ export interface UserNotification { | |||
62 | video: VideoInfo | 66 | video: VideoInfo |
63 | } | 67 | } |
64 | 68 | ||
65 | account?: { | 69 | account?: ActorInfo |
66 | id: number | ||
67 | displayName: string | ||
68 | name: string | ||
69 | } | ||
70 | 70 | ||
71 | actorFollow?: { | 71 | actorFollow?: { |
72 | id: number | 72 | id: number |
73 | follower: { | 73 | follower: ActorInfo |
74 | name: string | ||
75 | displayName: string | ||
76 | } | ||
77 | following: { | 74 | following: { |
78 | type: 'account' | 'channel' | 75 | type: 'account' | 'channel' |
79 | name: string | 76 | name: string |
diff --git a/shared/models/users/user-update.model.ts b/shared/models/users/user-update.model.ts index abde51321..cd215bab3 100644 --- a/shared/models/users/user-update.model.ts +++ b/shared/models/users/user-update.model.ts | |||
@@ -1,6 +1,7 @@ | |||
1 | import { UserRole } from './user-role' | 1 | import { UserRole } from './user-role' |
2 | 2 | ||
3 | export interface UserUpdate { | 3 | export interface UserUpdate { |
4 | password?: string | ||
4 | email?: string | 5 | email?: string |
5 | emailVerified?: boolean | 6 | emailVerified?: boolean |
6 | videoQuota?: number | 7 | videoQuota?: number |
diff --git a/shared/models/videos/blacklist/video-blacklist-create.model.ts b/shared/models/videos/blacklist/video-blacklist-create.model.ts index 89c69cb56..6e7d36421 100644 --- a/shared/models/videos/blacklist/video-blacklist-create.model.ts +++ b/shared/models/videos/blacklist/video-blacklist-create.model.ts | |||
@@ -1,3 +1,4 @@ | |||
1 | export interface VideoBlacklistCreate { | 1 | export interface VideoBlacklistCreate { |
2 | reason?: string | 2 | reason?: string |
3 | unfederate?: boolean | ||
3 | } | 4 | } |
diff --git a/shared/models/videos/blacklist/video-blacklist.model.ts b/shared/models/videos/blacklist/video-blacklist.model.ts index ef4e5e3a2..4bd976190 100644 --- a/shared/models/videos/blacklist/video-blacklist.model.ts +++ b/shared/models/videos/blacklist/video-blacklist.model.ts | |||
@@ -2,6 +2,7 @@ export interface VideoBlacklist { | |||
2 | id: number | 2 | id: number |
3 | createdAt: Date | 3 | createdAt: Date |
4 | updatedAt: Date | 4 | updatedAt: Date |
5 | unfederated: boolean | ||
5 | reason?: string | 6 | reason?: string |
6 | 7 | ||
7 | video: { | 8 | video: { |
diff --git a/shared/models/videos/video-create.model.ts b/shared/models/videos/video-create.model.ts index 392bd1025..53631bf79 100644 --- a/shared/models/videos/video-create.model.ts +++ b/shared/models/videos/video-create.model.ts | |||
@@ -13,6 +13,7 @@ export interface VideoCreate { | |||
13 | name: string | 13 | name: string |
14 | tags?: string[] | 14 | tags?: string[] |
15 | commentsEnabled?: boolean | 15 | commentsEnabled?: boolean |
16 | downloadEnabled?: boolean | ||
16 | privacy: VideoPrivacy | 17 | privacy: VideoPrivacy |
17 | scheduleUpdate?: VideoScheduleUpdate | 18 | scheduleUpdate?: VideoScheduleUpdate |
18 | originallyPublishedAt: Date | string | 19 | originallyPublishedAt: Date | string |
diff --git a/shared/models/videos/video-streaming-playlist.model.ts b/shared/models/videos/video-streaming-playlist.model.ts new file mode 100644 index 000000000..17f8fe865 --- /dev/null +++ b/shared/models/videos/video-streaming-playlist.model.ts | |||
@@ -0,0 +1,12 @@ | |||
1 | import { VideoStreamingPlaylistType } from './video-streaming-playlist.type' | ||
2 | |||
3 | export class VideoStreamingPlaylist { | ||
4 | id: number | ||
5 | type: VideoStreamingPlaylistType | ||
6 | playlistUrl: string | ||
7 | segmentsSha256Url: string | ||
8 | |||
9 | redundancies: { | ||
10 | baseUrl: string | ||
11 | }[] | ||
12 | } | ||
diff --git a/shared/models/videos/video-streaming-playlist.type.ts b/shared/models/videos/video-streaming-playlist.type.ts new file mode 100644 index 000000000..3b403f295 --- /dev/null +++ b/shared/models/videos/video-streaming-playlist.type.ts | |||
@@ -0,0 +1,3 @@ | |||
1 | export enum VideoStreamingPlaylistType { | ||
2 | HLS = 1 | ||
3 | } | ||
diff --git a/shared/models/videos/video-update.model.ts b/shared/models/videos/video-update.model.ts index 62e02e079..4ef904156 100644 --- a/shared/models/videos/video-update.model.ts +++ b/shared/models/videos/video-update.model.ts | |||
@@ -11,6 +11,7 @@ export interface VideoUpdate { | |||
11 | privacy?: VideoPrivacy | 11 | privacy?: VideoPrivacy |
12 | tags?: string[] | 12 | tags?: string[] |
13 | commentsEnabled?: boolean | 13 | commentsEnabled?: boolean |
14 | downloadEnabled?: boolean | ||
14 | nsfw?: boolean | 15 | nsfw?: boolean |
15 | waitTranscoding?: boolean | 16 | waitTranscoding?: boolean |
16 | channelId?: number | 17 | channelId?: number |
diff --git a/shared/models/videos/video.model.ts b/shared/models/videos/video.model.ts index 2373ceb18..df800461c 100644 --- a/shared/models/videos/video.model.ts +++ b/shared/models/videos/video.model.ts | |||
@@ -5,6 +5,7 @@ import { VideoChannel } from './channel/video-channel.model' | |||
5 | import { VideoPrivacy } from './video-privacy.enum' | 5 | import { VideoPrivacy } from './video-privacy.enum' |
6 | import { VideoScheduleUpdate } from './video-schedule-update.model' | 6 | import { VideoScheduleUpdate } from './video-schedule-update.model' |
7 | import { VideoConstant } from './video-constant.model' | 7 | import { VideoConstant } from './video-constant.model' |
8 | import { VideoStreamingPlaylist } from './video-streaming-playlist.model' | ||
8 | 9 | ||
9 | export interface VideoFile { | 10 | export interface VideoFile { |
10 | magnetUri: string | 11 | magnetUri: string |
@@ -24,7 +25,7 @@ export interface VideoChannelAttribute { | |||
24 | displayName: string | 25 | displayName: string |
25 | url: string | 26 | url: string |
26 | host: string | 27 | host: string |
27 | avatar: Avatar | 28 | avatar?: Avatar |
28 | } | 29 | } |
29 | 30 | ||
30 | export interface AccountAttribute { | 31 | export interface AccountAttribute { |
@@ -34,7 +35,7 @@ export interface AccountAttribute { | |||
34 | displayName: string | 35 | displayName: string |
35 | url: string | 36 | url: string |
36 | host: string | 37 | host: string |
37 | avatar: Avatar | 38 | avatar?: Avatar |
38 | } | 39 | } |
39 | 40 | ||
40 | export interface Video { | 41 | export interface Video { |
@@ -83,8 +84,13 @@ export interface VideoDetails extends Video { | |||
83 | files: VideoFile[] | 84 | files: VideoFile[] |
84 | account: Account | 85 | account: Account |
85 | commentsEnabled: boolean | 86 | commentsEnabled: boolean |
87 | downloadEnabled: boolean | ||
86 | 88 | ||
87 | // Not optional in details (unlike in Video) | 89 | // Not optional in details (unlike in Video) |
88 | waitTranscoding: boolean | 90 | waitTranscoding: boolean |
89 | state: VideoConstant<VideoState> | 91 | state: VideoConstant<VideoState> |
92 | |||
93 | trackerUrls: string[] | ||
94 | |||
95 | streamingPlaylists: VideoStreamingPlaylist[] | ||
90 | } | 96 | } |