Begin activitypub

This commit is contained in:
Chocobozzz
2017-11-09 17:51:58 +01:00
parent 343ad675f2
commit e4f97babf7
92 changed files with 2507 additions and 920 deletions

View 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
}

View 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
}

View File

@@ -0,0 +1,9 @@
import { Activity } from './activity'
export interface ActivityPubCollection {
'@context': string[]
type: 'Collection' | 'CollectionPage'
totalItems: number
partOf?: string
items: Activity[]
}

View File

@@ -0,0 +1,9 @@
import { Activity } from './activity'
export interface ActivityPubOrderedCollection {
'@context': string[]
type: 'OrderedCollection' | 'OrderedCollectionPage'
totalItems: number
partOf?: string
orderedItems: Activity[]
}

View 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

View File

@@ -0,0 +1,6 @@
export interface ActivityPubSignature {
type: 'GraphSignature2012'
created: Date,
creator: string
signatureValue: string
}

View 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'

View 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
}

View File

@@ -0,0 +1,3 @@
export * from './common-objects'
export * from './video-channel-object'
export * from './video-torrent-object'

View File

@@ -0,0 +1,8 @@
import { ActivityIdentifierObject } from './common-objects'
export interface VideoChannelObject {
type: 'VideoChannel'
name: string
content: string
uuid: ActivityIdentifierObject
}

View 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[]
}

View 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
}[]
}

View File

@@ -1,3 +1,4 @@
export * from './activitypub'
export * from './pods'
export * from './users'
export * from './videos'

View File

@@ -1 +1,2 @@
export type JobState = 'pending' | 'processing' | 'error' | 'success'
export type JobCategory = 'transcoding' | 'http-request'

View File

@@ -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