AP mimeType -> mediaType
[oweals/peertube.git] / shared / models / activitypub / objects / common-objects.ts
index 5b2b3adaedb19f455635742c6aab529e50400e1f..118a4f43dafd6728bdcff98916f391c4d1f7bb31 100644 (file)
@@ -17,16 +17,37 @@ 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'
+  // TODO: remove mimeType (backward compatibility, introduced in v1.1.0)
+  mimeType?: 'video/mp4' | 'video/webm' | 'video/ogg'
+  mediaType: 'video/mp4' | 'video/webm' | 'video/ogg'
   href: string
-  width: number
-
-  size?: number
-  fps?: number
+  height: number
+  size: number
+  fps: number
 }
 
+export type ActivityUrlObject =
+  ActivityVideoUrlObject
+  |
+  {
+    type: 'Link'
+    // TODO: remove mimeType (backward compatibility, introduced in v1.1.0)
+    mimeType?: 'application/x-bittorrent' | 'application/x-bittorrent;x-scheme-handler/magnet'
+    mediaType: 'application/x-bittorrent' | 'application/x-bittorrent;x-scheme-handler/magnet'
+    href: string
+    height: number
+  }
+  |
+  {
+    type: 'Link'
+    // TODO: remove mimeType (backward compatibility, introduced in v1.1.0)
+    mimeType?: 'text/html'
+    mediaType: 'text/html'
+    href: string
+  }
+
 export interface ActivityPubAttributedTo {
   type: 'Group' | 'Person'
   id: string