diff options
author | Thavarasa Prasanth <45243326+pthavarasa@users.noreply.github.com> | 2021-03-31 08:32:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-31 08:32:05 +0200 |
commit | 4097c6d66cb2919c28b5bce44b259e630923fbe0 (patch) | |
tree | d57897b0b8762202a0be90388e9a79153690b9d9 /client | |
parent | 47099aba46be7757d833422f1706b99a3c0e28ea (diff) | |
download | PeerTube-4097c6d66cb2919c28b5bce44b259e630923fbe0.tar.gz PeerTube-4097c6d66cb2919c28b5bce44b259e630923fbe0.tar.zst PeerTube-4097c6d66cb2919c28b5bce44b259e630923fbe0.zip |
fix missing title attribute on <iframe> tag suggested for embedding (#3901)
* title attribute is missing on <iframe> tag suggested for embedding #3861
* fix #3901
* fix: escapeHTML #3901
* fix: playlist title instead of video title #3901
* fix #3901
* assign title directly #3901
Diffstat (limited to 'client')
8 files changed, 20 insertions, 11 deletions
diff --git a/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts b/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts index 82c371f4d..d6aca10e7 100644 --- a/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts +++ b/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts | |||
@@ -164,7 +164,8 @@ export class VideoBlockListComponent extends RestTable implements OnInit, AfterV | |||
164 | baseUrl: `${environment.originServerUrl}/videos/embed/${entry.video.uuid}`, | 164 | baseUrl: `${environment.originServerUrl}/videos/embed/${entry.video.uuid}`, |
165 | title: false, | 165 | title: false, |
166 | warningTitle: false | 166 | warningTitle: false |
167 | }) | 167 | }), |
168 | entry.video.name | ||
168 | ) | 169 | ) |
169 | } | 170 | } |
170 | 171 | ||
diff --git a/client/src/app/+videos/+video-watch/video-watch.component.ts b/client/src/app/+videos/+video-watch/video-watch.component.ts index 7a98cab3b..ce115dfab 100644 --- a/client/src/app/+videos/+video-watch/video-watch.component.ts +++ b/client/src/app/+videos/+video-watch/video-watch.component.ts | |||
@@ -815,6 +815,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
815 | ? this.videoService.getVideoViewUrl(video.uuid) | 815 | ? this.videoService.getVideoViewUrl(video.uuid) |
816 | : null, | 816 | : null, |
817 | embedUrl: video.embedUrl, | 817 | embedUrl: video.embedUrl, |
818 | embedTitle: video.name, | ||
818 | 819 | ||
819 | isLive: video.isLive, | 820 | isLive: video.isLive, |
820 | 821 | ||
diff --git a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts index e34836a18..eeb9f128b 100644 --- a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts +++ b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts | |||
@@ -117,7 +117,8 @@ export class AbuseListTableComponent extends RestTable implements OnInit, AfterV | |||
117 | warningTitle: false, | 117 | warningTitle: false, |
118 | startTime: abuse.video.startAt, | 118 | startTime: abuse.video.startAt, |
119 | stopTime: abuse.video.endAt | 119 | stopTime: abuse.video.endAt |
120 | }) | 120 | }), |
121 | abuse.video.name | ||
121 | ) | 122 | ) |
122 | } | 123 | } |
123 | 124 | ||
diff --git a/client/src/app/shared/shared-moderation/report-modals/video-report.component.ts b/client/src/app/shared/shared-moderation/report-modals/video-report.component.ts index 5b06c0bc7..4ca6f52ad 100644 --- a/client/src/app/shared/shared-moderation/report-modals/video-report.component.ts +++ b/client/src/app/shared/shared-moderation/report-modals/video-report.component.ts | |||
@@ -61,7 +61,8 @@ export class VideoReportComponent extends FormReactive implements OnInit { | |||
61 | baseUrl: this.video.embedUrl, | 61 | baseUrl: this.video.embedUrl, |
62 | title: false, | 62 | title: false, |
63 | warningTitle: false | 63 | warningTitle: false |
64 | }) | 64 | }), |
65 | this.video.name | ||
65 | ) | 66 | ) |
66 | ) | 67 | ) |
67 | } | 68 | } |
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 b06ff3751..e8760bfcc 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 | |||
@@ -86,14 +86,14 @@ export class VideoShareComponent { | |||
86 | const options = this.getVideoOptions(this.video.embedUrl) | 86 | const options = this.getVideoOptions(this.video.embedUrl) |
87 | 87 | ||
88 | const embedUrl = buildVideoLink(options) | 88 | const embedUrl = buildVideoLink(options) |
89 | return buildVideoOrPlaylistEmbed(embedUrl) | 89 | return buildVideoOrPlaylistEmbed(embedUrl, this.video.name) |
90 | } | 90 | } |
91 | 91 | ||
92 | getPlaylistIframeCode () { | 92 | getPlaylistIframeCode () { |
93 | const options = this.getPlaylistOptions(this.playlist.embedUrl) | 93 | const options = this.getPlaylistOptions(this.playlist.embedUrl) |
94 | 94 | ||
95 | const embedUrl = buildPlaylistLink(options) | 95 | const embedUrl = buildPlaylistLink(options) |
96 | return buildVideoOrPlaylistEmbed(embedUrl) | 96 | return buildVideoOrPlaylistEmbed(embedUrl, this.playlist.displayName) |
97 | } | 97 | } |
98 | 98 | ||
99 | getVideoUrl () { | 99 | getVideoUrl () { |
diff --git a/client/src/assets/player/peertube-player-manager.ts b/client/src/assets/player/peertube-player-manager.ts index e6d614c47..1d335805b 100644 --- a/client/src/assets/player/peertube-player-manager.ts +++ b/client/src/assets/player/peertube-player-manager.ts | |||
@@ -98,6 +98,7 @@ export interface CommonOptions extends CustomizationOptions { | |||
98 | 98 | ||
99 | videoViewUrl: string | 99 | videoViewUrl: string |
100 | embedUrl: string | 100 | embedUrl: string |
101 | embedTitle: string | ||
101 | 102 | ||
102 | isLive: boolean | 103 | isLive: boolean |
103 | 104 | ||
@@ -165,7 +166,7 @@ export class PeertubePlayerManager { | |||
165 | PeertubePlayerManager.alreadyPlayed = true | 166 | PeertubePlayerManager.alreadyPlayed = true |
166 | }) | 167 | }) |
167 | 168 | ||
168 | self.addContextMenu(mode, player, options.common.embedUrl) | 169 | self.addContextMenu(mode, player, options.common.embedUrl, options.common.embedTitle) |
169 | 170 | ||
170 | player.bezels() | 171 | player.bezels() |
171 | 172 | ||
@@ -203,7 +204,7 @@ export class PeertubePlayerManager { | |||
203 | videojs(newVideoElement, videojsOptions, function (this: videojs.Player) { | 204 | videojs(newVideoElement, videojsOptions, function (this: videojs.Player) { |
204 | const player = this | 205 | const player = this |
205 | 206 | ||
206 | self.addContextMenu(mode, player, options.common.embedUrl) | 207 | self.addContextMenu(mode, player, options.common.embedUrl, options.common.embedTitle) |
207 | 208 | ||
208 | PeertubePlayerManager.onPlayerChange(player) | 209 | PeertubePlayerManager.onPlayerChange(player) |
209 | }) | 210 | }) |
@@ -492,7 +493,7 @@ export class PeertubePlayerManager { | |||
492 | return children | 493 | return children |
493 | } | 494 | } |
494 | 495 | ||
495 | private static addContextMenu (mode: PlayerMode, player: videojs.Player, videoEmbedUrl: string) { | 496 | private static addContextMenu (mode: PlayerMode, player: videojs.Player, videoEmbedUrl: string, videoEmbedTitle: string) { |
496 | const content = [ | 497 | const content = [ |
497 | { | 498 | { |
498 | label: player.localize('Copy the video URL'), | 499 | label: player.localize('Copy the video URL'), |
@@ -509,7 +510,7 @@ export class PeertubePlayerManager { | |||
509 | { | 510 | { |
510 | label: player.localize('Copy embed code'), | 511 | label: player.localize('Copy embed code'), |
511 | listener: () => { | 512 | listener: () => { |
512 | copyToClipboard(buildVideoOrPlaylistEmbed(videoEmbedUrl)) | 513 | copyToClipboard(buildVideoOrPlaylistEmbed(videoEmbedUrl, videoEmbedTitle)) |
513 | } | 514 | } |
514 | } | 515 | } |
515 | ] | 516 | ] |
diff --git a/client/src/assets/player/utils.ts b/client/src/assets/player/utils.ts index 6767459ce..d7451fa1d 100644 --- a/client/src/assets/player/utils.ts +++ b/client/src/assets/player/utils.ts | |||
@@ -1,4 +1,5 @@ | |||
1 | import { VideoFile } from '@shared/models' | 1 | import { VideoFile } from '@shared/models' |
2 | import { escapeHTML } from '@shared/core-utils/renderer' | ||
2 | 3 | ||
3 | function toTitleCase (str: string) { | 4 | function toTitleCase (str: string) { |
4 | return str.charAt(0).toUpperCase() + str.slice(1) | 5 | return str.charAt(0).toUpperCase() + str.slice(1) |
@@ -170,9 +171,11 @@ function secondsToTime (seconds: number, full = false, symbol?: string) { | |||
170 | return time | 171 | return time |
171 | } | 172 | } |
172 | 173 | ||
173 | function buildVideoOrPlaylistEmbed (embedUrl: string) { | 174 | function buildVideoOrPlaylistEmbed (embedUrl: string, embedTitle: string) { |
175 | const title = escapeHTML(embedTitle) | ||
174 | return '<iframe width="560" height="315" ' + | 176 | return '<iframe width="560" height="315" ' + |
175 | 'sandbox="allow-same-origin allow-scripts allow-popups" ' + | 177 | 'sandbox="allow-same-origin allow-scripts allow-popups" ' + |
178 | 'title="' + title + '" ' + | ||
176 | 'src="' + embedUrl + '" ' + | 179 | 'src="' + embedUrl + '" ' + |
177 | 'frameborder="0" allowfullscreen>' + | 180 | 'frameborder="0" allowfullscreen>' + |
178 | '</iframe>' | 181 | '</iframe>' |
diff --git a/client/src/standalone/videos/embed.ts b/client/src/standalone/videos/embed.ts index c87270027..614a1cc0b 100644 --- a/client/src/standalone/videos/embed.ts +++ b/client/src/standalone/videos/embed.ts | |||
@@ -545,7 +545,8 @@ export class PeerTubeEmbed { | |||
545 | 545 | ||
546 | serverUrl: window.location.origin, | 546 | serverUrl: window.location.origin, |
547 | language: navigator.language, | 547 | language: navigator.language, |
548 | embedUrl: window.location.origin + videoInfo.embedPath | 548 | embedUrl: window.location.origin + videoInfo.embedPath, |
549 | embedTitle: videoInfo.name | ||
549 | }, | 550 | }, |
550 | 551 | ||
551 | webtorrent: { | 552 | webtorrent: { |