diff options
Diffstat (limited to 'shared/models/activitypub')
6 files changed, 79 insertions, 25 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 1de60da94..8c89810d6 100644 --- a/shared/models/activitypub/objects/common-objects.ts +++ b/shared/models/activitypub/objects/common-objects.ts | |||
@@ -19,28 +19,56 @@ export interface ActivityIconObject { | |||
19 | 19 | ||
20 | export type ActivityVideoUrlObject = { | 20 | export type ActivityVideoUrlObject = { |
21 | type: 'Link' | 21 | type: 'Link' |
22 | mimeType: 'video/mp4' | 'video/webm' | 'video/ogg' | 22 | // TODO: remove mimeType (backward compatibility, introduced in v1.1.0) |
23 | mimeType?: 'video/mp4' | 'video/webm' | 'video/ogg' | ||
24 | mediaType: 'video/mp4' | 'video/webm' | 'video/ogg' | ||
23 | href: string | 25 | href: string |
24 | height: number | 26 | height: number |
25 | size: number | 27 | size: number |
26 | fps: number | 28 | fps: number |
27 | } | 29 | } |
28 | 30 | ||
29 | export type ActivityUrlObject = | 31 | export type ActivityPlaylistSegmentHashesObject = { |
30 | ActivityVideoUrlObject | 32 | type: 'Link' |
31 | | | 33 | name: 'sha256' |
32 | { | 34 | // TODO: remove mimeType (backward compatibility, introduced in v1.1.0) |
33 | type: 'Link' | 35 | mimeType?: 'application/json' |
34 | mimeType: 'application/x-bittorrent' | 'application/x-bittorrent;x-scheme-handler/magnet' | 36 | mediaType: 'application/json' |
35 | href: string | 37 | href: string |
36 | height: number | 38 | } |
37 | } | 39 | |
38 | | | 40 | export type ActivityPlaylistInfohashesObject = { |
39 | { | 41 | type: 'Infohash' |
40 | type: 'Link' | 42 | name: string |
41 | mimeType: 'text/html' | 43 | } |
42 | href: string | 44 | |
43 | } | 45 | export type ActivityPlaylistUrlObject = { |
46 | type: 'Link' | ||
47 | // TODO: remove mimeType (backward compatibility, introduced in v1.1.0) | ||
48 | mimeType?: 'application/x-mpegURL' | ||
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 | ||
44 | 72 | ||
45 | export interface ActivityPubAttributedTo { | 73 | export interface ActivityPubAttributedTo { |
46 | type: 'Group' | 'Person' | 74 | type: 'Group' | 'Person' |
diff --git a/shared/models/activitypub/objects/dislike-object.ts b/shared/models/activitypub/objects/dislike-object.ts index 295175774..7218fb784 100644 --- a/shared/models/activitypub/objects/dislike-object.ts +++ b/shared/models/activitypub/objects/dislike-object.ts | |||
@@ -1,5 +1,6 @@ | |||
1 | export interface DislikeObject { | 1 | export interface DislikeObject { |
2 | type: 'Dislike', | 2 | id: string |
3 | type: 'Dislike' | ||
3 | actor: string | 4 | actor: string |
4 | object: string | 5 | object: string |
5 | } | 6 | } |
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 } | |||