]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/videos/shared/video.model.ts
Use async/await in lib and initializers
[github/Chocobozzz/PeerTube.git] / client / src / app / videos / shared / video.model.ts
index b315e59b184451990927505140fe070d7e14e91e..6e8dfaa6f4c9ef94a8297c2c0ff428b7bba2384b 100644 (file)
@@ -26,6 +26,8 @@ export class Video implements VideoServerModel {
   thumbnailUrl: string
   previewPath: string
   previewUrl: string
+  embedPath: string
+  embedUrl: string
   views: number
   likes: number
   dislikes: number
@@ -64,12 +66,19 @@ export class Video implements VideoServerModel {
     tags: string[],
     thumbnailPath: string,
     previewPath: string,
+    embedPath: string,
     views: number,
     likes: number,
     dislikes: number,
     nsfw: boolean,
     files: VideoFile[]
   }) {
+    let absoluteAPIUrl = API_URL
+    if (!absoluteAPIUrl) {
+      // The API is on the same domain
+      absoluteAPIUrl = window.location.origin
+    }
+
     this.author = hash.author
     this.createdAt = new Date(hash.createdAt.toString())
     this.categoryLabel = hash.categoryLabel
@@ -88,9 +97,11 @@ export class Video implements VideoServerModel {
     this.podHost = hash.podHost
     this.tags = hash.tags
     this.thumbnailPath = hash.thumbnailPath
-    this.thumbnailUrl = API_URL + hash.thumbnailPath
+    this.thumbnailUrl = absoluteAPIUrl + hash.thumbnailPath
     this.previewPath = hash.previewPath
-    this.previewUrl = API_URL + hash.previewPath
+    this.previewUrl = absoluteAPIUrl + hash.previewPath
+    this.embedPath = hash.embedPath
+    this.embedUrl = absoluteAPIUrl + hash.embedPath
     this.views = hash.views
     this.likes = hash.likes
     this.dislikes = hash.dislikes