From a15871560f80e07386c1dabb8370cd2664ecfd1f Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 31 Jan 2020 16:56:52 +0100 Subject: Move to eslint --- shared/models/activitypub/activity.ts | 43 ++++++++++++++++------ shared/models/activitypub/activitypub-actor.ts | 8 +--- shared/models/activitypub/activitypub-signature.ts | 4 +- .../activitypub/objects/cache-file-object.ts | 2 +- .../models/activitypub/objects/common-objects.ts | 32 ++++++++-------- .../activitypub/objects/video-abuse-object.ts | 2 +- .../activitypub/objects/video-torrent-object.ts | 4 +- shared/models/activitypub/objects/view-object.ts | 2 +- 8 files changed, 58 insertions(+), 39 deletions(-) (limited to 'shared/models/activitypub') diff --git a/shared/models/activitypub/activity.ts b/shared/models/activitypub/activity.ts index 492b672c7..20ecf176c 100644 --- a/shared/models/activitypub/activity.ts +++ b/shared/models/activitypub/activity.ts @@ -8,12 +8,33 @@ import { ViewObject } from './objects/view-object' import { APObject } from './objects/object.model' import { PlaylistObject } from './objects/playlist-object' -export type Activity = ActivityCreate | ActivityUpdate | - ActivityDelete | ActivityFollow | ActivityAccept | ActivityAnnounce | - ActivityUndo | ActivityLike | ActivityReject | ActivityView | ActivityDislike | ActivityFlag - -export type ActivityType = 'Create' | 'Update' | 'Delete' | 'Follow' | 'Accept' | 'Announce' | 'Undo' | 'Like' | 'Reject' | - 'View' | 'Dislike' | 'Flag' +export type Activity = + ActivityCreate | + ActivityUpdate | + ActivityDelete | + ActivityFollow | + ActivityAccept | + ActivityAnnounce | + ActivityUndo | + ActivityLike | + ActivityReject | + ActivityView | + ActivityDislike | + ActivityFlag + +export type ActivityType = + 'Create' | + 'Update' | + 'Delete' | + 'Follow' | + 'Accept' | + 'Announce' | + 'Undo' | + 'Like' | + 'Reject' | + 'View' | + 'Dislike' | + 'Flag' export interface ActivityAudience { to: string[] @@ -66,17 +87,17 @@ export interface ActivityAnnounce extends BaseActivity { } export interface ActivityUndo extends BaseActivity { - type: 'Undo', + type: 'Undo' object: ActivityFollow | ActivityLike | ActivityDislike | ActivityCreate | ActivityAnnounce } export interface ActivityLike extends BaseActivity { - type: 'Like', + type: 'Like' object: APObject } export interface ActivityView extends BaseActivity { - type: 'View', + type: 'View' actor: string object: APObject } @@ -89,7 +110,7 @@ export interface ActivityDislike extends BaseActivity { } export interface ActivityFlag extends BaseActivity { - type: 'Flag', - content: string, + type: 'Flag' + content: string object: APObject | APObject[] } diff --git a/shared/models/activitypub/activitypub-actor.ts b/shared/models/activitypub/activitypub-actor.ts index b8a2dc925..f022f3d02 100644 --- a/shared/models/activitypub/activitypub-actor.ts +++ b/shared/models/activitypub/activitypub-actor.ts @@ -1,4 +1,4 @@ -import { ActivityPubAttributedTo } from './objects/common-objects' +import { ActivityIconObject, ActivityPubAttributedTo } from './objects/common-objects' export type ActivityPubActorType = 'Person' | 'Application' | 'Group' | 'Service' | 'Organization' @@ -27,9 +27,5 @@ export interface ActivityPubActor { publicKeyPem: string } - icon: { - type: 'Image' - mediaType: 'image/png' - url: string - } + icon: ActivityIconObject } diff --git a/shared/models/activitypub/activitypub-signature.ts b/shared/models/activitypub/activitypub-signature.ts index 1d9f4b3b3..fafdc246d 100644 --- a/shared/models/activitypub/activitypub-signature.ts +++ b/shared/models/activitypub/activitypub-signature.ts @@ -1,6 +1,6 @@ export interface ActivityPubSignature { - type: 'GraphSignature2012' - created: Date, + type: string + created: Date creator: string signatureValue: string } diff --git a/shared/models/activitypub/objects/cache-file-object.ts b/shared/models/activitypub/objects/cache-file-object.ts index 4b0a3a724..19a817582 100644 --- a/shared/models/activitypub/objects/cache-file-object.ts +++ b/shared/models/activitypub/objects/cache-file-object.ts @@ -2,7 +2,7 @@ import { ActivityVideoUrlObject, ActivityPlaylistUrlObject } from './common-obje export interface CacheFileObject { id: string - type: 'CacheFile', + type: 'CacheFile' object: string expires: string url: ActivityVideoUrlObject | ActivityPlaylistUrlObject diff --git a/shared/models/activitypub/objects/common-objects.ts b/shared/models/activitypub/objects/common-objects.ts index bab3ce366..e94d05429 100644 --- a/shared/models/activitypub/objects/common-objects.ts +++ b/shared/models/activitypub/objects/common-objects.ts @@ -7,9 +7,9 @@ export interface ActivityIdentifierObject { export interface ActivityIconObject { type: 'Image' url: string - mediaType: 'image/jpeg' - width: number - height: number + mediaType: 'image/jpeg' | 'image/png' + width?: number + height?: number } export type ActivityVideoUrlObject = { @@ -72,19 +72,21 @@ export interface ActivityMentionObject { name: string } -export type ActivityTagObject = ActivityPlaylistSegmentHashesObject | - ActivityPlaylistInfohashesObject | - ActivityVideoUrlObject | - ActivityHashTagObject | - ActivityMentionObject | - ActivityBitTorrentUrlObject | - ActivityMagnetUrlObject +export type ActivityTagObject = + ActivityPlaylistSegmentHashesObject + | ActivityPlaylistInfohashesObject + | ActivityVideoUrlObject + | ActivityHashTagObject + | ActivityMentionObject + | ActivityBitTorrentUrlObject + | ActivityMagnetUrlObject -export type ActivityUrlObject = ActivityVideoUrlObject | - ActivityPlaylistUrlObject | - ActivityBitTorrentUrlObject | - ActivityMagnetUrlObject | - ActivityHtmlUrlObject +export type ActivityUrlObject = + ActivityVideoUrlObject + | ActivityPlaylistUrlObject + | ActivityBitTorrentUrlObject + | ActivityMagnetUrlObject + | ActivityHtmlUrlObject export interface ActivityPubAttributedTo { type: 'Group' | 'Person' diff --git a/shared/models/activitypub/objects/video-abuse-object.ts b/shared/models/activitypub/objects/video-abuse-object.ts index 5f1264a76..d9622b414 100644 --- a/shared/models/activitypub/objects/video-abuse-object.ts +++ b/shared/models/activitypub/objects/video-abuse-object.ts @@ -1,5 +1,5 @@ export interface VideoAbuseObject { - type: 'Flag', + type: 'Flag' content: string object: string | string[] } diff --git a/shared/models/activitypub/objects/video-torrent-object.ts b/shared/models/activitypub/objects/video-torrent-object.ts index cadd0ea49..11de8fc56 100644 --- a/shared/models/activitypub/objects/video-torrent-object.ts +++ b/shared/models/activitypub/objects/video-torrent-object.ts @@ -20,8 +20,8 @@ export interface VideoTorrentObject { subtitleLanguage: ActivityIdentifierObject[] views: number sensitive: boolean - commentsEnabled: boolean, - downloadEnabled: boolean, + commentsEnabled: boolean + downloadEnabled: boolean waitTranscoding: boolean state: VideoState published: string diff --git a/shared/models/activitypub/objects/view-object.ts b/shared/models/activitypub/objects/view-object.ts index 00348116a..4dd21ce8e 100644 --- a/shared/models/activitypub/objects/view-object.ts +++ b/shared/models/activitypub/objects/view-object.ts @@ -1,5 +1,5 @@ export interface ViewObject { - type: 'View', + type: 'View' actor: string object: string } -- cgit v1.2.3