diff options
author | Chocobozzz <me@florianbigard.com> | 2018-09-11 16:27:07 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-09-13 14:05:49 +0200 |
commit | c48e82b5e0478434de30626d14594a97f2402e7c (patch) | |
tree | a78e5272bd0fe4f5b41831e571e02d05f1515b82 /shared | |
parent | a651038487faa838bda3ce04695b08bc65baff70 (diff) | |
download | PeerTube-c48e82b5e0478434de30626d14594a97f2402e7c.tar.gz PeerTube-c48e82b5e0478434de30626d14594a97f2402e7c.tar.zst PeerTube-c48e82b5e0478434de30626d14594a97f2402e7c.zip |
Basic video redundancy implementation
Diffstat (limited to 'shared')
-rw-r--r-- | shared/models/activitypub/activity.ts | 6 | ||||
-rw-r--r-- | shared/models/activitypub/objects/cache-file-object.ts | 9 | ||||
-rw-r--r-- | shared/models/activitypub/objects/common-objects.ts | 25 | ||||
-rw-r--r-- | shared/models/activitypub/objects/index.ts | 1 | ||||
-rw-r--r-- | shared/models/activitypub/objects/video-torrent-object.ts | 4 | ||||
-rw-r--r-- | shared/models/actors/follow.model.ts | 6 | ||||
-rw-r--r-- | shared/models/avatars/index.ts | 1 | ||||
-rw-r--r-- | shared/models/index.ts | 4 | ||||
-rw-r--r-- | shared/models/redundancy/index.ts | 1 | ||||
-rw-r--r-- | shared/models/redundancy/videos-redundancy.model.ts | 6 | ||||
-rw-r--r-- | shared/models/users/user-right.enum.ts | 1 |
11 files changed, 50 insertions, 14 deletions
diff --git a/shared/models/activitypub/activity.ts b/shared/models/activitypub/activity.ts index 46e883e5f..44cb99efb 100644 --- a/shared/models/activitypub/activity.ts +++ b/shared/models/activitypub/activity.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { ActivityPubActor } from './activitypub-actor' | 1 | import { ActivityPubActor } from './activitypub-actor' |
2 | import { ActivityPubSignature } from './activitypub-signature' | 2 | import { ActivityPubSignature } from './activitypub-signature' |
3 | import { VideoTorrentObject } from './objects' | 3 | import { CacheFileObject, VideoTorrentObject } from './objects' |
4 | import { DislikeObject } from './objects/dislike-object' | 4 | 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' |
@@ -29,12 +29,12 @@ export interface BaseActivity { | |||
29 | 29 | ||
30 | export interface ActivityCreate extends BaseActivity { | 30 | export interface ActivityCreate extends BaseActivity { |
31 | type: 'Create' | 31 | type: 'Create' |
32 | object: VideoTorrentObject | VideoAbuseObject | ViewObject | DislikeObject | VideoCommentObject | 32 | object: VideoTorrentObject | VideoAbuseObject | ViewObject | DislikeObject | VideoCommentObject | CacheFileObject |
33 | } | 33 | } |
34 | 34 | ||
35 | export interface ActivityUpdate extends BaseActivity { | 35 | export interface ActivityUpdate extends BaseActivity { |
36 | type: 'Update' | 36 | type: 'Update' |
37 | object: VideoTorrentObject | ActivityPubActor | 37 | object: VideoTorrentObject | ActivityPubActor | CacheFileObject |
38 | } | 38 | } |
39 | 39 | ||
40 | export interface ActivityDelete extends BaseActivity { | 40 | export interface ActivityDelete extends BaseActivity { |
diff --git a/shared/models/activitypub/objects/cache-file-object.ts b/shared/models/activitypub/objects/cache-file-object.ts new file mode 100644 index 000000000..0a5125f5b --- /dev/null +++ b/shared/models/activitypub/objects/cache-file-object.ts | |||
@@ -0,0 +1,9 @@ | |||
1 | import { ActivityVideoUrlObject } from './common-objects' | ||
2 | |||
3 | export interface CacheFileObject { | ||
4 | id: string | ||
5 | type: 'CacheFile', | ||
6 | object: string | ||
7 | expires: string | ||
8 | url: ActivityVideoUrlObject | ||
9 | } | ||
diff --git a/shared/models/activitypub/objects/common-objects.ts b/shared/models/activitypub/objects/common-objects.ts index ff2cfdbb4..1de60da94 100644 --- a/shared/models/activitypub/objects/common-objects.ts +++ b/shared/models/activitypub/objects/common-objects.ts | |||
@@ -17,16 +17,31 @@ export interface ActivityIconObject { | |||
17 | height: number | 17 | height: number |
18 | } | 18 | } |
19 | 19 | ||
20 | export interface ActivityUrlObject { | 20 | export type ActivityVideoUrlObject = { |
21 | type: 'Link' | 21 | type: 'Link' |
22 | mimeType: 'video/mp4' | 'video/webm' | 'application/x-bittorrent' | 'application/x-bittorrent;x-scheme-handler/magnet' | 22 | mimeType: 'video/mp4' | 'video/webm' | 'video/ogg' |
23 | href: string | 23 | href: string |
24 | height: number | 24 | height: number |
25 | 25 | size: number | |
26 | size?: number | 26 | fps: number |
27 | fps?: number | ||
28 | } | 27 | } |
29 | 28 | ||
29 | export type ActivityUrlObject = | ||
30 | ActivityVideoUrlObject | ||
31 | | | ||
32 | { | ||
33 | type: 'Link' | ||
34 | mimeType: 'application/x-bittorrent' | 'application/x-bittorrent;x-scheme-handler/magnet' | ||
35 | href: string | ||
36 | height: number | ||
37 | } | ||
38 | | | ||
39 | { | ||
40 | type: 'Link' | ||
41 | mimeType: 'text/html' | ||
42 | href: string | ||
43 | } | ||
44 | |||
30 | export interface ActivityPubAttributedTo { | 45 | export interface ActivityPubAttributedTo { |
31 | type: 'Group' | 'Person' | 46 | type: 'Group' | 'Person' |
32 | id: string | 47 | id: string |
diff --git a/shared/models/activitypub/objects/index.ts b/shared/models/activitypub/objects/index.ts index 3efd3ef13..fba61e12f 100644 --- a/shared/models/activitypub/objects/index.ts +++ b/shared/models/activitypub/objects/index.ts | |||
@@ -1,3 +1,4 @@ | |||
1 | export * from './cache-file-object' | ||
1 | export * from './common-objects' | 2 | export * from './common-objects' |
2 | export * from './video-abuse-object' | 3 | export * from './video-abuse-object' |
3 | export * from './video-torrent-object' | 4 | export * from './video-torrent-object' |
diff --git a/shared/models/activitypub/objects/video-torrent-object.ts b/shared/models/activitypub/objects/video-torrent-object.ts index 90de8967b..8504c178f 100644 --- a/shared/models/activitypub/objects/video-torrent-object.ts +++ b/shared/models/activitypub/objects/video-torrent-object.ts | |||
@@ -1,10 +1,10 @@ | |||
1 | import { | 1 | import { |
2 | ActivityIconObject, | 2 | ActivityIconObject, |
3 | ActivityIdentifierObject, ActivityPubAttributedTo, | 3 | ActivityIdentifierObject, |
4 | ActivityPubAttributedTo, | ||
4 | ActivityTagObject, | 5 | ActivityTagObject, |
5 | ActivityUrlObject | 6 | ActivityUrlObject |
6 | } from './common-objects' | 7 | } from './common-objects' |
7 | import { ActivityPubOrderedCollection } from '../activitypub-ordered-collection' | ||
8 | import { VideoState } from '../../videos' | 8 | import { VideoState } from '../../videos' |
9 | 9 | ||
10 | export interface VideoTorrentObject { | 10 | export interface VideoTorrentObject { |
diff --git a/shared/models/actors/follow.model.ts b/shared/models/actors/follow.model.ts index 70562bfc7..7de638cba 100644 --- a/shared/models/actors/follow.model.ts +++ b/shared/models/actors/follow.model.ts | |||
@@ -2,10 +2,10 @@ import { Actor } from './actor.model' | |||
2 | 2 | ||
3 | export type FollowState = 'pending' | 'accepted' | 3 | export type FollowState = 'pending' | 'accepted' |
4 | 4 | ||
5 | export interface AccountFollow { | 5 | export interface ActorFollow { |
6 | id: number | 6 | id: number |
7 | follower: Actor | 7 | follower: Actor & { hostRedundancyAllowed: boolean } |
8 | following: Actor | 8 | following: Actor & { hostRedundancyAllowed: boolean } |
9 | score: number | 9 | score: number |
10 | state: FollowState | 10 | state: FollowState |
11 | createdAt: Date | 11 | createdAt: Date |
diff --git a/shared/models/avatars/index.ts b/shared/models/avatars/index.ts new file mode 100644 index 000000000..65e8e0882 --- /dev/null +++ b/shared/models/avatars/index.ts | |||
@@ -0,0 +1 @@ | |||
export * from './avatar.model' | |||
diff --git a/shared/models/index.ts b/shared/models/index.ts index 170f620e7..e61d6cbdc 100644 --- a/shared/models/index.ts +++ b/shared/models/index.ts | |||
@@ -1,5 +1,7 @@ | |||
1 | export * from './actors' | ||
2 | export * from './activitypub' | 1 | export * from './activitypub' |
2 | export * from './actors' | ||
3 | export * from './avatars' | ||
4 | export * from './redundancy' | ||
3 | export * from './users' | 5 | export * from './users' |
4 | export * from './videos' | 6 | export * from './videos' |
5 | export * from './feeds' | 7 | export * from './feeds' |
diff --git a/shared/models/redundancy/index.ts b/shared/models/redundancy/index.ts new file mode 100644 index 000000000..61bf0fca7 --- /dev/null +++ b/shared/models/redundancy/index.ts | |||
@@ -0,0 +1 @@ | |||
export * from './videos-redundancy.model' | |||
diff --git a/shared/models/redundancy/videos-redundancy.model.ts b/shared/models/redundancy/videos-redundancy.model.ts new file mode 100644 index 000000000..eb84964e0 --- /dev/null +++ b/shared/models/redundancy/videos-redundancy.model.ts | |||
@@ -0,0 +1,6 @@ | |||
1 | export type VideoRedundancyStrategy = 'most-views' | ||
2 | |||
3 | export interface VideosRedundancy { | ||
4 | strategy: VideoRedundancyStrategy | ||
5 | size: number | ||
6 | } | ||
diff --git a/shared/models/users/user-right.enum.ts b/shared/models/users/user-right.enum.ts index 64ad3e9b9..c4ccd632f 100644 --- a/shared/models/users/user-right.enum.ts +++ b/shared/models/users/user-right.enum.ts | |||
@@ -3,6 +3,7 @@ export enum UserRight { | |||
3 | 3 | ||
4 | MANAGE_USERS, | 4 | MANAGE_USERS, |
5 | MANAGE_SERVER_FOLLOW, | 5 | MANAGE_SERVER_FOLLOW, |
6 | MANAGE_SERVER_REDUNDANCY, | ||
6 | MANAGE_VIDEO_ABUSES, | 7 | MANAGE_VIDEO_ABUSES, |
7 | MANAGE_JOBS, | 8 | MANAGE_JOBS, |
8 | MANAGE_CONFIGURATION, | 9 | MANAGE_CONFIGURATION, |