From 9a29174846583aa823889cda7fe0fdeae198f4ee Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Tue, 20 Nov 2018 21:04:00 +0100 Subject: [PATCH 1/3] Work with stricter csp Signed-off-by: Roeland Jago Douma --- js/viewer.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/js/viewer.js b/js/viewer.js index 3c5c53b..d1d896f 100755 --- a/js/viewer.js +++ b/js/viewer.js @@ -8,7 +8,12 @@ var videoViewer = { var stylePath = OC.filePath('files_videoplayer', 'videojs', 'src/video-js.css'); $('head').append($('')); var scriptPath = OC.filePath('files_videoplayer', 'videojs', 'src/video.js'); - return $.getScript(scriptPath, function (xhr) {eval(xhr);}); + + var deferred = $.Deferred(); + $.getScript(scriptPath, function() { + deferred.resolve(); + }); + return deferred; } }, videoJSLoaded: false, From 2f98c9a8db26fbe40e1b20dbf7383aae6777e0f4 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Tue, 20 Nov 2018 22:13:14 +0100 Subject: [PATCH 2/3] Load the viewer Signed-off-by: Roeland Jago Douma --- js/viewer.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/js/viewer.js b/js/viewer.js index d1d896f..d615ce3 100755 --- a/js/viewer.js +++ b/js/viewer.js @@ -5,14 +5,19 @@ var videoViewer = { return $.when(); } else { this.videoJSLoaded = true; - var stylePath = OC.filePath('files_videoplayer', 'videojs', 'src/video-js.css'); + var stylePath = OC.filePath('files_videoplayer', 'js', 'videojs/video-js.css'); $('head').append($('')); - var scriptPath = OC.filePath('files_videoplayer', 'videojs', 'src/video.js'); + var scriptPath = OC.filePath('files_videoplayer', 'js', 'videojs/video.js'); var deferred = $.Deferred(); - $.getScript(scriptPath, function() { + var script = document.createElement('script'); + script.src = scriptPath; + script.setAttribute('nonce', btoa(OC.requestToken)); + script.onload = function() { deferred.resolve(); - }); + }; + document.head.appendChild(script); + return deferred; } }, From 5a3b5b195810ca1361f88e0e9835e2eca07f228d Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Tue, 20 Nov 2018 22:19:05 +0100 Subject: [PATCH 3/3] Move to js Signed-off-by: Roeland Jago Douma --- {videojs/src => js/videojs}/font/vjs.eot | Bin {videojs/src => js/videojs}/font/vjs.svg | 0 {videojs/src => js/videojs}/font/vjs.ttf | Bin {videojs/src => js/videojs}/font/vjs.woff | Bin {videojs/src => js/videojs}/lang/ar.js | 0 {videojs/src => js/videojs}/lang/bg.js | 0 {videojs/src => js/videojs}/lang/ca.js | 0 {videojs/src => js/videojs}/lang/cs.js | 0 {videojs/src => js/videojs}/lang/de.js | 0 {videojs/src => js/videojs}/lang/es.js | 0 {videojs/src => js/videojs}/lang/fr.js | 0 {videojs/src => js/videojs}/lang/hu.js | 0 {videojs/src => js/videojs}/lang/it.js | 0 {videojs/src => js/videojs}/lang/ja.js | 0 {videojs/src => js/videojs}/lang/ko.js | 0 {videojs/src => js/videojs}/lang/nl.js | 0 {videojs/src => js/videojs}/lang/pt-BR.js | 0 {videojs/src => js/videojs}/lang/ru.js | 0 {videojs/src => js/videojs}/lang/tr.js | 0 {videojs/src => js/videojs}/lang/uk.js | 0 {videojs/src => js/videojs}/lang/vi.js | 0 {videojs/src => js/videojs}/lang/zh-CN.js | 0 {videojs/src => js/videojs}/lang/zh-TW.js | 0 {videojs/src => js/videojs}/video-js.css | 0 {videojs/src => js/videojs}/video.js | 0 25 files changed, 0 insertions(+), 0 deletions(-) rename {videojs/src => js/videojs}/font/vjs.eot (100%) rename {videojs/src => js/videojs}/font/vjs.svg (100%) rename {videojs/src => js/videojs}/font/vjs.ttf (100%) rename {videojs/src => js/videojs}/font/vjs.woff (100%) rename {videojs/src => js/videojs}/lang/ar.js (100%) rename {videojs/src => js/videojs}/lang/bg.js (100%) rename {videojs/src => js/videojs}/lang/ca.js (100%) rename {videojs/src => js/videojs}/lang/cs.js (100%) rename {videojs/src => js/videojs}/lang/de.js (100%) rename {videojs/src => js/videojs}/lang/es.js (100%) rename {videojs/src => js/videojs}/lang/fr.js (100%) rename {videojs/src => js/videojs}/lang/hu.js (100%) rename {videojs/src => js/videojs}/lang/it.js (100%) rename {videojs/src => js/videojs}/lang/ja.js (100%) rename {videojs/src => js/videojs}/lang/ko.js (100%) rename {videojs/src => js/videojs}/lang/nl.js (100%) rename {videojs/src => js/videojs}/lang/pt-BR.js (100%) rename {videojs/src => js/videojs}/lang/ru.js (100%) rename {videojs/src => js/videojs}/lang/tr.js (100%) rename {videojs/src => js/videojs}/lang/uk.js (100%) rename {videojs/src => js/videojs}/lang/vi.js (100%) rename {videojs/src => js/videojs}/lang/zh-CN.js (100%) rename {videojs/src => js/videojs}/lang/zh-TW.js (100%) rename {videojs/src => js/videojs}/video-js.css (100%) rename {videojs/src => js/videojs}/video.js (100%) diff --git a/videojs/src/font/vjs.eot b/js/videojs/font/vjs.eot similarity index 100% rename from videojs/src/font/vjs.eot rename to js/videojs/font/vjs.eot diff --git a/videojs/src/font/vjs.svg b/js/videojs/font/vjs.svg similarity index 100% rename from videojs/src/font/vjs.svg rename to js/videojs/font/vjs.svg diff --git a/videojs/src/font/vjs.ttf b/js/videojs/font/vjs.ttf similarity index 100% rename from videojs/src/font/vjs.ttf rename to js/videojs/font/vjs.ttf diff --git a/videojs/src/font/vjs.woff b/js/videojs/font/vjs.woff similarity index 100% rename from videojs/src/font/vjs.woff rename to js/videojs/font/vjs.woff diff --git a/videojs/src/lang/ar.js b/js/videojs/lang/ar.js similarity index 100% rename from videojs/src/lang/ar.js rename to js/videojs/lang/ar.js diff --git a/videojs/src/lang/bg.js b/js/videojs/lang/bg.js similarity index 100% rename from videojs/src/lang/bg.js rename to js/videojs/lang/bg.js diff --git a/videojs/src/lang/ca.js b/js/videojs/lang/ca.js similarity index 100% rename from videojs/src/lang/ca.js rename to js/videojs/lang/ca.js diff --git a/videojs/src/lang/cs.js b/js/videojs/lang/cs.js similarity index 100% rename from videojs/src/lang/cs.js rename to js/videojs/lang/cs.js diff --git a/videojs/src/lang/de.js b/js/videojs/lang/de.js similarity index 100% rename from videojs/src/lang/de.js rename to js/videojs/lang/de.js diff --git a/videojs/src/lang/es.js b/js/videojs/lang/es.js similarity index 100% rename from videojs/src/lang/es.js rename to js/videojs/lang/es.js diff --git a/videojs/src/lang/fr.js b/js/videojs/lang/fr.js similarity index 100% rename from videojs/src/lang/fr.js rename to js/videojs/lang/fr.js diff --git a/videojs/src/lang/hu.js b/js/videojs/lang/hu.js similarity index 100% rename from videojs/src/lang/hu.js rename to js/videojs/lang/hu.js diff --git a/videojs/src/lang/it.js b/js/videojs/lang/it.js similarity index 100% rename from videojs/src/lang/it.js rename to js/videojs/lang/it.js diff --git a/videojs/src/lang/ja.js b/js/videojs/lang/ja.js similarity index 100% rename from videojs/src/lang/ja.js rename to js/videojs/lang/ja.js diff --git a/videojs/src/lang/ko.js b/js/videojs/lang/ko.js similarity index 100% rename from videojs/src/lang/ko.js rename to js/videojs/lang/ko.js diff --git a/videojs/src/lang/nl.js b/js/videojs/lang/nl.js similarity index 100% rename from videojs/src/lang/nl.js rename to js/videojs/lang/nl.js diff --git a/videojs/src/lang/pt-BR.js b/js/videojs/lang/pt-BR.js similarity index 100% rename from videojs/src/lang/pt-BR.js rename to js/videojs/lang/pt-BR.js diff --git a/videojs/src/lang/ru.js b/js/videojs/lang/ru.js similarity index 100% rename from videojs/src/lang/ru.js rename to js/videojs/lang/ru.js diff --git a/videojs/src/lang/tr.js b/js/videojs/lang/tr.js similarity index 100% rename from videojs/src/lang/tr.js rename to js/videojs/lang/tr.js diff --git a/videojs/src/lang/uk.js b/js/videojs/lang/uk.js similarity index 100% rename from videojs/src/lang/uk.js rename to js/videojs/lang/uk.js diff --git a/videojs/src/lang/vi.js b/js/videojs/lang/vi.js similarity index 100% rename from videojs/src/lang/vi.js rename to js/videojs/lang/vi.js diff --git a/videojs/src/lang/zh-CN.js b/js/videojs/lang/zh-CN.js similarity index 100% rename from videojs/src/lang/zh-CN.js rename to js/videojs/lang/zh-CN.js diff --git a/videojs/src/lang/zh-TW.js b/js/videojs/lang/zh-TW.js similarity index 100% rename from videojs/src/lang/zh-TW.js rename to js/videojs/lang/zh-TW.js diff --git a/videojs/src/video-js.css b/js/videojs/video-js.css similarity index 100% rename from videojs/src/video-js.css rename to js/videojs/video-js.css diff --git a/videojs/src/video.js b/js/videojs/video.js similarity index 100% rename from videojs/src/video.js rename to js/videojs/video.js