diff options
Diffstat (limited to 'shared/models')
-rw-r--r-- | shared/models/activitypub/activity.ts | 34 | ||||
-rw-r--r-- | shared/models/activitypub/activitypub-actor.ts | 27 | ||||
-rw-r--r-- | shared/models/activitypub/activitypub-collection.ts | 9 | ||||
-rw-r--r-- | shared/models/activitypub/activitypub-ordered-collection.ts | 9 | ||||
-rw-r--r-- | shared/models/activitypub/activitypub-root.ts | 5 | ||||
-rw-r--r-- | shared/models/activitypub/activitypub-signature.ts | 6 | ||||
-rw-r--r-- | shared/models/activitypub/index.ts | 8 | ||||
-rw-r--r-- | shared/models/activitypub/objects/common-objects.ts | 25 | ||||
-rw-r--r-- | shared/models/activitypub/objects/index.ts | 3 | ||||
-rw-r--r-- | shared/models/activitypub/objects/video-channel-object.ts | 8 | ||||
-rw-r--r-- | shared/models/activitypub/objects/video-torrent-object.ts | 25 | ||||
-rw-r--r-- | shared/models/activitypub/webfinger.ts | 9 | ||||
-rw-r--r-- | shared/models/index.ts | 1 | ||||
-rw-r--r-- | shared/models/job.model.ts | 1 | ||||
-rw-r--r-- | shared/models/videos/video.model.ts | 2 |
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 @@ | |||
1 | import { | ||
2 | VideoChannelObject, | ||
3 | VideoTorrentObject | ||
4 | } from './objects' | ||
5 | import { ActivityPubSignature } from './activitypub-signature' | ||
6 | |||
7 | export type Activity = ActivityCreate | ActivityUpdate | ActivityFlag | ||
8 | |||
9 | // Flag -> report abuse | ||
10 | export type ActivityType = 'Create' | 'Update' | 'Flag' | ||
11 | |||
12 | export interface BaseActivity { | ||
13 | '@context'?: any[] | ||
14 | id: string | ||
15 | to: string[] | ||
16 | actor: string | ||
17 | type: ActivityType | ||
18 | signature: ActivityPubSignature | ||
19 | } | ||
20 | |||
21 | export interface ActivityCreate extends BaseActivity { | ||
22 | type: 'Create' | ||
23 | object: VideoTorrentObject | VideoChannelObject | ||
24 | } | ||
25 | |||
26 | export interface ActivityUpdate extends BaseActivity { | ||
27 | type: 'Update' | ||
28 | object: VideoTorrentObject | VideoChannelObject | ||
29 | } | ||
30 | |||
31 | export 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 @@ | |||
1 | export 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 @@ | |||
1 | import { Activity } from './activity' | ||
2 | |||
3 | export 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 @@ | |||
1 | import { Activity } from './activity' | ||
2 | |||
3 | export 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 @@ | |||
1 | import { Activity } from './activity' | ||
2 | import { ActivityPubCollection } from './activitypub-collection' | ||
3 | import { ActivityPubOrderedCollection } from './activitypub-ordered-collection' | ||
4 | |||
5 | export 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 @@ | |||
1 | export 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 @@ | |||
1 | export * from './activity' | ||
2 | export * from './activitypub-actor' | ||
3 | export * from './activitypub-collection' | ||
4 | export * from './activitypub-ordered-collection' | ||
5 | export * from './activitypub-root' | ||
6 | export * from './activitypub-signature' | ||
7 | export * from './objects' | ||
8 | export * 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 @@ | |||
1 | export interface ActivityIdentifierObject { | ||
2 | identifier: string | ||
3 | name: string | ||
4 | } | ||
5 | |||
6 | export interface ActivityTagObject { | ||
7 | type: 'Hashtag' | ||
8 | name: string | ||
9 | } | ||
10 | |||
11 | export interface ActivityIconObject { | ||
12 | type: 'Image' | ||
13 | url: string | ||
14 | mediaType: 'image/jpeg' | ||
15 | width: number | ||
16 | height: number | ||
17 | } | ||
18 | |||
19 | export 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 @@ | |||
1 | export * from './common-objects' | ||
2 | export * from './video-channel-object' | ||
3 | export * 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 @@ | |||
1 | import { ActivityIdentifierObject } from './common-objects' | ||
2 | |||
3 | export 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 @@ | |||
1 | import { | ||
2 | ActivityIconObject, | ||
3 | ActivityIdentifierObject, | ||
4 | ActivityTagObject, | ||
5 | ActivityUrlObject | ||
6 | } from './common-objects' | ||
7 | |||
8 | export 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 @@ | |||
1 | export 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 @@ | |||
1 | export * from './activitypub' | ||
1 | export * from './pods' | 2 | export * from './pods' |
2 | export * from './users' | 3 | export * from './users' |
3 | export * from './videos' | 4 | export * 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 @@ | |||
1 | export type JobState = 'pending' | 'processing' | 'error' | 'success' | 1 | export type JobState = 'pending' | 'processing' | 'error' | 'success' |
2 | export 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 { | |||
13 | export interface Video { | 13 | export 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 |