diff --git a/dashboard-ui/advanced.html b/dashboard-ui/advanced.html index f25eb87671..f314d2d892 100644 --- a/dashboard-ui/advanced.html +++ b/dashboard-ui/advanced.html @@ -12,7 +12,6 @@
${TabGeneral} ${TabHosting} - ${TabSecurity}
diff --git a/dashboard-ui/apiclient/fileupload.js b/dashboard-ui/apiclient/fileupload.js index 36c2f995f6..d8e77aa17b 100644 --- a/dashboard-ui/apiclient/fileupload.js +++ b/dashboard-ui/apiclient/fileupload.js @@ -4,7 +4,7 @@ var self = this; - self.upload = function (file, name, url) { + self.upload = function (file, mimeType, name, url) { var deferred = DeferredBuilder.Deferred(); diff --git a/dashboard-ui/apiclient/sync/contentuploader.js b/dashboard-ui/apiclient/sync/contentuploader.js index f11559e5c9..80c9d63785 100644 --- a/dashboard-ui/apiclient/sync/contentuploader.js +++ b/dashboard-ui/apiclient/sync/contentuploader.js @@ -113,7 +113,10 @@ Logger.log('Uploading file to ' + url); - new MediaBrowser.FileUpload().upload(file, name, url).done(function () { + // TODO: Need to get this from cordova file api instead of trying to infer the content type from the path + var mimeType = file.toLowerCase().indexOf('mp4') != -1 || file.toLowerCase().indexOf('m4v') != -1 ? 'video/mp4' : (file.toLowerCase().indexOf('png') != -1 ? 'image/png' : 'image/jpg'); + + new MediaBrowser.FileUpload().upload(file, mimeType, name, url).done(function () { Logger.log('File upload succeeded'); deferred.resolve(); diff --git a/dashboard-ui/apiclient/sync/mediasync.js b/dashboard-ui/apiclient/sync/mediasync.js index 96ebde6c36..315a0d17d2 100644 --- a/dashboard-ui/apiclient/sync/mediasync.js +++ b/dashboard-ui/apiclient/sync/mediasync.js @@ -8,10 +8,63 @@ var deferred = DeferredBuilder.Deferred(); - deferred.resolve(); + reportOfflineActions(apiClient).done(function () { + + // Do the first data sync + syncData(apiClient, false).done(function () { + + // Download new content + getNewMedia(apiClient).done(function () { + + // Do the second data sync + syncData(apiClient, false).done(function () { + + deferred.resolve(); + + }).fail(getOnFail(deferred)); + + }).fail(getOnFail(deferred)); + + }).fail(getOnFail(deferred)); + + }).fail(getOnFail(deferred)); return deferred.promise(); }; + + function reportOfflineActions(apiClient) { + + var deferred = DeferredBuilder.Deferred(); + + deferred.resolve(); + + return deferred.promise(); + } + + function syncData(apiClient, syncUserItemAccess) { + + var deferred = DeferredBuilder.Deferred(); + + deferred.resolve(); + + return deferred.promise(); + } + + function getNewMedia(apiClient) { + + var deferred = DeferredBuilder.Deferred(); + + deferred.resolve(); + + return deferred.promise(); + } + + function getOnFail(deferred) { + return function () { + + deferred.reject(); + }; + } } if (!globalScope.MediaBrowser) { diff --git a/dashboard-ui/cordova/fileupload.js b/dashboard-ui/cordova/fileupload.js index c44b33927f..8be134113a 100644 --- a/dashboard-ui/cordova/fileupload.js +++ b/dashboard-ui/cordova/fileupload.js @@ -4,7 +4,7 @@ var self = this; - self.upload = function (file, name, url) { + self.upload = function (file, mimeType, name, url) { var deferred = DeferredBuilder.Deferred(); @@ -24,7 +24,7 @@ var options = new FileUploadOptions(); options.fileKey = "file"; options.fileName = name; - options.mimeType = 'image/jpg'; + options.mimeType = mimeType; var params = {}; options.params = params; diff --git a/dashboard-ui/dashboardhosting.html b/dashboard-ui/dashboardhosting.html index ce9ddfc4f1..b54806d13f 100644 --- a/dashboard-ui/dashboardhosting.html +++ b/dashboard-ui/dashboardhosting.html @@ -12,7 +12,6 @@
${TabGeneral} ${TabHosting} - ${TabSecurity}
diff --git a/dashboard-ui/scripts/backdrops.js b/dashboard-ui/scripts/backdrops.js index b8da55fb19..87bc361cbf 100644 --- a/dashboard-ui/scripts/backdrops.js +++ b/dashboard-ui/scripts/backdrops.js @@ -29,6 +29,7 @@ var elem = document.documentElement; elem.classList.remove('backdropContainer'); + elem.removeAttribute('data-url'); elem.style.backgroundImage = ''; } @@ -81,6 +82,11 @@ function setBackdropImage(elem, url) { + if (url == elem.getAttribute('data-url')) { + return; + } + + elem.setAttribute('data-url', url); ImageLoader.lazyImage(elem, url); } @@ -119,7 +125,9 @@ function setDefault(page) { - getElement().style.backgroundImage = "url(css/images/splash.jpg)"; + var elem = getElement(); + elem.style.backgroundImage = "url(css/images/splash.jpg)"; + elem.setAttribute('data-url', 'css/images/splash.jpg'); page = $(page)[0]; page.classList.add('backdropPage'); page.classList.add('staticBackdropPage'); diff --git a/dashboard-ui/scripts/dashboardpage.js b/dashboard-ui/scripts/dashboardpage.js index 4b5703169d..3558a48214 100644 --- a/dashboard-ui/scripts/dashboardpage.js +++ b/dashboard-ui/scripts/dashboardpage.js @@ -39,7 +39,9 @@ $('.activityItems', page).activityLogList(); - $('.swaggerLink', page).attr('href', apiClient.getUrl('swagger-ui/index.html')); + $('.swaggerLink', page).attr('href', apiClient.getUrl('swagger-ui/index.html', { + api_key: ApiClient.accessToken() + })); }, onPageHide: function () { diff --git a/dashboard-ui/scripts/nowplayingpage.js b/dashboard-ui/scripts/nowplayingpage.js index c0174edace..3489c37fe4 100644 --- a/dashboard-ui/scripts/nowplayingpage.js +++ b/dashboard-ui/scripts/nowplayingpage.js @@ -595,9 +595,12 @@ setImageUrl(page, url); - Backdrops.setBackdropUrl(page, backdropUrl); - if (item) { + + // This should be outside of the IF + // But for now, if you change songs but keep the same artist, the backdrop will flicker because in-between songs it clears out the image + Backdrops.setBackdropUrl(page, backdropUrl); + ApiClient.getItem(Dashboard.getCurrentUserId(), item.Id).done(function (fullItem) { page.querySelector('.nowPlayingPageUserDataButtons').innerHTML = LibraryBrowser.getUserDataIconsHtml(fullItem, false); }); diff --git a/dashboard-ui/scripts/serversecurity.js b/dashboard-ui/scripts/serversecurity.js deleted file mode 100644 index c84df11fac..0000000000 --- a/dashboard-ui/scripts/serversecurity.js +++ /dev/null @@ -1,143 +0,0 @@ -(function ($, document) { - - function revoke(page, key) { - - Dashboard.confirm(Globalize.translate('MessageConfirmRevokeApiKey'), Globalize.translate('HeaderConfirmRevokeApiKey'), function (result) { - - if (result) { - - Dashboard.showLoadingMsg(); - - ApiClient.ajax({ - type: "DELETE", - url: ApiClient.getUrl('Auth/Keys' + key) - - }).done(function () { - - loadData(page); - }); - } - - }); - } - - function renderKeys(page, keys, users) { - - var rows = keys.map(function (item) { - - var html = ''; - - html += ''; - - html += ''; - html += ''; - html += ''; - - html += ''; - html += (item.AccessToken); - html += ''; - - html += ''; - html += (item.AppName || ''); - html += ''; - - html += ''; - html += (item.DeviceName || ''); - html += ''; - - html += ''; - - var user = users.filter(function (u) { - - return u.Id == item.UserId; - })[0]; - - if (user) { - html += user.Name; - } - - html += ''; - - html += ''; - - var date = parseISO8601Date(item.DateCreated, { toLocal: true }); - - html += date.toLocaleDateString() + ' ' + LibraryBrowser.getDisplayTime(date); - - html += ''; - - html += ''; - - return html; - - }).join(''); - - var elem = $('.resultBody', page).html(rows).parents('.tblApiKeys').table("refresh").trigger('create'); - - $('.btnRevoke', elem).on('click', function () { - - revoke(page, this.getAttribute('data-token')); - }); - - Dashboard.hideLoadingMsg(); - } - - function loadData(page) { - - Dashboard.showLoadingMsg(); - - ApiClient.getUsers().done(function (users) { - - ApiClient.getJSON(ApiClient.getUrl('Auth/Keys')).done(function (result) { - - renderKeys(page, result.Items, users); - }); - }); - } - - function onSubmit() { - var form = this; - var page = $(form).parents('.page'); - - Dashboard.showLoadingMsg(); - - ApiClient.ajax({ - type: "POST", - url: ApiClient.getUrl('Auth/Keys', { - - App: $('#txtAppName', form).val() - - }) - - }).done(function () { - - $('.newKeyPanel', page).panel('close'); - - loadData(page); - }); - - return false; - } - - $(document).on('pageinit', "#serverSecurityPage", function () { - - var page = this; - - $('.btnNewKey', page).on('click', function () { - - $('.newKeyPanel', page).panel('toggle'); - - $('#txtAppName', page).val('').focus(); - - }); - - $('.newKeyForm').off('submit', onSubmit).on('submit', onSubmit); - - }).on('pageshowready', "#serverSecurityPage", function () { - - var page = this; - - loadData(page); - }); - -})(jQuery, document); \ No newline at end of file diff --git a/dashboard-ui/serversecurity.html b/dashboard-ui/serversecurity.html deleted file mode 100644 index 4910aad420..0000000000 --- a/dashboard-ui/serversecurity.html +++ /dev/null @@ -1,60 +0,0 @@ - - - - ${TitleAdvanced} - - -
- -
-
- - - -

- ${HeaderApiKeys} - -

-

${HeaderApiKeysHelp}

-
- - - - - - - - - - - - -
${HeaderApiKey}${HeaderApp}${HeaderDevice}${HeaderUser}${HeaderDateIssued}
- -
-
-
- - -

${HeaderNewApiKey}

- -

${HeaderNewApiKeyHelp}

-
- - -
${LabelAppNameExample}
-
- -
-

- -

- -
-
- -