aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared
diff options
context:
space:
mode:
Diffstat (limited to 'shared')
-rw-r--r--shared/models/activitypub/activity.ts34
-rw-r--r--shared/models/activitypub/activitypub-actor.ts27
-rw-r--r--shared/models/activitypub/activitypub-collection.ts9
-rw-r--r--shared/models/activitypub/activitypub-ordered-collection.ts9
-rw-r--r--shared/models/activitypub/activitypub-root.ts5
-rw-r--r--shared/models/activitypub/activitypub-signature.ts6
-rw-r--r--shared/models/activitypub/index.ts8
-rw-r--r--shared/models/activitypub/objects/common-objects.ts25
-rw-r--r--shared/models/activitypub/objects/index.ts3
-rw-r--r--shared/models/activitypub/objects/video-channel-object.ts8
-rw-r--r--shared/models/activitypub/objects/video-torrent-object.ts25
-rw-r--r--shared/models/activitypub/webfinger.ts9
-rw-r--r--shared/models/index.ts1
-rw-r--r--shared/models/job.model.ts1
-rw-r--r--shared/models/videos/video.model.ts2
15 files changed, 171 insertions, 1 deletions
diff --git a/shared/models/activitypub/activity.ts b/shared/models/activitypub/activity.ts
new file mode 100644
index 000000000..0274416b2
--- /dev/null
+++ b/shared/models/activitypub/activity.ts
@@ -0,0 +1,34 @@
1import {
2 VideoChannelObject,
3 VideoTorrentObject
4} from './objects'
5import { ActivityPubSignature } from './activitypub-signature'
6
7export type Activity = ActivityCreate | ActivityUpdate | ActivityFlag
8
9// Flag -> report abuse
10export type ActivityType = 'Create' | 'Update' | 'Flag'
11
12export interface BaseActivity {
13 '@context'?: any[]
14 id: string
15 to: string[]
16 actor: string
17 type: ActivityType
18 signature: ActivityPubSignature
19}
20
21export interface ActivityCreate extends BaseActivity {
22 type: 'Create'
23 object: VideoTorrentObject | VideoChannelObject
24}
25
26export interface ActivityUpdate extends BaseActivity {
27 type: 'Update'
28 object: VideoTorrentObject | VideoChannelObject
29}
30
31export interface ActivityFlag extends BaseActivity {
32 type: 'Flag'
33 object: string
34}
diff --git a/shared/models/activitypub/activitypub-actor.ts b/shared/models/activitypub/activitypub-actor.ts
new file mode 100644
index 000000000..77489135c
--- /dev/null
+++ b/shared/models/activitypub/activitypub-actor.ts
@@ -0,0 +1,27 @@
1export interface ActivityPubActor {
2 '@context': any[]
3 type: 'Person' | 'Application'
4 id: string
5 following: string
6 followers: string
7 inbox: string
8 outbox: string
9 preferredUsername: string
10 url: string
11 name: string
12 endpoints: {
13 sharedInbox: string
14 }
15
16 uuid: string
17 publicKey: {
18 id: string
19 owner: string
20 publicKeyPem: string
21 }
22
23 // Not used
24 // summary: string
25 // icon: string[]
26 // liked: string
27}
diff --git a/shared/models/activitypub/activitypub-collection.ts b/shared/models/activitypub/activitypub-collection.ts
new file mode 100644
index 000000000..60a6a6b04
--- /dev/null
+++ b/shared/models/activitypub/activitypub-collection.ts
@@ -0,0 +1,9 @@
1import { Activity } from './activity'
2
3export interface ActivityPubCollection {
4 '@context': string[]
5 type: 'Collection' | 'CollectionPage'
6 totalItems: number
7 partOf?: string
8 items: Activity[]
9}
diff --git a/shared/models/activitypub/activitypub-ordered-collection.ts b/shared/models/activitypub/activitypub-ordered-collection.ts
new file mode 100644
index 000000000..4080fd740
--- /dev/null
+++ b/shared/models/activitypub/activitypub-ordered-collection.ts
@@ -0,0 +1,9 @@
1import { Activity } from './activity'
2
3export interface ActivityPubOrderedCollection {
4 '@context': string[]
5 type: 'OrderedCollection' | 'OrderedCollectionPage'
6 totalItems: number
7 partOf?: string
8 orderedItems: Activity[]
9}
diff --git a/shared/models/activitypub/activitypub-root.ts b/shared/models/activitypub/activitypub-root.ts
new file mode 100644
index 000000000..6a67f3101
--- /dev/null
+++ b/shared/models/activitypub/activitypub-root.ts
@@ -0,0 +1,5 @@
1import { Activity } from './activity'
2import { ActivityPubCollection } from './activitypub-collection'
3import { ActivityPubOrderedCollection } from './activitypub-ordered-collection'
4
5export type RootActivity = Activity | ActivityPubCollection | ActivityPubOrderedCollection
diff --git a/shared/models/activitypub/activitypub-signature.ts b/shared/models/activitypub/activitypub-signature.ts
new file mode 100644
index 000000000..1d9f4b3b3
--- /dev/null
+++ b/shared/models/activitypub/activitypub-signature.ts
@@ -0,0 +1,6 @@
1export interface ActivityPubSignature {
2 type: 'GraphSignature2012'
3 created: Date,
4 creator: string
5 signatureValue: string
6}
diff --git a/shared/models/activitypub/index.ts b/shared/models/activitypub/index.ts
new file mode 100644
index 000000000..6cacb24d2
--- /dev/null
+++ b/shared/models/activitypub/index.ts
@@ -0,0 +1,8 @@
1export * from './activity'
2export * from './activitypub-actor'
3export * from './activitypub-collection'
4export * from './activitypub-ordered-collection'
5export * from './activitypub-root'
6export * from './activitypub-signature'
7export * from './objects'
8export * from './webfinger'
diff --git a/shared/models/activitypub/objects/common-objects.ts b/shared/models/activitypub/objects/common-objects.ts
new file mode 100644
index 000000000..3eaab21b5
--- /dev/null
+++ b/shared/models/activitypub/objects/common-objects.ts
@@ -0,0 +1,25 @@
1export interface ActivityIdentifierObject {
2 identifier: string
3 name: string
4}
5
6export interface ActivityTagObject {
7 type: 'Hashtag'
8 name: string
9}
10
11export interface ActivityIconObject {
12 type: 'Image'
13 url: string
14 mediaType: 'image/jpeg'
15 width: number
16 height: number
17}
18
19export interface ActivityUrlObject {
20 type: 'Link'
21 mimeType: 'video/mp4' | 'video/webm' | 'application/x-bittorrent' | 'application/x-bittorrent;x-scheme-handler/magnet'
22 url: string
23 width: number
24 size?: number
25}
diff --git a/shared/models/activitypub/objects/index.ts b/shared/models/activitypub/objects/index.ts
new file mode 100644
index 000000000..8c2e2daca
--- /dev/null
+++ b/shared/models/activitypub/objects/index.ts
@@ -0,0 +1,3 @@
1export * from './common-objects'
2export * from './video-channel-object'
3export * from './video-torrent-object'
diff --git a/shared/models/activitypub/objects/video-channel-object.ts b/shared/models/activitypub/objects/video-channel-object.ts
new file mode 100644
index 000000000..d64b4aed8
--- /dev/null
+++ b/shared/models/activitypub/objects/video-channel-object.ts
@@ -0,0 +1,8 @@
1import { ActivityIdentifierObject } from './common-objects'
2
3export interface VideoChannelObject {
4 type: 'VideoChannel'
5 name: string
6 content: string
7 uuid: ActivityIdentifierObject
8}
diff --git a/shared/models/activitypub/objects/video-torrent-object.ts b/shared/models/activitypub/objects/video-torrent-object.ts
new file mode 100644
index 000000000..00cc0a649
--- /dev/null
+++ b/shared/models/activitypub/objects/video-torrent-object.ts
@@ -0,0 +1,25 @@
1import {
2 ActivityIconObject,
3 ActivityIdentifierObject,
4 ActivityTagObject,
5 ActivityUrlObject
6} from './common-objects'
7
8export interface VideoTorrentObject {
9 type: 'Video'
10 name: string
11 duration: string
12 uuid: string
13 tag: ActivityTagObject[]
14 category: ActivityIdentifierObject
15 licence: ActivityIdentifierObject
16 language: ActivityIdentifierObject
17 views: number
18 nsfw: boolean
19 published: Date
20 updated: Date
21 mediaType: 'text/markdown'
22 content: string
23 icon: ActivityIconObject
24 url: ActivityUrlObject[]
25}
diff --git a/shared/models/activitypub/webfinger.ts b/shared/models/activitypub/webfinger.ts
new file mode 100644
index 000000000..b94baf996
--- /dev/null
+++ b/shared/models/activitypub/webfinger.ts
@@ -0,0 +1,9 @@
1export interface WebFingerData {
2 subject: string
3 aliases: string[]
4 links: {
5 rel: 'self'
6 type: 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'
7 href: string
8 }[]
9}
diff --git a/shared/models/index.ts b/shared/models/index.ts
index 02665a3e6..0ccb84d24 100644
--- a/shared/models/index.ts
+++ b/shared/models/index.ts
@@ -1,3 +1,4 @@
1export * from './activitypub'
1export * from './pods' 2export * from './pods'
2export * from './users' 3export * from './users'
3export * from './videos' 4export * from './videos'
diff --git a/shared/models/job.model.ts b/shared/models/job.model.ts
index 411c91482..ab723084a 100644
--- a/shared/models/job.model.ts
+++ b/shared/models/job.model.ts
@@ -1 +1,2 @@
1export type JobState = 'pending' | 'processing' | 'error' | 'success' 1export type JobState = 'pending' | 'processing' | 'error' | 'success'
2export type JobCategory = 'transcoding' | 'http-request'
diff --git a/shared/models/videos/video.model.ts b/shared/models/videos/video.model.ts
index 2f4ee2462..0606f1aec 100644
--- a/shared/models/videos/video.model.ts
+++ b/shared/models/videos/video.model.ts
@@ -13,7 +13,7 @@ export interface VideoFile {
13export interface Video { 13export interface Video {
14 id: number 14 id: number
15 uuid: string 15 uuid: string
16 author: string 16 account: string
17 createdAt: Date | string 17 createdAt: Date | string
18 updatedAt: Date | string 18 updatedAt: Date | string
19 categoryLabel: string 19 categoryLabel: string