aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-10-22 14:11:58 +0200
committerChocobozzz <me@florianbigard.com>2021-10-22 14:11:58 +0200
commitab4001aade0891b70e456a215ced0f825c57fde8 (patch)
tree1690f4eecdef3f9a41c6b330852995774638eb23
parentde7f11143f6d8a617f1eb15d536a3486e7e22301 (diff)
downloadPeerTube-ab4001aade0891b70e456a215ced0f825c57fde8.tar.gz
PeerTube-ab4001aade0891b70e456a215ced0f825c57fde8.tar.zst
PeerTube-ab4001aade0891b70e456a215ced0f825c57fde8.zip
Provide origin URL to client and fix remote share
-rw-r--r--client/src/app/+videos/+video-watch/shared/metadata/video-attributes.component.html2
-rw-r--r--client/src/app/+videos/+video-watch/shared/metadata/video-attributes.component.ts8
-rw-r--r--client/src/app/shared/shared-main/video/video.model.ts2
-rw-r--r--client/src/app/shared/shared-share-modal/video-share.component.ts8
-rw-r--r--server/models/video/formatter/video-format-utils.ts2
-rw-r--r--shared/extra-utils/videos/videos.ts3
-rw-r--r--shared/models/videos/video.model.ts3
7 files changed, 11 insertions, 17 deletions
diff --git a/client/src/app/+videos/+video-watch/shared/metadata/video-attributes.component.html b/client/src/app/+videos/+video-watch/shared/metadata/video-attributes.component.html
index 362a21905..d65c9356a 100644
--- a/client/src/app/+videos/+video-watch/shared/metadata/video-attributes.component.html
+++ b/client/src/app/+videos/+video-watch/shared/metadata/video-attributes.component.html
@@ -12,7 +12,7 @@
12 12
13 <a 13 <a
14 i18n-title title="Open the video on the origin instance" class="glyphicon glyphicon-new-window" 14 i18n-title title="Open the video on the origin instance" class="glyphicon glyphicon-new-window"
15 target="_blank" rel="noopener noreferrer" [href]="getVideoUrl()" 15 target="_blank" rel="noopener noreferrer" [href]="video.url"
16 ></a> 16 ></a>
17</div> 17</div>
18 18
diff --git a/client/src/app/+videos/+video-watch/shared/metadata/video-attributes.component.ts b/client/src/app/+videos/+video-watch/shared/metadata/video-attributes.component.ts
index 9429581ac..b8f564c4c 100644
--- a/client/src/app/+videos/+video-watch/shared/metadata/video-attributes.component.ts
+++ b/client/src/app/+videos/+video-watch/shared/metadata/video-attributes.component.ts
@@ -9,14 +9,6 @@ import { VideoDetails } from '@app/shared/shared-main'
9export class VideoAttributesComponent { 9export class VideoAttributesComponent {
10 @Input() video: VideoDetails 10 @Input() video: VideoDetails
11 11
12 getVideoUrl () {
13 if (!this.video.url) {
14 return this.video.originInstanceUrl + VideoDetails.buildWatchUrl(this.video)
15 }
16
17 return this.video.url
18 }
19
20 getVideoHost () { 12 getVideoHost () {
21 return this.video.channel.host 13 return this.video.channel.host
22 } 14 }
diff --git a/client/src/app/shared/shared-main/video/video.model.ts b/client/src/app/shared/shared-main/video/video.model.ts
index 7471a933b..10caec014 100644
--- a/client/src/app/shared/shared-main/video/video.model.ts
+++ b/client/src/app/shared/shared-main/video/video.model.ts
@@ -52,7 +52,7 @@ export class Video implements VideoServerModel {
52 embedPath: string 52 embedPath: string
53 embedUrl: string 53 embedUrl: string
54 54
55 url?: string 55 url: string
56 56
57 views: number 57 views: number
58 likes: number 58 likes: number
diff --git a/client/src/app/shared/shared-share-modal/video-share.component.ts b/client/src/app/shared/shared-share-modal/video-share.component.ts
index 341abdc2b..70890e551 100644
--- a/client/src/app/shared/shared-share-modal/video-share.component.ts
+++ b/client/src/app/shared/shared-share-modal/video-share.component.ts
@@ -96,12 +96,12 @@ export class VideoShareComponent {
96 } 96 }
97 97
98 getVideoUrl () { 98 getVideoUrl () {
99 const baseUrl = this.customizations.originUrl 99 const url = this.customizations.originUrl
100 ? this.video.originInstanceUrl 100 ? this.video.url
101 : window.location.origin 101 : buildVideoLink(this.video, window.location.origin)
102 102
103 return decorateVideoLink({ 103 return decorateVideoLink({
104 url: buildVideoLink(this.video, baseUrl), 104 url,
105 105
106 ...this.getVideoOptions() 106 ...this.getVideoOptions()
107 }) 107 })
diff --git a/server/models/video/formatter/video-format-utils.ts b/server/models/video/formatter/video-format-utils.ts
index b3c4f390d..0cbad5684 100644
--- a/server/models/video/formatter/video-format-utils.ts
+++ b/server/models/video/formatter/video-format-utils.ts
@@ -50,6 +50,8 @@ function videoModelToFormattedJSON (video: MVideoFormattable, options?: VideoFor
50 uuid: video.uuid, 50 uuid: video.uuid,
51 shortUUID: uuidToShort(video.uuid), 51 shortUUID: uuidToShort(video.uuid),
52 52
53 url: video.url,
54
53 name: video.name, 55 name: video.name,
54 category: { 56 category: {
55 id: video.category, 57 id: video.category,
diff --git a/shared/extra-utils/videos/videos.ts b/shared/extra-utils/videos/videos.ts
index a1d2ba0fc..4d2784dde 100644
--- a/shared/extra-utils/videos/videos.ts
+++ b/shared/extra-utils/videos/videos.ts
@@ -113,7 +113,7 @@ async function completeVideoCheck (
113 channel: { 113 channel: {
114 displayName: string 114 displayName: string
115 name: string 115 name: string
116 description 116 description: string
117 isLocal: boolean 117 isLocal: boolean
118 } 118 }
119 fixture: string 119 fixture: string
@@ -151,6 +151,7 @@ async function completeVideoCheck (
151 expect(video.dislikes).to.equal(attributes.dislikes) 151 expect(video.dislikes).to.equal(attributes.dislikes)
152 expect(video.isLocal).to.equal(attributes.isLocal) 152 expect(video.isLocal).to.equal(attributes.isLocal)
153 expect(video.duration).to.equal(attributes.duration) 153 expect(video.duration).to.equal(attributes.duration)
154 expect(video.url).to.contain(originHost)
154 expect(dateIsValid(video.createdAt)).to.be.true 155 expect(dateIsValid(video.createdAt)).to.be.true
155 expect(dateIsValid(video.publishedAt)).to.be.true 156 expect(dateIsValid(video.publishedAt)).to.be.true
156 expect(dateIsValid(video.updatedAt)).to.be.true 157 expect(dateIsValid(video.updatedAt)).to.be.true
diff --git a/shared/models/videos/video.model.ts b/shared/models/videos/video.model.ts
index 0e3e89f43..4a7e399a2 100644
--- a/shared/models/videos/video.model.ts
+++ b/shared/models/videos/video.model.ts
@@ -36,8 +36,7 @@ export interface Video {
36 embedPath: string 36 embedPath: string
37 embedUrl?: string 37 embedUrl?: string
38 38
39 // When using the search index 39 url: string
40 url?: string
41 40
42 views: number 41 views: number
43 likes: number 42 likes: number