diff options
Diffstat (limited to 'client/src')
4 files changed, 44 insertions, 14 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 @@ | |||
1 | import { Component, ElementRef, Input, ViewChild } from '@angular/core' | 1 | import { Component, ElementRef, Input, ViewChild } from '@angular/core' |
2 | import { DomSanitizer, SafeHtml } from '@angular/platform-browser' | 2 | import { DomSanitizer, SafeHtml } from '@angular/platform-browser' |
3 | import { ServerService } from '@app/core' | ||
3 | import { VideoDetails } from '@app/shared/shared-main' | 4 | import { VideoDetails } from '@app/shared/shared-main' |
4 | import { VideoPlaylist } from '@app/shared/shared-video-playlist' | 5 | import { VideoPlaylist } from '@app/shared/shared-video-playlist' |
5 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' | 6 | import { 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 | } |
diff --git a/client/src/assets/player/stats/stats-card.ts b/client/src/assets/player/stats/stats-card.ts index 55d850eda..e76a81a74 100644 --- a/client/src/assets/player/stats/stats-card.ts +++ b/client/src/assets/player/stats/stats-card.ts | |||
@@ -34,7 +34,6 @@ class StatsCard extends Component { | |||
34 | updateInterval: any | 34 | updateInterval: any |
35 | 35 | ||
36 | mode: 'webtorrent' | 'p2p-media-loader' | 36 | mode: 'webtorrent' | 'p2p-media-loader' |
37 | p2pEnabled: boolean | ||
38 | 37 | ||
39 | metadataStore: any = {} | 38 | metadataStore: any = {} |
40 | 39 | ||
@@ -211,7 +210,7 @@ class StatsCard extends Component { | |||
211 | 210 | ||
212 | return ` | 211 | return ` |
213 | ${this.buildElement(player.localize('Player mode'), this.mode || 'HTTP')} | 212 | ${this.buildElement(player.localize('Player mode'), this.mode || 'HTTP')} |
214 | ${this.buildElement(player.localize('P2P'), player.localize(this.p2pEnabled ? 'enabled' : 'disabled'))} | 213 | ${this.buildElement(player.localize('P2P'), player.localize(this.options_.p2pEnabled ? 'enabled' : 'disabled'))} |
215 | 214 | ||
216 | ${this.buildElement(player.localize('Video UUID'), this.options_.videoUUID)} | 215 | ${this.buildElement(player.localize('Video UUID'), this.options_.videoUUID)} |
217 | 216 | ||
diff --git a/client/src/standalone/videos/embed.ts b/client/src/standalone/videos/embed.ts index c04f94d20..eb8076b98 100644 --- a/client/src/standalone/videos/embed.ts +++ b/client/src/standalone/videos/embed.ts | |||
@@ -45,6 +45,7 @@ export class PeerTubeEmbed { | |||
45 | title: boolean | 45 | title: boolean |
46 | warningTitle: boolean | 46 | warningTitle: boolean |
47 | peertubeLink: boolean | 47 | peertubeLink: boolean |
48 | p2pEnabled: boolean | ||
48 | bigPlayBackgroundColor: string | 49 | bigPlayBackgroundColor: string |
49 | foregroundColor: string | 50 | foregroundColor: string |
50 | 51 | ||
@@ -284,6 +285,7 @@ export class PeerTubeEmbed { | |||
284 | this.enableApi = this.getParamToggle(params, 'api', this.enableApi) | 285 | this.enableApi = this.getParamToggle(params, 'api', this.enableApi) |
285 | this.warningTitle = this.getParamToggle(params, 'warningTitle', true) | 286 | this.warningTitle = this.getParamToggle(params, 'warningTitle', true) |
286 | this.peertubeLink = this.getParamToggle(params, 'peertubeLink', true) | 287 | this.peertubeLink = this.getParamToggle(params, 'peertubeLink', true) |
288 | this.p2pEnabled = this.getParamToggle(params, 'p2p', this.isP2PEnabled(video)) | ||
287 | 289 | ||
288 | this.scope = this.getParamString(params, 'scope', this.scope) | 290 | this.scope = this.getParamString(params, 'scope', this.scope) |
289 | this.subtitle = this.getParamString(params, 'subtitle') | 291 | this.subtitle = this.getParamString(params, 'subtitle') |
@@ -518,7 +520,7 @@ export class PeerTubeEmbed { | |||
518 | muted: this.muted, | 520 | muted: this.muted, |
519 | loop: this.loop, | 521 | loop: this.loop, |
520 | 522 | ||
521 | p2pEnabled: this.isP2PEnabled(videoInfo), | 523 | p2pEnabled: this.p2pEnabled, |
522 | 524 | ||
523 | captions: videoCaptions.length !== 0, | 525 | captions: videoCaptions.length !== 0, |
524 | subtitle: this.subtitle, | 526 | subtitle: this.subtitle, |
@@ -674,7 +676,7 @@ export class PeerTubeEmbed { | |||
674 | 676 | ||
675 | const title = this.title ? videoInfo.name : undefined | 677 | const title = this.title ? videoInfo.name : undefined |
676 | 678 | ||
677 | const description = this.warningTitle && this.isP2PEnabled(videoInfo) | 679 | const description = this.warningTitle && this.p2pEnabled |
678 | ? '<span class="text">' + peertubeTranslate('Watching this video may reveal your IP address to others.') + '</span>' | 680 | ? '<span class="text">' + peertubeTranslate('Watching this video may reveal your IP address to others.') + '</span>' |
679 | : undefined | 681 | : undefined |
680 | 682 | ||