From 53437ecced06c5dcff0c2b62b915b6bbf716bccb Mon Sep 17 00:00:00 2001 From: Piotr Filiciak Date: Fri, 29 Apr 2016 12:22:26 +0200 Subject: [PATCH 1/3] Fix: Bugs in shared link with video #24331 --- apps/files_sharing/js/public.js | 2 +- apps/files_sharing/templates/public.php | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/files_sharing/js/public.js b/apps/files_sharing/js/public.js index 2d93bc1799..6df19621be 100644 --- a/apps/files_sharing/js/public.js +++ b/apps/files_sharing/js/public.js @@ -139,7 +139,7 @@ OCA.Sharing.PublicApp = { }).then(function (data) { self._showTextPreview(data, previewHeight); }); - } else if (previewSupported === 'true' || + } else if ((previewSupported === 'true' && mimetype.substr(0, mimetype.indexOf('/')) !== 'video') || mimetype.substr(0, mimetype.indexOf('/')) === 'image' && mimetype !== 'image/svg+xml') { img.attr('src', OC.filePath('files_sharing', 'ajax', 'publicpreview.php') + '?' + OC.buildQueryString(params)); diff --git a/apps/files_sharing/templates/public.php b/apps/files_sharing/templates/public.php index cb7fe1103b..fb29382bde 100644 --- a/apps/files_sharing/templates/public.php +++ b/apps/files_sharing/templates/public.php @@ -21,11 +21,13 @@ OCP\Util::addScript('files', 'files'); OCP\Util::addScript('files', 'filelist'); OCP\Util::addscript('files', 'keyboardshortcuts'); -$thumbSize = 1024; +$sysConfig = \OC::$server->getConfig(); +$thumbSizeX = $sysConfig->getSystemValue('preview_max_x', 1024); +$thumbSizeY = $sysConfig->getSystemValue('preview_max_y', 1024); ?> - +
@@ -94,7 +96,7 @@ $thumbSize = 1024;
-
From 11b2e98a30da1cc97d82739600da53fcef765c3f Mon Sep 17 00:00:00 2001 From: Piotr Filiciak Date: Tue, 24 May 2016 12:34:37 +0200 Subject: [PATCH 2/3] video poster --- apps/files_sharing/js/public.js | 3 +++ apps/files_sharing/lib/controllers/sharecontroller.php | 2 ++ apps/files_sharing/templates/public.php | 8 ++------ 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/apps/files_sharing/js/public.js b/apps/files_sharing/js/public.js index 6df19621be..46d4ee2d59 100644 --- a/apps/files_sharing/js/public.js +++ b/apps/files_sharing/js/public.js @@ -149,6 +149,9 @@ OCA.Sharing.PublicApp = { img.attr('width', 128); img.appendTo('#imgframe'); } + else { + $('#imgframe > video').attr('poster', OC.filePath('files_sharing', 'ajax', 'publicpreview.php') + '?' + OC.buildQueryString(params)); + } if (this.fileList) { // TODO: move this to a separate PublicFileList class that extends OCA.Files.FileList (+ unit tests) diff --git a/apps/files_sharing/lib/controllers/sharecontroller.php b/apps/files_sharing/lib/controllers/sharecontroller.php index 72294f6b26..de7e7dd7b0 100644 --- a/apps/files_sharing/lib/controllers/sharecontroller.php +++ b/apps/files_sharing/lib/controllers/sharecontroller.php @@ -347,6 +347,8 @@ class ShareController extends Controller { $shareTmpl['downloadURL'] = $this->urlGenerator->linkToRouteAbsolute('files_sharing.sharecontroller.downloadShare', array('token' => $token)); $shareTmpl['maxSizeAnimateGif'] = $this->config->getSystemValue('max_filesize_animated_gifs_public_sharing', 10); $shareTmpl['previewEnabled'] = $this->config->getSystemValue('enable_previews', true); + $shareTmpl['previewMaxX'] = $this->config->getSystemValue('preview_max_x', 1024); + $shareTmpl['previewMaxY'] = $this->config->getSystemValue('preview_max_y', 1024); $csp = new OCP\AppFramework\Http\ContentSecurityPolicy(); $csp->addAllowedFrameDomain('\'self\''); diff --git a/apps/files_sharing/templates/public.php b/apps/files_sharing/templates/public.php index fb29382bde..e39d1b0807 100644 --- a/apps/files_sharing/templates/public.php +++ b/apps/files_sharing/templates/public.php @@ -20,14 +20,10 @@ OCP\Util::addScript('files', 'newfilemenu'); OCP\Util::addScript('files', 'files'); OCP\Util::addScript('files', 'filelist'); OCP\Util::addscript('files', 'keyboardshortcuts'); - -$sysConfig = \OC::$server->getConfig(); -$thumbSizeX = $sysConfig->getSystemValue('preview_max_x', 1024); -$thumbSizeY = $sysConfig->getSystemValue('preview_max_y', 1024); ?> - +
@@ -96,7 +92,7 @@ $thumbSizeY = $sysConfig->getSystemValue('preview_max_y', 1024);
-
From df59c5d1ee5810293e3c7a6a63f00f0e94126c03 Mon Sep 17 00:00:00 2001 From: Piotr Filiciak Date: Tue, 24 May 2016 12:43:43 +0200 Subject: [PATCH 3/3] bug fix --- apps/files_sharing/js/public.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/files_sharing/js/public.js b/apps/files_sharing/js/public.js index 46d4ee2d59..572ccc47b7 100644 --- a/apps/files_sharing/js/public.js +++ b/apps/files_sharing/js/public.js @@ -149,7 +149,7 @@ OCA.Sharing.PublicApp = { img.attr('width', 128); img.appendTo('#imgframe'); } - else { + else if (previewSupported === 'true') { $('#imgframe > video').attr('poster', OC.filePath('files_sharing', 'ajax', 'publicpreview.php') + '?' + OC.buildQueryString(params)); }