1
0
Fork 0

Add possibility to share origin URL to video if it's not local

It's very difficult to share the original URL for a video when you watch it on your
own instance while it's not from it but from a different instance. Right now when
you use the share UI you only can share a link so a person can watch it on your
own instance, this patch adds a checkbox to the share UI to share the origin URL
instead if needed.
This commit is contained in:
Jeena 2020-10-18 03:16:41 +02:00 committed by Chocobozzz
parent 44fb529740
commit dd1e2f2f96
2 changed files with 15 additions and 1 deletions

View file

@ -173,6 +173,13 @@
i18n-labelText labelText="Loop" i18n-labelText labelText="Loop"
></my-peertube-checkbox> ></my-peertube-checkbox>
</div> </div>
<div *ngIf="!isLocalVideo() && !isVideoInEmbedTab()" class="form-group">
<my-peertube-checkbox
inputName="originUrl" [(ngModel)]="customizations.originUrl"
i18n-labelText labelText="Use origin instance URL"
></my-peertube-checkbox>
</div>
</div> </div>
<ng-container *ngIf="isVideoInEmbedTab()"> <ng-container *ngIf="isVideoInEmbedTab()">

View file

@ -16,6 +16,7 @@ type Customizations = {
subtitle: string subtitle: string
loop: boolean loop: boolean
originUrl: boolean
autoplay: boolean autoplay: boolean
muted: boolean muted: boolean
title: boolean title: boolean
@ -65,6 +66,7 @@ export class VideoShareComponent {
subtitle, subtitle,
loop: false, loop: false,
originUrl: false,
autoplay: false, autoplay: false,
muted: false, muted: false,
@ -95,7 +97,8 @@ export class VideoShareComponent {
} }
getVideoUrl () { getVideoUrl () {
const baseUrl = window.location.origin + '/videos/watch/' + this.video.uuid let baseUrl = this.customizations.originUrl ? this.video.originInstanceUrl : window.location.origin
baseUrl += '/videos/watch/' + this.video.uuid
const options = this.getVideoOptions(baseUrl) const options = this.getVideoOptions(baseUrl)
return buildVideoLink(options) return buildVideoLink(options)
@ -117,6 +120,10 @@ export class VideoShareComponent {
return this.activeVideoId === 'embed' return this.activeVideoId === 'embed'
} }
isLocalVideo () {
return this.video.isLocal
}
private getPlaylistOptions (baseUrl?: string) { private getPlaylistOptions (baseUrl?: string) {
return { return {
baseUrl, baseUrl,