aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/models/activitypub
diff options
context:
space:
mode:
Diffstat (limited to 'shared/models/activitypub')
-rw-r--r--shared/models/activitypub/activity.ts31
-rw-r--r--shared/models/activitypub/activitypub-ordered-collection.ts5
-rw-r--r--shared/models/activitypub/objects/cache-file-object.ts4
-rw-r--r--shared/models/activitypub/objects/common-objects.ts60
-rw-r--r--shared/models/activitypub/objects/dislike-object.ts3
-rw-r--r--shared/models/activitypub/objects/object.model.ts1
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'
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'
7import { ViewObject } from './objects/view-object' 7import { ViewObject } from './objects/view-object'
8import { APObject } from './objects/object.model'
8 9
9export type Activity = ActivityCreate | ActivityUpdate | 10export 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
13export type ActivityType = 'Create' | 'Update' | 'Delete' | 'Follow' | 'Accept' | 'Announce' | 'Undo' | 'Like' | 'Reject' 14export type ActivityType = 'Create' | 'Update' | 'Delete' | 'Follow' | 'Accept' | 'Announce' | 'Undo' | 'Like' | 'Reject' |
15 'View' | 'Dislike' | 'Flag'
14 16
15export interface ActivityAudience { 17export interface ActivityAudience {
16 to: string[] 18 to: string[]
@@ -59,15 +61,34 @@ export interface ActivityReject extends BaseActivity {
59 61
60export interface ActivityAnnounce extends BaseActivity { 62export interface ActivityAnnounce extends BaseActivity {
61 type: 'Announce' 63 type: 'Announce'
62 object: string | { id: string } 64 object: APObject
63} 65}
64 66
65export interface ActivityUndo extends BaseActivity { 67export 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
70export interface ActivityLike extends BaseActivity { 72export interface ActivityLike extends BaseActivity {
71 type: 'Like', 73 type: 'Like',
72 object: string 74 object: APObject
75}
76
77export interface ActivityView extends BaseActivity {
78 type: 'View',
79 actor: string
80 object: APObject
81}
82
83export interface ActivityDislike extends BaseActivity {
84 id: string
85 type: 'Dislike'
86 actor: string
87 object: APObject
88}
89
90export 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 @@
1import { ActivityVideoUrlObject } from './common-objects' 1import { ActivityVideoUrlObject, ActivityPlaylistUrlObject } from './common-objects'
2 2
3export interface CacheFileObject { 3export 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
20export type ActivityVideoUrlObject = { 20export 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
29export type ActivityUrlObject = 31export 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 | 40export type ActivityPlaylistInfohashesObject = {
39 { 41 type: 'Infohash'
40 type: 'Link' 42 name: string
41 mimeType: 'text/html' 43}
42 href: string 44
43 } 45export 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
54export 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
63export 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
71export type ActivityUrlObject = ActivityVideoUrlObject | ActivityPlaylistUrlObject | ActivityBitTorrentUrlObject | ActivityHtmlUrlObject
44 72
45export interface ActivityPubAttributedTo { 73export 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 @@
1export interface DislikeObject { 1export 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 }