mirror of https://github.com/Chocobozzz/PeerTube
Provide origin URL to client and fix remote share
parent
de7f11143f
commit
ab4001aade
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
<a
|
<a
|
||||||
i18n-title title="Open the video on the origin instance" class="glyphicon glyphicon-new-window"
|
i18n-title title="Open the video on the origin instance" class="glyphicon glyphicon-new-window"
|
||||||
target="_blank" rel="noopener noreferrer" [href]="getVideoUrl()"
|
target="_blank" rel="noopener noreferrer" [href]="video.url"
|
||||||
></a>
|
></a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -9,14 +9,6 @@ import { VideoDetails } from '@app/shared/shared-main'
|
||||||
export class VideoAttributesComponent {
|
export class VideoAttributesComponent {
|
||||||
@Input() video: VideoDetails
|
@Input() video: VideoDetails
|
||||||
|
|
||||||
getVideoUrl () {
|
|
||||||
if (!this.video.url) {
|
|
||||||
return this.video.originInstanceUrl + VideoDetails.buildWatchUrl(this.video)
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.video.url
|
|
||||||
}
|
|
||||||
|
|
||||||
getVideoHost () {
|
getVideoHost () {
|
||||||
return this.video.channel.host
|
return this.video.channel.host
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ export class Video implements VideoServerModel {
|
||||||
embedPath: string
|
embedPath: string
|
||||||
embedUrl: string
|
embedUrl: string
|
||||||
|
|
||||||
url?: string
|
url: string
|
||||||
|
|
||||||
views: number
|
views: number
|
||||||
likes: number
|
likes: number
|
||||||
|
|
|
@ -96,12 +96,12 @@ export class VideoShareComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
getVideoUrl () {
|
getVideoUrl () {
|
||||||
const baseUrl = this.customizations.originUrl
|
const url = this.customizations.originUrl
|
||||||
? this.video.originInstanceUrl
|
? this.video.url
|
||||||
: window.location.origin
|
: buildVideoLink(this.video, window.location.origin)
|
||||||
|
|
||||||
return decorateVideoLink({
|
return decorateVideoLink({
|
||||||
url: buildVideoLink(this.video, baseUrl),
|
url,
|
||||||
|
|
||||||
...this.getVideoOptions()
|
...this.getVideoOptions()
|
||||||
})
|
})
|
||||||
|
|
|
@ -50,6 +50,8 @@ function videoModelToFormattedJSON (video: MVideoFormattable, options?: VideoFor
|
||||||
uuid: video.uuid,
|
uuid: video.uuid,
|
||||||
shortUUID: uuidToShort(video.uuid),
|
shortUUID: uuidToShort(video.uuid),
|
||||||
|
|
||||||
|
url: video.url,
|
||||||
|
|
||||||
name: video.name,
|
name: video.name,
|
||||||
category: {
|
category: {
|
||||||
id: video.category,
|
id: video.category,
|
||||||
|
|
|
@ -113,7 +113,7 @@ async function completeVideoCheck (
|
||||||
channel: {
|
channel: {
|
||||||
displayName: string
|
displayName: string
|
||||||
name: string
|
name: string
|
||||||
description
|
description: string
|
||||||
isLocal: boolean
|
isLocal: boolean
|
||||||
}
|
}
|
||||||
fixture: string
|
fixture: string
|
||||||
|
@ -151,6 +151,7 @@ async function completeVideoCheck (
|
||||||
expect(video.dislikes).to.equal(attributes.dislikes)
|
expect(video.dislikes).to.equal(attributes.dislikes)
|
||||||
expect(video.isLocal).to.equal(attributes.isLocal)
|
expect(video.isLocal).to.equal(attributes.isLocal)
|
||||||
expect(video.duration).to.equal(attributes.duration)
|
expect(video.duration).to.equal(attributes.duration)
|
||||||
|
expect(video.url).to.contain(originHost)
|
||||||
expect(dateIsValid(video.createdAt)).to.be.true
|
expect(dateIsValid(video.createdAt)).to.be.true
|
||||||
expect(dateIsValid(video.publishedAt)).to.be.true
|
expect(dateIsValid(video.publishedAt)).to.be.true
|
||||||
expect(dateIsValid(video.updatedAt)).to.be.true
|
expect(dateIsValid(video.updatedAt)).to.be.true
|
||||||
|
|
|
@ -36,8 +36,7 @@ export interface Video {
|
||||||
embedPath: string
|
embedPath: string
|
||||||
embedUrl?: string
|
embedUrl?: string
|
||||||
|
|
||||||
// When using the search index
|
url: string
|
||||||
url?: string
|
|
||||||
|
|
||||||
views: number
|
views: number
|
||||||
likes: number
|
likes: number
|
||||||
|
|
Loading…
Reference in New Issue