aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-share-modal
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared/shared-share-modal')
-rw-r--r--client/src/app/shared/shared-share-modal/video-share.component.html11
-rw-r--r--client/src/app/shared/shared-share-modal/video-share.component.ts38
2 files changed, 39 insertions, 10 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 e5cee1b2f..a0a593a24 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
@@ -218,8 +218,15 @@
218 218
219 <div class="form-group"> 219 <div class="form-group">
220 <my-peertube-checkbox 220 <my-peertube-checkbox
221 inputName="embedP2P" [(ngModel)]="customizations.embedP2P"
222 i18n-labelText labelText="P2P"
223 ></my-peertube-checkbox>
224 </div>
225
226 <div class="form-group">
227 <my-peertube-checkbox
221 inputName="warningTitle" [(ngModel)]="customizations.warningTitle" 228 inputName="warningTitle" [(ngModel)]="customizations.warningTitle"
222 i18n-labelText labelText="Display privacy warning" 229 i18n-labelText labelText="Display privacy warning" [disabled]="!customizations.embedP2P"
223 ></my-peertube-checkbox> 230 ></my-peertube-checkbox>
224 </div> 231 </div>
225 232
@@ -232,7 +239,7 @@
232 239
233 <div class="form-group"> 240 <div class="form-group">
234 <my-peertube-checkbox 241 <my-peertube-checkbox
235 inputName="controls" [(ngModel)]="customizations.peertubeLink" 242 inputName="peertubeLink" [(ngModel)]="customizations.peertubeLink"
236 i18n-labelText labelText="Display PeerTube button link" 243 i18n-labelText labelText="Display PeerTube button link"
237 ></my-peertube-checkbox> 244 ></my-peertube-checkbox>
238 </div> 245 </div>
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 d59f338c7..36a4d7520 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
@@ -1,5 +1,6 @@
1import { Component, ElementRef, Input, ViewChild } from '@angular/core' 1import { Component, ElementRef, Input, ViewChild } from '@angular/core'
2import { DomSanitizer, SafeHtml } from '@angular/platform-browser' 2import { DomSanitizer, SafeHtml } from '@angular/platform-browser'
3import { ServerService } from '@app/core'
3import { VideoDetails } from '@app/shared/shared-main' 4import { VideoDetails } from '@app/shared/shared-main'
4import { VideoPlaylist } from '@app/shared/shared-video-playlist' 5import { VideoPlaylist } from '@app/shared/shared-video-playlist'
5import { NgbModal } from '@ng-bootstrap/ng-bootstrap' 6import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
@@ -21,6 +22,8 @@ type Customizations = {
21 originUrl: boolean 22 originUrl: boolean
22 autoplay: boolean 23 autoplay: boolean
23 muted: boolean 24 muted: boolean
25
26 embedP2P: boolean
24 title: boolean 27 title: boolean
25 warningTitle: boolean 28 warningTitle: boolean
26 controls: boolean 29 controls: boolean
@@ -54,7 +57,8 @@ export class VideoShareComponent {
54 57
55 constructor ( 58 constructor (
56 private modalService: NgbModal, 59 private modalService: NgbModal,
57 private sanitizer: DomSanitizer 60 private sanitizer: DomSanitizer,
61 private server: ServerService
58 ) { } 62 ) { }
59 63
60 show (currentVideoTimestamp?: number, currentPlaylistPosition?: number) { 64 show (currentVideoTimestamp?: number, currentPlaylistPosition?: number) {
@@ -78,6 +82,8 @@ export class VideoShareComponent {
78 autoplay: false, 82 autoplay: false,
79 muted: false, 83 muted: false,
80 84
85 embedP2P: this.server.getHTMLConfig().defaults.p2p.embed.enabled,
86
81 // Embed options 87 // Embed options
82 title: true, 88 title: true,
83 warningTitle: true, 89 warningTitle: true,
@@ -87,6 +93,11 @@ export class VideoShareComponent {
87 set: (target, prop, value) => { 93 set: (target, prop, value) => {
88 target[prop] = value 94 target[prop] = value
89 95
96 if (prop === 'embedP2P') {
97 // Auto enabled warning title if P2P is enabled
98 this.customizations.warningTitle = value
99 }
100
90 this.updateEmbedCode() 101 this.updateEmbedCode()
91 102
92 return true 103 return true
@@ -101,7 +112,7 @@ export class VideoShareComponent {
101 } 112 }
102 113
103 getVideoIframeCode () { 114 getVideoIframeCode () {
104 const embedUrl = decorateVideoLink({ url: this.video.embedUrl, ...this.getVideoOptions() }) 115 const embedUrl = decorateVideoLink({ url: this.video.embedUrl, ...this.getVideoOptions(true) })
105 116
106 return buildVideoOrPlaylistEmbed(embedUrl, this.video.name) 117 return buildVideoOrPlaylistEmbed(embedUrl, this.video.name)
107 } 118 }
@@ -120,7 +131,7 @@ export class VideoShareComponent {
120 return decorateVideoLink({ 131 return decorateVideoLink({
121 url, 132 url,
122 133
123 ...this.getVideoOptions() 134 ...this.getVideoOptions(false)
124 }) 135 })
125 } 136 }
126 137
@@ -165,7 +176,21 @@ export class VideoShareComponent {
165 } 176 }
166 } 177 }
167 178
168 private getVideoOptions () { 179 private getVideoOptions (forEmbed: boolean) {
180 const embedOptions = forEmbed
181 ? {
182 title: this.customizations.title,
183 warningTitle: this.customizations.warningTitle,
184 controls: this.customizations.controls,
185 peertubeLink: this.customizations.peertubeLink,
186
187 // If using default value, we don't need to specify it
188 p2p: this.customizations.embedP2P === this.server.getHTMLConfig().defaults.p2p.embed.enabled
189 ? undefined
190 : this.customizations.embedP2P
191 }
192 : {}
193
169 return { 194 return {
170 startTime: this.customizations.startAtCheckbox ? this.customizations.startAt : undefined, 195 startTime: this.customizations.startAtCheckbox ? this.customizations.startAt : undefined,
171 stopTime: this.customizations.stopAtCheckbox ? this.customizations.stopAt : undefined, 196 stopTime: this.customizations.stopAtCheckbox ? this.customizations.stopAt : undefined,
@@ -176,10 +201,7 @@ export class VideoShareComponent {
176 autoplay: this.customizations.autoplay, 201 autoplay: this.customizations.autoplay,
177 muted: this.customizations.muted, 202 muted: this.customizations.muted,
178 203
179 title: this.customizations.title, 204 ...embedOptions
180 warningTitle: this.customizations.warningTitle,
181 controls: this.customizations.controls,
182 peertubeLink: this.customizations.peertubeLink
183 } 205 }
184 } 206 }
185} 207}