From 31f53d0855a606d550b70236b913c4e2b1ef5f0e Mon Sep 17 00:00:00 2001 From: Sarab Singh Date: Sat, 2 May 2020 00:57:51 +0530 Subject: [PATCH 1/6] download button only if permission --- CONTRIBUTORS.md | 1 + src/components/photoplayer/plugin.js | 30 ++++++++++++++++----------- src/components/slideshow/slideshow.js | 4 ++-- 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index aa3ec707e3..2eae7e6933 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -34,6 +34,7 @@ - [Ryan Hartzell](https://github.com/ryan-hartzell) - [Thibault Nocchi](https://github.com/ThibaultNocchi) - [MrTimscampi](https://github.com/MrTimscampi) + - [Sarab Singh](https://github.com/sarab97) # Emby Contributors diff --git a/src/components/photoplayer/plugin.js b/src/components/photoplayer/plugin.js index 4ebdbbd6d2..8b980f3b16 100644 --- a/src/components/photoplayer/plugin.js +++ b/src/components/photoplayer/plugin.js @@ -21,19 +21,25 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa var index = options.startIndex || 0; - var newSlideShow = new slideshow({ - showTitle: false, - cover: false, - items: options.items, - startIndex: index, - interval: 11000, - interactive: true + var apiClient = connectionManager.currentApiClient(); + + apiClient.getCurrentUser().then(function(result){ + + var newSlideShow = new slideshow({ + showTitle: false, + cover: false, + items: options.items, + startIndex: index, + interval: 11000, + interactive: true, + user: result + }); + + newSlideShow.show(); + + resolve(); + }); }); - - newSlideShow.show(); - - resolve(); - }); }); }; diff --git a/src/components/slideshow/slideshow.js b/src/components/slideshow/slideshow.js index 48ccee21c8..9c5b1f0435 100644 --- a/src/components/slideshow/slideshow.js +++ b/src/components/slideshow/slideshow.js @@ -167,9 +167,9 @@ define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'f if (!actionButtonsOnTop) { html += '
'; - + html += getIcon('play_arrow', 'btnSlideshowPause slideshowButton', true, true); - if (appHost.supports('filedownload')) { + if (appHost.supports('filedownload') && options.user.Policy.EnableContentDownloading) { html += getIcon('file_download', 'btnDownload slideshowButton', true); } if (appHost.supports('sharing')) { From 5a6b097ed90d4906f05edb1b196ee274453b0f36 Mon Sep 17 00:00:00 2001 From: Sarab Singh Date: Sat, 2 May 2020 02:28:58 +0530 Subject: [PATCH 2/6] image link from remote web client fix --- src/components/slideshow/slideshow.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/slideshow/slideshow.js b/src/components/slideshow/slideshow.js index 9c5b1f0435..bee1030f97 100644 --- a/src/components/slideshow/slideshow.js +++ b/src/components/slideshow/slideshow.js @@ -66,14 +66,14 @@ define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'f * @param {object} item - Item used to generate the image URL. * @returns {string} URL of the item's image. */ - function getImgUrl(item) { + function getImgUrl(item, user) { var apiClient = connectionManager.getApiClient(item.ServerId); var imageOptions = {}; if (item.BackdropImageTags && item.BackdropImageTags.length) { return getBackdropImageUrl(item, imageOptions, apiClient); } else { - if (item.MediaType === 'Photo') { + if (item.MediaType === 'Photo' && user.Policy.EnableContentDownloading) { return apiClient.getItemDownloadUrl(item.Id); } imageOptions.type = "Primary"; @@ -167,7 +167,7 @@ define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'f if (!actionButtonsOnTop) { html += '
'; - + html += getIcon('play_arrow', 'btnSlideshowPause slideshowButton', true, true); if (appHost.supports('filedownload') && options.user.Policy.EnableContentDownloading) { html += getIcon('file_download', 'btnDownload slideshowButton', true); @@ -312,7 +312,7 @@ define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'f */ function getSwiperSlideHtmlFromItem(item) { return getSwiperSlideHtmlFromSlide({ - originalImage: getImgUrl(item), + originalImage: getImgUrl(item, currentOptions.user), //title: item.Name, //description: item.Overview Id: item.Id, From 779bb2094498b36b67f9c3c09afd608690fa8801 Mon Sep 17 00:00:00 2001 From: Sarab Singh Date: Sat, 2 May 2020 02:31:13 +0530 Subject: [PATCH 3/6] download button fix on top action bar --- src/components/slideshow/slideshow.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/slideshow/slideshow.js b/src/components/slideshow/slideshow.js index bee1030f97..0550ccdda0 100644 --- a/src/components/slideshow/slideshow.js +++ b/src/components/slideshow/slideshow.js @@ -155,7 +155,7 @@ define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'f html += '
'; if (actionButtonsOnTop) { - if (appHost.supports('filedownload')) { + if (appHost.supports('filedownload') && options.user.Policy.EnableContentDownloading) { html += getIcon('file_download', 'btnDownload slideshowButton', true); } if (appHost.supports('sharing')) { From d920afe61b2b385547854085e43c2bacba7b2cf5 Mon Sep 17 00:00:00 2001 From: Sarab Singh Date: Sat, 2 May 2020 02:40:48 +0530 Subject: [PATCH 4/6] spaces --- src/components/photoplayer/plugin.js | 32 ++++++++++++++-------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/components/photoplayer/plugin.js b/src/components/photoplayer/plugin.js index 8b980f3b16..63dd2e4fbd 100644 --- a/src/components/photoplayer/plugin.js +++ b/src/components/photoplayer/plugin.js @@ -22,24 +22,24 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa var index = options.startIndex || 0; var apiClient = connectionManager.currentApiClient(); - - apiClient.getCurrentUser().then(function(result){ - - var newSlideShow = new slideshow({ - showTitle: false, - cover: false, - items: options.items, - startIndex: index, - interval: 11000, - interactive: true, - user: result - }); - - newSlideShow.show(); - - resolve(); + + apiClient.getCurrentUser().then(function(result){ + + var newSlideShow = new slideshow({ + showTitle: false, + cover: false, + items: options.items, + startIndex: index, + interval: 11000, + interactive: true, + user: result }); + + newSlideShow.show(); + + resolve(); }); + }); }); }; From 52ab4338e721e4ea0428fad86601ad5f14353bbe Mon Sep 17 00:00:00 2001 From: Sarab Singh Date: Sat, 2 May 2020 02:54:14 +0530 Subject: [PATCH 5/6] stupid lint --- src/components/photoplayer/plugin.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/photoplayer/plugin.js b/src/components/photoplayer/plugin.js index 63dd2e4fbd..06d2e3b391 100644 --- a/src/components/photoplayer/plugin.js +++ b/src/components/photoplayer/plugin.js @@ -23,7 +23,7 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa var apiClient = connectionManager.currentApiClient(); - apiClient.getCurrentUser().then(function(result){ + apiClient.getCurrentUser().then(function(result) { var newSlideShow = new slideshow({ showTitle: false, From ffcb04e75376a67713e99fbbbdd4a9167540a153 Mon Sep 17 00:00:00 2001 From: Sarab Singh Date: Sun, 3 May 2020 03:20:40 +0530 Subject: [PATCH 6/6] no more breaking of screensaver --- src/components/slideshow/slideshow.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/slideshow/slideshow.js b/src/components/slideshow/slideshow.js index 0550ccdda0..715e16325a 100644 --- a/src/components/slideshow/slideshow.js +++ b/src/components/slideshow/slideshow.js @@ -73,7 +73,7 @@ define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'f if (item.BackdropImageTags && item.BackdropImageTags.length) { return getBackdropImageUrl(item, imageOptions, apiClient); } else { - if (item.MediaType === 'Photo' && user.Policy.EnableContentDownloading) { + if (item.MediaType === 'Photo' && user && user.Policy.EnableContentDownloading) { return apiClient.getItemDownloadUrl(item.Id); } imageOptions.type = "Primary"; @@ -155,7 +155,7 @@ define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'f html += '
'; if (actionButtonsOnTop) { - if (appHost.supports('filedownload') && options.user.Policy.EnableContentDownloading) { + if (appHost.supports('filedownload') && options.user && options.user.Policy.EnableContentDownloading) { html += getIcon('file_download', 'btnDownload slideshowButton', true); } if (appHost.supports('sharing')) { @@ -169,7 +169,7 @@ define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'f html += '
'; html += getIcon('play_arrow', 'btnSlideshowPause slideshowButton', true, true); - if (appHost.supports('filedownload') && options.user.Policy.EnableContentDownloading) { + if (appHost.supports('filedownload') && options.user && options.user.Policy.EnableContentDownloading) { html += getIcon('file_download', 'btnDownload slideshowButton', true); } if (appHost.supports('sharing')) {