aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-09-11 16:27:07 +0200
committerChocobozzz <me@florianbigard.com>2018-09-13 14:05:49 +0200
commitc48e82b5e0478434de30626d14594a97f2402e7c (patch)
treea78e5272bd0fe4f5b41831e571e02d05f1515b82 /shared
parenta651038487faa838bda3ce04695b08bc65baff70 (diff)
downloadPeerTube-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.ts6
-rw-r--r--shared/models/activitypub/objects/cache-file-object.ts9
-rw-r--r--shared/models/activitypub/objects/common-objects.ts25
-rw-r--r--shared/models/activitypub/objects/index.ts1
-rw-r--r--shared/models/activitypub/objects/video-torrent-object.ts4
-rw-r--r--shared/models/actors/follow.model.ts6
-rw-r--r--shared/models/avatars/index.ts1
-rw-r--r--shared/models/index.ts4
-rw-r--r--shared/models/redundancy/index.ts1
-rw-r--r--shared/models/redundancy/videos-redundancy.model.ts6
-rw-r--r--shared/models/users/user-right.enum.ts1
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 @@
1import { ActivityPubActor } from './activitypub-actor' 1import { ActivityPubActor } from './activitypub-actor'
2import { ActivityPubSignature } from './activitypub-signature' 2import { ActivityPubSignature } from './activitypub-signature'
3import { VideoTorrentObject } from './objects' 3import { CacheFileObject, VideoTorrentObject } from './objects'
4import { DislikeObject } from './objects/dislike-object' 4import { DislikeObject } from './objects/dislike-object'
5import { VideoAbuseObject } from './objects/video-abuse-object' 5import { VideoAbuseObject } from './objects/video-abuse-object'
6import { VideoCommentObject } from './objects/video-comment-object' 6import { VideoCommentObject } from './objects/video-comment-object'
@@ -29,12 +29,12 @@ export interface BaseActivity {
29 29
30export interface ActivityCreate extends BaseActivity { 30export 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
35export interface ActivityUpdate extends BaseActivity { 35export interface ActivityUpdate extends BaseActivity {
36 type: 'Update' 36 type: 'Update'
37 object: VideoTorrentObject | ActivityPubActor 37 object: VideoTorrentObject | ActivityPubActor | CacheFileObject
38} 38}
39 39
40export interface ActivityDelete extends BaseActivity { 40export 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 @@
1import { ActivityVideoUrlObject } from './common-objects'
2
3export 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
20export interface ActivityUrlObject { 20export 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
29export 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
30export interface ActivityPubAttributedTo { 45export 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 @@
1export * from './cache-file-object'
1export * from './common-objects' 2export * from './common-objects'
2export * from './video-abuse-object' 3export * from './video-abuse-object'
3export * from './video-torrent-object' 4export * 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 @@
1import { 1import {
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'
7import { ActivityPubOrderedCollection } from '../activitypub-ordered-collection'
8import { VideoState } from '../../videos' 8import { VideoState } from '../../videos'
9 9
10export interface VideoTorrentObject { 10export 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
3export type FollowState = 'pending' | 'accepted' 3export type FollowState = 'pending' | 'accepted'
4 4
5export interface AccountFollow { 5export 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 @@
1export * from './actors'
2export * from './activitypub' 1export * from './activitypub'
2export * from './actors'
3export * from './avatars'
4export * from './redundancy'
3export * from './users' 5export * from './users'
4export * from './videos' 6export * from './videos'
5export * from './feeds' 7export * 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 @@
1export type VideoRedundancyStrategy = 'most-views'
2
3export 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,