diff options
author | Jeena <hello@jeena.net> | 2020-10-18 03:16:41 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-10-29 09:06:40 +0100 |
commit | dd1e2f2f96d736dd955fd72cfc041d06249c4a3e (patch) | |
tree | fc785997dbdc291489b10607a389c075eabe4e17 /client/src/app | |
parent | 44fb529740f53d58b386e6024184452aee803236 (diff) | |
download | PeerTube-dd1e2f2f96d736dd955fd72cfc041d06249c4a3e.tar.gz PeerTube-dd1e2f2f96d736dd955fd72cfc041d06249c4a3e.tar.zst PeerTube-dd1e2f2f96d736dd955fd72cfc041d06249c4a3e.zip |
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.
Diffstat (limited to 'client/src/app')
-rw-r--r-- | client/src/app/shared/shared-share-modal/video-share.component.html | 7 | ||||
-rw-r--r-- | client/src/app/shared/shared-share-modal/video-share.component.ts | 9 |
2 files changed, 15 insertions, 1 deletions
diff --git a/client/src/app/shared/shared-share-modal/video-share.component.html b/client/src/app/shared/shared-share-modal/video-share.component.html index 4174458b5..3222dc5a6 100644 --- a/client/src/app/shared/shared-share-modal/video-share.component.html +++ b/client/src/app/shared/shared-share-modal/video-share.component.html | |||
@@ -173,6 +173,13 @@ | |||
173 | i18n-labelText labelText="Loop" | 173 | i18n-labelText labelText="Loop" |
174 | ></my-peertube-checkbox> | 174 | ></my-peertube-checkbox> |
175 | </div> | 175 | </div> |
176 | |||
177 | <div *ngIf="!isLocalVideo() && !isVideoInEmbedTab()" class="form-group"> | ||
178 | <my-peertube-checkbox | ||
179 | inputName="originUrl" [(ngModel)]="customizations.originUrl" | ||
180 | i18n-labelText labelText="Use origin instance URL" | ||
181 | ></my-peertube-checkbox> | ||
182 | </div> | ||
176 | </div> | 183 | </div> |
177 | 184 | ||
178 | <ng-container *ngIf="isVideoInEmbedTab()"> | 185 | <ng-container *ngIf="isVideoInEmbedTab()"> |
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 f57a50770..b06ff3751 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 | |||
@@ -16,6 +16,7 @@ type Customizations = { | |||
16 | subtitle: string | 16 | subtitle: string |
17 | 17 | ||
18 | loop: boolean | 18 | loop: boolean |
19 | originUrl: boolean | ||
19 | autoplay: boolean | 20 | autoplay: boolean |
20 | muted: boolean | 21 | muted: boolean |
21 | title: boolean | 22 | title: boolean |
@@ -65,6 +66,7 @@ export class VideoShareComponent { | |||
65 | subtitle, | 66 | subtitle, |
66 | 67 | ||
67 | loop: false, | 68 | loop: false, |
69 | originUrl: false, | ||
68 | autoplay: false, | 70 | autoplay: false, |
69 | muted: false, | 71 | muted: false, |
70 | 72 | ||
@@ -95,7 +97,8 @@ export class VideoShareComponent { | |||
95 | } | 97 | } |
96 | 98 | ||
97 | getVideoUrl () { | 99 | getVideoUrl () { |
98 | const baseUrl = window.location.origin + '/videos/watch/' + this.video.uuid | 100 | let baseUrl = this.customizations.originUrl ? this.video.originInstanceUrl : window.location.origin |
101 | baseUrl += '/videos/watch/' + this.video.uuid | ||
99 | const options = this.getVideoOptions(baseUrl) | 102 | const options = this.getVideoOptions(baseUrl) |
100 | 103 | ||
101 | return buildVideoLink(options) | 104 | return buildVideoLink(options) |
@@ -117,6 +120,10 @@ export class VideoShareComponent { | |||
117 | return this.activeVideoId === 'embed' | 120 | return this.activeVideoId === 'embed' |
118 | } | 121 | } |
119 | 122 | ||
123 | isLocalVideo () { | ||
124 | return this.video.isLocal | ||
125 | } | ||
126 | |||
120 | private getPlaylistOptions (baseUrl?: string) { | 127 | private getPlaylistOptions (baseUrl?: string) { |
121 | return { | 128 | return { |
122 | baseUrl, | 129 | baseUrl, |