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/models/activitypub | |
parent | a651038487faa838bda3ce04695b08bc65baff70 (diff) | |
download | PeerTube-c48e82b5e0478434de30626d14594a97f2402e7c.tar.gz PeerTube-c48e82b5e0478434de30626d14594a97f2402e7c.tar.zst PeerTube-c48e82b5e0478434de30626d14594a97f2402e7c.zip |
Basic video redundancy implementation
Diffstat (limited to 'shared/models/activitypub')
5 files changed, 35 insertions, 10 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 { |