1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Merge pull request #1166 from sarab97/downloadbutton

Download button fix on photos slideshow
This commit is contained in:
dkanada 2020-05-03 15:07:30 +09:00 committed by GitHub
commit e9151b6ee9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 16 deletions

View file

@ -34,6 +34,7 @@
- [Ryan Hartzell](https://github.com/ryan-hartzell) - [Ryan Hartzell](https://github.com/ryan-hartzell)
- [Thibault Nocchi](https://github.com/ThibaultNocchi) - [Thibault Nocchi](https://github.com/ThibaultNocchi)
- [MrTimscampi](https://github.com/MrTimscampi) - [MrTimscampi](https://github.com/MrTimscampi)
- [Sarab Singh](https://github.com/sarab97)
# Emby Contributors # Emby Contributors

View file

@ -21,13 +21,18 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
var index = options.startIndex || 0; var index = options.startIndex || 0;
var apiClient = connectionManager.currentApiClient();
apiClient.getCurrentUser().then(function(result) {
var newSlideShow = new slideshow({ var newSlideShow = new slideshow({
showTitle: false, showTitle: false,
cover: false, cover: false,
items: options.items, items: options.items,
startIndex: index, startIndex: index,
interval: 11000, interval: 11000,
interactive: true interactive: true,
user: result
}); });
newSlideShow.show(); newSlideShow.show();
@ -35,6 +40,7 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
resolve(); resolve();
}); });
}); });
});
}; };
PhotoPlayer.prototype.canPlayMediaType = function (mediaType) { PhotoPlayer.prototype.canPlayMediaType = function (mediaType) {

View file

@ -66,14 +66,14 @@ define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'f
* @param {object} item - Item used to generate the image URL. * @param {object} item - Item used to generate the image URL.
* @returns {string} URL of the item's image. * @returns {string} URL of the item's image.
*/ */
function getImgUrl(item) { function getImgUrl(item, user) {
var apiClient = connectionManager.getApiClient(item.ServerId); var apiClient = connectionManager.getApiClient(item.ServerId);
var imageOptions = {}; var imageOptions = {};
if (item.BackdropImageTags && item.BackdropImageTags.length) { if (item.BackdropImageTags && item.BackdropImageTags.length) {
return getBackdropImageUrl(item, imageOptions, apiClient); return getBackdropImageUrl(item, imageOptions, apiClient);
} else { } else {
if (item.MediaType === 'Photo') { if (item.MediaType === 'Photo' && user && user.Policy.EnableContentDownloading) {
return apiClient.getItemDownloadUrl(item.Id); return apiClient.getItemDownloadUrl(item.Id);
} }
imageOptions.type = "Primary"; imageOptions.type = "Primary";
@ -155,7 +155,7 @@ define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'f
html += '<div class="topActionButtons">'; html += '<div class="topActionButtons">';
if (actionButtonsOnTop) { if (actionButtonsOnTop) {
if (appHost.supports('filedownload')) { if (appHost.supports('filedownload') && options.user && options.user.Policy.EnableContentDownloading) {
html += getIcon('file_download', 'btnDownload slideshowButton', true); html += getIcon('file_download', 'btnDownload slideshowButton', true);
} }
if (appHost.supports('sharing')) { if (appHost.supports('sharing')) {
@ -169,7 +169,7 @@ define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'f
html += '<div class="slideshowBottomBar hide">'; html += '<div class="slideshowBottomBar hide">';
html += getIcon('play_arrow', 'btnSlideshowPause slideshowButton', true, true); html += getIcon('play_arrow', 'btnSlideshowPause slideshowButton', true, true);
if (appHost.supports('filedownload')) { if (appHost.supports('filedownload') && options.user && options.user.Policy.EnableContentDownloading) {
html += getIcon('file_download', 'btnDownload slideshowButton', true); html += getIcon('file_download', 'btnDownload slideshowButton', true);
} }
if (appHost.supports('sharing')) { if (appHost.supports('sharing')) {
@ -312,7 +312,7 @@ define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'f
*/ */
function getSwiperSlideHtmlFromItem(item) { function getSwiperSlideHtmlFromItem(item) {
return getSwiperSlideHtmlFromSlide({ return getSwiperSlideHtmlFromSlide({
originalImage: getImgUrl(item), originalImage: getImgUrl(item, currentOptions.user),
//title: item.Name, //title: item.Name,
//description: item.Overview //description: item.Overview
Id: item.Id, Id: item.Id,