aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/assets/player/utils.ts
diff options
context:
space:
mode:
authorThavarasa Prasanth <45243326+pthavarasa@users.noreply.github.com>2021-03-31 08:32:05 +0200
committerGitHub <noreply@github.com>2021-03-31 08:32:05 +0200
commit4097c6d66cb2919c28b5bce44b259e630923fbe0 (patch)
treed57897b0b8762202a0be90388e9a79153690b9d9 /client/src/assets/player/utils.ts
parent47099aba46be7757d833422f1706b99a3c0e28ea (diff)
downloadPeerTube-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/src/assets/player/utils.ts')
-rw-r--r--client/src/assets/player/utils.ts5
1 files changed, 4 insertions, 1 deletions
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 @@
1import { VideoFile } from '@shared/models' 1import { VideoFile } from '@shared/models'
2import { escapeHTML } from '@shared/core-utils/renderer'
2 3
3function toTitleCase (str: string) { 4function 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
173function buildVideoOrPlaylistEmbed (embedUrl: string) { 174function 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>'