diff --git a/dashboard-ui/login.html b/dashboard-ui/login.html index 7394b7f91a..ea6541e34c 100644 --- a/dashboard-ui/login.html +++ b/dashboard-ui/login.html @@ -33,6 +33,8 @@
+ +

${ButtonManualLogin}

diff --git a/dashboard-ui/scripts/dashboardpage.js b/dashboard-ui/scripts/dashboardpage.js index c03d77f3cd..a9f7240404 100644 --- a/dashboard-ui/scripts/dashboardpage.js +++ b/dashboard-ui/scripts/dashboardpage.js @@ -41,15 +41,6 @@ $('#imagesByNamePath', page).html(systemInfo.ItemsByNamePath); $('#transcodingTemporaryPath', page).html(systemInfo.TranscodingTempPath); $('#metadataPath', page).html(systemInfo.InternalMetadataPath); - - if (systemInfo.WanAddress) { - - var externalUrl = systemInfo.WanAddress + "/mediabrowser"; - - $('.externalUrl', page).html('Remote access: ' + externalUrl + '').show().trigger('create'); - } else { - $('.externalUrl', page).hide(); - } }, refreshSessionsLocally: function () { @@ -742,13 +733,9 @@ renderUrls: function (page, systemInfo) { - var url = ApiClient.serverAddress() + "/mediabrowser"; - - $('#bookmarkUrl', page).html(url).attr("href", url); - if (systemInfo.WanAddress) { - var externalUrl = systemInfo.WanAddress + "/mediabrowser"; + var externalUrl = systemInfo.WanAddress + ApiClient.apiPrefix(); var remoteAccessHtml = Globalize.translate('LabelRemoteAccessUrl').replace('{0}', '' + externalUrl + ''); diff --git a/dashboard-ui/scripts/livetvchannels.js b/dashboard-ui/scripts/livetvchannels.js index bde7292020..b9fe6983c5 100644 --- a/dashboard-ui/scripts/livetvchannels.js +++ b/dashboard-ui/scripts/livetvchannels.js @@ -9,7 +9,7 @@ return LibraryBrowser.getPosterViewHtml({ items: channels, - shape: "smallBackdrop", + shape: "miniBackdrop", centerText: true }); } diff --git a/dashboard-ui/scripts/site.js b/dashboard-ui/scripts/site.js index e27fc2bcae..8f7a971f12 100644 --- a/dashboard-ui/scripts/site.js +++ b/dashboard-ui/scripts/site.js @@ -1,20 +1,42 @@ -$.ajaxSetup({ - crossDomain: true, +(function() { + + function onAuthFailure(data, textStatus, xhr) { - error: function (event) { - Dashboard.hideLoadingMsg(); + var url = (this.url || '').toLowerCase(); - if (!Dashboard.suppressAjaxErrors) { - setTimeout(function () { - - - var msg = event.getResponseHeader("X-Application-Error-Code") || Dashboard.defaultErrorMessage; - - Dashboard.showError(msg); - }, 500); + // Bounce to the login screen, but not if a password entry fails, obviously + if (url.indexOf('/password') == -1 && url.indexOf('/authenticate') == -1) { + Dashboard.logout(false); } } -}); + + $.ajaxSetup({ + crossDomain: true, + + statusCode: { + + 401: onAuthFailure, + 403: onAuthFailure + }, + + error: function (event) { + + Dashboard.hideLoadingMsg(); + + if (!Dashboard.suppressAjaxErrors) { + setTimeout(function () { + + var msg = event.getResponseHeader("X-Application-Error-Code") || Dashboard.defaultErrorMessage; + Dashboard.showError(msg); + + }, 500); + } + } + }); + + + +})(); if ($.browser.msie) { @@ -102,16 +124,21 @@ var Dashboard = { Dashboard.getUserPromise = null; }, - logout: function () { + logout: function (logoutWithServer) { if (window.localStorage) { localStorage.removeItem("userId"); localStorage.removeItem("token"); } - ApiClient.logout().done(function () { + if (logoutWithServer === false) { window.location = "login.html"; - }); + } else { + ApiClient.logout().done(function () { + window.location = "login.html"; + }); + + } }, showError: function (message) { diff --git a/dashboard-ui/thirdparty/mediabrowser.apiclient.js b/dashboard-ui/thirdparty/mediabrowser.apiclient.js index 59cc76dc32..69a4874080 100644 --- a/dashboard-ui/thirdparty/mediabrowser.apiclient.js +++ b/dashboard-ui/thirdparty/mediabrowser.apiclient.js @@ -57,6 +57,11 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi return serverAddress; }; + self.apiPrefix = function () { + + return "/mediabrowser"; + }; + /** * Gets or sets the current user id. */ @@ -176,7 +181,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi var url = serverAddress; - url += "/mediabrowser/" + name; + url += self.apiPrefix() + "/" + name; if (params) { url += "?" + $.param(params); @@ -187,7 +192,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi self.openWebSocket = function (webSocketAddress) { - var url = webSocketAddress + "/mediabrowser"; + var url = webSocketAddress + self.apiPrefix(); webSocket = new WebSocket(url); @@ -2159,7 +2164,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi options.maxHeight = Math.round(options.maxHeight * ratio); } } - + options.quality = options.quality || (options.type.toLowerCase() == 'backdrop' ? 80 : 90); }