mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-02-25 18:55:32 -06:00
Begin activitypub
This commit is contained in:
34
shared/models/activitypub/activity.ts
Normal file
34
shared/models/activitypub/activity.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import {
|
||||
VideoChannelObject,
|
||||
VideoTorrentObject
|
||||
} from './objects'
|
||||
import { ActivityPubSignature } from './activitypub-signature'
|
||||
|
||||
export type Activity = ActivityCreate | ActivityUpdate | ActivityFlag
|
||||
|
||||
// Flag -> report abuse
|
||||
export type ActivityType = 'Create' | 'Update' | 'Flag'
|
||||
|
||||
export interface BaseActivity {
|
||||
'@context'?: any[]
|
||||
id: string
|
||||
to: string[]
|
||||
actor: string
|
||||
type: ActivityType
|
||||
signature: ActivityPubSignature
|
||||
}
|
||||
|
||||
export interface ActivityCreate extends BaseActivity {
|
||||
type: 'Create'
|
||||
object: VideoTorrentObject | VideoChannelObject
|
||||
}
|
||||
|
||||
export interface ActivityUpdate extends BaseActivity {
|
||||
type: 'Update'
|
||||
object: VideoTorrentObject | VideoChannelObject
|
||||
}
|
||||
|
||||
export interface ActivityFlag extends BaseActivity {
|
||||
type: 'Flag'
|
||||
object: string
|
||||
}
|
||||
27
shared/models/activitypub/activitypub-actor.ts
Normal file
27
shared/models/activitypub/activitypub-actor.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
export interface ActivityPubActor {
|
||||
'@context': any[]
|
||||
type: 'Person' | 'Application'
|
||||
id: string
|
||||
following: string
|
||||
followers: string
|
||||
inbox: string
|
||||
outbox: string
|
||||
preferredUsername: string
|
||||
url: string
|
||||
name: string
|
||||
endpoints: {
|
||||
sharedInbox: string
|
||||
}
|
||||
|
||||
uuid: string
|
||||
publicKey: {
|
||||
id: string
|
||||
owner: string
|
||||
publicKeyPem: string
|
||||
}
|
||||
|
||||
// Not used
|
||||
// summary: string
|
||||
// icon: string[]
|
||||
// liked: string
|
||||
}
|
||||
9
shared/models/activitypub/activitypub-collection.ts
Normal file
9
shared/models/activitypub/activitypub-collection.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { Activity } from './activity'
|
||||
|
||||
export interface ActivityPubCollection {
|
||||
'@context': string[]
|
||||
type: 'Collection' | 'CollectionPage'
|
||||
totalItems: number
|
||||
partOf?: string
|
||||
items: Activity[]
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import { Activity } from './activity'
|
||||
|
||||
export interface ActivityPubOrderedCollection {
|
||||
'@context': string[]
|
||||
type: 'OrderedCollection' | 'OrderedCollectionPage'
|
||||
totalItems: number
|
||||
partOf?: string
|
||||
orderedItems: Activity[]
|
||||
}
|
||||
5
shared/models/activitypub/activitypub-root.ts
Normal file
5
shared/models/activitypub/activitypub-root.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import { Activity } from './activity'
|
||||
import { ActivityPubCollection } from './activitypub-collection'
|
||||
import { ActivityPubOrderedCollection } from './activitypub-ordered-collection'
|
||||
|
||||
export type RootActivity = Activity | ActivityPubCollection | ActivityPubOrderedCollection
|
||||
6
shared/models/activitypub/activitypub-signature.ts
Normal file
6
shared/models/activitypub/activitypub-signature.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export interface ActivityPubSignature {
|
||||
type: 'GraphSignature2012'
|
||||
created: Date,
|
||||
creator: string
|
||||
signatureValue: string
|
||||
}
|
||||
8
shared/models/activitypub/index.ts
Normal file
8
shared/models/activitypub/index.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
export * from './activity'
|
||||
export * from './activitypub-actor'
|
||||
export * from './activitypub-collection'
|
||||
export * from './activitypub-ordered-collection'
|
||||
export * from './activitypub-root'
|
||||
export * from './activitypub-signature'
|
||||
export * from './objects'
|
||||
export * from './webfinger'
|
||||
25
shared/models/activitypub/objects/common-objects.ts
Normal file
25
shared/models/activitypub/objects/common-objects.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
export interface ActivityIdentifierObject {
|
||||
identifier: string
|
||||
name: string
|
||||
}
|
||||
|
||||
export interface ActivityTagObject {
|
||||
type: 'Hashtag'
|
||||
name: string
|
||||
}
|
||||
|
||||
export interface ActivityIconObject {
|
||||
type: 'Image'
|
||||
url: string
|
||||
mediaType: 'image/jpeg'
|
||||
width: number
|
||||
height: number
|
||||
}
|
||||
|
||||
export interface ActivityUrlObject {
|
||||
type: 'Link'
|
||||
mimeType: 'video/mp4' | 'video/webm' | 'application/x-bittorrent' | 'application/x-bittorrent;x-scheme-handler/magnet'
|
||||
url: string
|
||||
width: number
|
||||
size?: number
|
||||
}
|
||||
3
shared/models/activitypub/objects/index.ts
Normal file
3
shared/models/activitypub/objects/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export * from './common-objects'
|
||||
export * from './video-channel-object'
|
||||
export * from './video-torrent-object'
|
||||
@@ -0,0 +1,8 @@
|
||||
import { ActivityIdentifierObject } from './common-objects'
|
||||
|
||||
export interface VideoChannelObject {
|
||||
type: 'VideoChannel'
|
||||
name: string
|
||||
content: string
|
||||
uuid: ActivityIdentifierObject
|
||||
}
|
||||
25
shared/models/activitypub/objects/video-torrent-object.ts
Normal file
25
shared/models/activitypub/objects/video-torrent-object.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import {
|
||||
ActivityIconObject,
|
||||
ActivityIdentifierObject,
|
||||
ActivityTagObject,
|
||||
ActivityUrlObject
|
||||
} from './common-objects'
|
||||
|
||||
export interface VideoTorrentObject {
|
||||
type: 'Video'
|
||||
name: string
|
||||
duration: string
|
||||
uuid: string
|
||||
tag: ActivityTagObject[]
|
||||
category: ActivityIdentifierObject
|
||||
licence: ActivityIdentifierObject
|
||||
language: ActivityIdentifierObject
|
||||
views: number
|
||||
nsfw: boolean
|
||||
published: Date
|
||||
updated: Date
|
||||
mediaType: 'text/markdown'
|
||||
content: string
|
||||
icon: ActivityIconObject
|
||||
url: ActivityUrlObject[]
|
||||
}
|
||||
9
shared/models/activitypub/webfinger.ts
Normal file
9
shared/models/activitypub/webfinger.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
export interface WebFingerData {
|
||||
subject: string
|
||||
aliases: string[]
|
||||
links: {
|
||||
rel: 'self'
|
||||
type: 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'
|
||||
href: string
|
||||
}[]
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
export * from './activitypub'
|
||||
export * from './pods'
|
||||
export * from './users'
|
||||
export * from './videos'
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
export type JobState = 'pending' | 'processing' | 'error' | 'success'
|
||||
export type JobCategory = 'transcoding' | 'http-request'
|
||||
|
||||
@@ -13,7 +13,7 @@ export interface VideoFile {
|
||||
export interface Video {
|
||||
id: number
|
||||
uuid: string
|
||||
author: string
|
||||
account: string
|
||||
createdAt: Date | string
|
||||
updatedAt: Date | string
|
||||
categoryLabel: string
|
||||
|
||||
Reference in New Issue
Block a user