aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/models/activitypub
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-11-23 14:19:55 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-11-27 19:40:53 +0100
commit0032ebe94aa83fab761c7de3ceb6210ac4532824 (patch)
tree3ea407d7ea6de4c7f7bc66caba7e23c0cc4036e3 /shared/models/activitypub
parentd52eb8f656242c7e34afdb2dee681861fb9bce35 (diff)
downloadPeerTube-0032ebe94aa83fab761c7de3ceb6210ac4532824.tar.gz
PeerTube-0032ebe94aa83fab761c7de3ceb6210ac4532824.tar.zst
PeerTube-0032ebe94aa83fab761c7de3ceb6210ac4532824.zip
Federate likes/dislikes
Diffstat (limited to 'shared/models/activitypub')
-rw-r--r--shared/models/activitypub/activity.ts14
-rw-r--r--shared/models/activitypub/objects/dislike-object.ts5
-rw-r--r--shared/models/activitypub/objects/index.ts1
3 files changed, 16 insertions, 4 deletions
diff --git a/shared/models/activitypub/activity.ts b/shared/models/activitypub/activity.ts
index ce150bc12..cbfd6157a 100644
--- a/shared/models/activitypub/activity.ts
+++ b/shared/models/activitypub/activity.ts
@@ -1,13 +1,14 @@
1import { ActivityPubSignature } from './activitypub-signature' 1import { ActivityPubSignature } from './activitypub-signature'
2import { VideoChannelObject, VideoTorrentObject } from './objects' 2import { VideoChannelObject, VideoTorrentObject } from './objects'
3import { DislikeObject } from './objects/dislike-object'
3import { VideoAbuseObject } from './objects/video-abuse-object' 4import { VideoAbuseObject } from './objects/video-abuse-object'
4import { ViewObject } from './objects/view-object' 5import { ViewObject } from './objects/view-object'
5 6
6export type Activity = ActivityCreate | ActivityAdd | ActivityUpdate | 7export type Activity = ActivityCreate | ActivityAdd | ActivityUpdate |
7 ActivityDelete | ActivityFollow | ActivityAccept | ActivityAnnounce | 8 ActivityDelete | ActivityFollow | ActivityAccept | ActivityAnnounce |
8 ActivityUndo 9 ActivityUndo | ActivityLike
9 10
10export type ActivityType = 'Create' | 'Add' | 'Update' | 'Delete' | 'Follow' | 'Accept' | 'Announce' | 'Undo' 11export type ActivityType = 'Create' | 'Add' | 'Update' | 'Delete' | 'Follow' | 'Accept' | 'Announce' | 'Undo' | 'Like'
11 12
12export interface BaseActivity { 13export interface BaseActivity {
13 '@context'?: any[] 14 '@context'?: any[]
@@ -21,7 +22,7 @@ export interface BaseActivity {
21 22
22export interface ActivityCreate extends BaseActivity { 23export interface ActivityCreate extends BaseActivity {
23 type: 'Create' 24 type: 'Create'
24 object: VideoChannelObject | VideoAbuseObject | ViewObject 25 object: VideoChannelObject | VideoAbuseObject | ViewObject | DislikeObject
25} 26}
26 27
27export interface ActivityAdd extends BaseActivity { 28export interface ActivityAdd extends BaseActivity {
@@ -55,5 +56,10 @@ export interface ActivityAnnounce extends BaseActivity {
55 56
56export interface ActivityUndo extends BaseActivity { 57export interface ActivityUndo extends BaseActivity {
57 type: 'Undo', 58 type: 'Undo',
58 object: ActivityFollow 59 object: ActivityFollow | ActivityLike | ActivityCreate
60}
61
62export interface ActivityLike extends BaseActivity {
63 type: 'Like',
64 object: string
59} 65}
diff --git a/shared/models/activitypub/objects/dislike-object.ts b/shared/models/activitypub/objects/dislike-object.ts
new file mode 100644
index 000000000..295175774
--- /dev/null
+++ b/shared/models/activitypub/objects/dislike-object.ts
@@ -0,0 +1,5 @@
1export interface DislikeObject {
2 type: 'Dislike',
3 actor: string
4 object: string
5}
diff --git a/shared/models/activitypub/objects/index.ts b/shared/models/activitypub/objects/index.ts
index d92f772e2..f1f761e44 100644
--- a/shared/models/activitypub/objects/index.ts
+++ b/shared/models/activitypub/objects/index.ts
@@ -3,3 +3,4 @@ export * from './video-abuse-object'
3export * from './video-channel-object' 3export * from './video-channel-object'
4export * from './video-torrent-object' 4export * from './video-torrent-object'
5export * from './view-object' 5export * from './view-object'
6export * from './dislike-object'