From c48e82b5e0478434de30626d14594a97f2402e7c Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 11 Sep 2018 16:27:07 +0200 Subject: Basic video redundancy implementation --- .../activitypub/objects/cache-file-object.ts | 9 ++++++++ .../models/activitypub/objects/common-objects.ts | 25 +++++++++++++++++----- shared/models/activitypub/objects/index.ts | 1 + .../activitypub/objects/video-torrent-object.ts | 4 ++-- 4 files changed, 32 insertions(+), 7 deletions(-) create mode 100644 shared/models/activitypub/objects/cache-file-object.ts (limited to 'shared/models/activitypub/objects') diff --git a/shared/models/activitypub/objects/cache-file-object.ts b/shared/models/activitypub/objects/cache-file-object.ts new file mode 100644 index 000000000..0a5125f5b --- /dev/null +++ b/shared/models/activitypub/objects/cache-file-object.ts @@ -0,0 +1,9 @@ +import { ActivityVideoUrlObject } from './common-objects' + +export interface CacheFileObject { + id: string + type: 'CacheFile', + object: string + expires: string + url: ActivityVideoUrlObject +} diff --git a/shared/models/activitypub/objects/common-objects.ts b/shared/models/activitypub/objects/common-objects.ts index ff2cfdbb4..1de60da94 100644 --- a/shared/models/activitypub/objects/common-objects.ts +++ b/shared/models/activitypub/objects/common-objects.ts @@ -17,16 +17,31 @@ export interface ActivityIconObject { height: number } -export interface ActivityUrlObject { +export type ActivityVideoUrlObject = { type: 'Link' - mimeType: 'video/mp4' | 'video/webm' | 'application/x-bittorrent' | 'application/x-bittorrent;x-scheme-handler/magnet' + mimeType: 'video/mp4' | 'video/webm' | 'video/ogg' href: string height: number - - size?: number - fps?: number + size: number + fps: number } +export type ActivityUrlObject = + ActivityVideoUrlObject + | + { + type: 'Link' + mimeType: 'application/x-bittorrent' | 'application/x-bittorrent;x-scheme-handler/magnet' + href: string + height: number + } + | + { + type: 'Link' + mimeType: 'text/html' + href: string + } + export interface ActivityPubAttributedTo { type: 'Group' | 'Person' id: string diff --git a/shared/models/activitypub/objects/index.ts b/shared/models/activitypub/objects/index.ts index 3efd3ef13..fba61e12f 100644 --- a/shared/models/activitypub/objects/index.ts +++ b/shared/models/activitypub/objects/index.ts @@ -1,3 +1,4 @@ +export * from './cache-file-object' export * from './common-objects' export * from './video-abuse-object' export * from './video-torrent-object' diff --git a/shared/models/activitypub/objects/video-torrent-object.ts b/shared/models/activitypub/objects/video-torrent-object.ts index 90de8967b..8504c178f 100644 --- a/shared/models/activitypub/objects/video-torrent-object.ts +++ b/shared/models/activitypub/objects/video-torrent-object.ts @@ -1,10 +1,10 @@ import { ActivityIconObject, - ActivityIdentifierObject, ActivityPubAttributedTo, + ActivityIdentifierObject, + ActivityPubAttributedTo, ActivityTagObject, ActivityUrlObject } from './common-objects' -import { ActivityPubOrderedCollection } from '../activitypub-ordered-collection' import { VideoState } from '../../videos' export interface VideoTorrentObject { -- cgit v1.2.3