diff --git a/src/components/apphost.js b/src/components/apphost.js index a54b695cb8..8de18f166f 100644 --- a/src/components/apphost.js +++ b/src/components/apphost.js @@ -140,7 +140,6 @@ define(["appSettings", "browser", "events", "htmlMediaHelper"], function(appSett (browser.tv || browser.xboxOne || browser.ps4 || browser.mobile) && features.push("physicalvolumecontrol"); browser.tv || browser.xboxOne || browser.ps4 || features.push("remotecontrol"); browser.operaTv || browser.tizen || browser.orsay || browser.web0s || browser.edgeUwp || features.push("remotevideo"); - // might require isNativeApp check if any other issues surface features.push("displaylanguage"); features.push("otherapppromotions"); features.push("targetblank"); diff --git a/src/login.html b/src/login.html index f6fcf8f4a4..100dc7a3b9 100644 --- a/src/login.html +++ b/src/login.html @@ -36,24 +36,20 @@

${HeaderPleaseSignIn}

- -
- -
+ + -
- - ${ButtonChangeServer} - -
+ + ${ButtonChangeServer} +

diff --git a/src/scripts/addpluginpage.js b/src/scripts/addpluginpage.js index a7274bb4e5..d2d8f35804 100644 --- a/src/scripts/addpluginpage.js +++ b/src/scripts/addpluginpage.js @@ -28,28 +28,27 @@ define(["jQuery", "loading", "libraryMenu", "globalize", "connectionManager", "e } function renderPluginInfo(page, pkg, pluginSecurityInfo) { - if (!AppInfo.isNativeApp) - if (pkg.isPremium) { - $(".premiumPackage", page).show(); - var regStatus = ""; - if (pkg.isRegistered) regStatus += "

", regStatus += globalize.translate("MessageFeatureIncludedWithSupporter"); - else { - var expDateTime = new Date(pkg.expDate).getTime(), - nowTime = (new Date).getTime(); - expDateTime <= nowTime ? (regStatus += "

", regStatus += globalize.translate("MessageTrialExpired")) : expDateTime > new Date(1970, 1, 1).getTime() && (regStatus += "

", regStatus += globalize.translate("MessageTrialWillExpireIn").replace("{0}", Math.round(expDateTime - nowTime) / 864e5)) - } - if (regStatus += "

", $("#regStatus", page).html(regStatus), pluginSecurityInfo.IsMBSupporter) - if ($(".premiumDescription", page).hide(), $(".supporterDescription", page).hide(), pkg.price > 0) { - $(".premiumHasPrice", page).show(), $("#featureId", page).val(pkg.featureId), $("#featureName", page).val(pkg.name), $("#amount", page).val(pkg.price), $("#regPrice", page).html("

" + globalize.translate("ValuePriceUSD").replace("{0}", "$" + pkg.price.toFixed(2)) + "

"), $("#ppButton", page).hide(); - var url = "https://mb3admin.local/admin/service/user/getPayPalEmail?id=" + pkg.owner; - fetch(url).then(function(response) { - return response.json() - }).then(function(dev) { - dev.payPalEmail && ($("#payPalEmail", page).val(dev.payPalEmail), $("#ppButton", page).show()) - }) - } else $(".premiumHasPrice", page).hide(); - else pkg.price ? ($(".premiumDescription", page).show(), $(".supporterDescription", page).hide()) : ($(".premiumDescription", page).hide(), $(".supporterDescription", page).show()), $("#ppButton", page).hide() - } else $(".premiumPackage", page).hide() + if (pkg.isPremium) { + $(".premiumPackage", page).show(); + var regStatus = ""; + if (pkg.isRegistered) regStatus += "

", regStatus += globalize.translate("MessageFeatureIncludedWithSupporter"); + else { + var expDateTime = new Date(pkg.expDate).getTime(), + nowTime = (new Date).getTime(); + expDateTime <= nowTime ? (regStatus += "

", regStatus += globalize.translate("MessageTrialExpired")) : expDateTime > new Date(1970, 1, 1).getTime() && (regStatus += "

", regStatus += globalize.translate("MessageTrialWillExpireIn").replace("{0}", Math.round(expDateTime - nowTime) / 864e5)) + } + if (regStatus += "

", $("#regStatus", page).html(regStatus), pluginSecurityInfo.IsMBSupporter) + if ($(".premiumDescription", page).hide(), $(".supporterDescription", page).hide(), pkg.price > 0) { + $(".premiumHasPrice", page).show(), $("#featureId", page).val(pkg.featureId), $("#featureName", page).val(pkg.name), $("#amount", page).val(pkg.price), $("#regPrice", page).html("

" + globalize.translate("ValuePriceUSD").replace("{0}", "$" + pkg.price.toFixed(2)) + "

"), $("#ppButton", page).hide(); + var url = "https://mb3admin.local/admin/service/user/getPayPalEmail?id=" + pkg.owner; + fetch(url).then(function(response) { + return response.json() + }).then(function(dev) { + dev.payPalEmail && ($("#payPalEmail", page).val(dev.payPalEmail), $("#ppButton", page).show()) + }) + } else $(".premiumHasPrice", page).hide(); + else pkg.price ? ($(".premiumDescription", page).show(), $(".supporterDescription", page).hide()) : ($(".premiumDescription", page).hide(), $(".supporterDescription", page).show()), $("#ppButton", page).hide() + } else $(".premiumPackage", page).hide() } function renderPackage(pkg, installedPlugins, pluginSecurityInfo, page) { diff --git a/src/scripts/librarymenu.js b/src/scripts/librarymenu.js index 5ec50a6d9e..f4d428bb2d 100644 --- a/src/scripts/librarymenu.js +++ b/src/scripts/librarymenu.js @@ -198,12 +198,10 @@ define(["dom", "layoutManager", "inputManager", "connectionManager", "events", " html += ""; if (user.localUser) { html += 'settings' + globalize.translate("ButtonSettings") + ""; - } - if (AppInfo.isNativeApp) { html += 'wifi' + globalize.translate("ButtonSelectServer") + ""; - } - if (user.localUser && !user.localUser.EnableAutoLogin) { - html += 'exit_to_app' + globalize.translate("ButtonSignOut") + ""; + if (!localUser.EnableAutoLogin) { + html += 'exit_to_app' + globalize.translate("ButtonSignOut") + ""; + } } html += ""; diff --git a/src/scripts/loginpage.js b/src/scripts/loginpage.js index 04a332dbd7..e6069f8e17 100644 --- a/src/scripts/loginpage.js +++ b/src/scripts/loginpage.js @@ -89,9 +89,10 @@ define(["appSettings", "dom", "connectionManager", "loading", "cardStyle", "emby var apiClient = getApiClient(); apiClient.getPublicUsers().then(function(users) { users.length ? users.length && users[0].EnableAutoLogin ? authenticateUserByName(view, apiClient, users[0].Name, "") : (showVisualForm(), loadUserList(view, apiClient, users)) : (view.querySelector("#txtManualName").value = "", showManualForm(view, !1, !1)), loading.hide() - }), apiClient.getJSON(apiClient.getUrl("Branding/Configuration")).then(function(options) { + }); + apiClient.getJSON(apiClient.getUrl("Branding/Configuration")).then(function(options) { view.querySelector(".disclaimer").textContent = options.LoginDisclaimer || "" - }), AppInfo.isNativeApp ? view.querySelector(".connectButtons").classList.remove("hide") : view.querySelector(".connectButtons").classList.add("hide") - }) + }); + }); } }); \ No newline at end of file diff --git a/src/scripts/mypreferencescommon.js b/src/scripts/mypreferencescommon.js index accbae3784..c30d6f723a 100644 --- a/src/scripts/mypreferencescommon.js +++ b/src/scripts/mypreferencescommon.js @@ -21,6 +21,7 @@ define(["apphost", "connectionManager", "listViewStyle", "emby-linkbutton"], fun } else { page.querySelector(".selectServer").classList.add("hide"); } + connectionManager.user(ApiClient).then(function(user) { if (user.localUser && !user.localUser.EnableAutoLogin) { view.querySelector(".btnLogout").classList.remove("hide"); diff --git a/src/scripts/site.js b/src/scripts/site.js index cb529b0bb9..72c247b6d8 100644 --- a/src/scripts/site.js +++ b/src/scripts/site.js @@ -57,8 +57,8 @@ var Dashboard = { onServerChanged: function(userId, accessToken, apiClient) { apiClient = apiClient || window.ApiClient, window.ApiClient = apiClient }, - logout: function(logoutWithServer) { - function onLogoutDone() { + logout: function() { + ConnectionManager.logout().then(function() { var loginPage; if (AppInfo.isNativeApp) { loginPage = "selectserver.html"; @@ -67,7 +67,7 @@ var Dashboard = { loginPage = "login.html"; } Dashboard.navigate(loginPage); - }!1 === logoutWithServer ? onLogoutDone() : ConnectionManager.logout().then(onLogoutDone) + } }, getConfigurationPageUrl: function(name) { return "configurationpage?name=" + encodeURIComponent(name) @@ -946,10 +946,18 @@ var Dashboard = { function onWebComponentsReady(browser) { var initialDependencies = []; - window.Promise && !browser.web0s || initialDependencies.push("bower_components/emby-webcomponents/native-promise-only/lib/npo.src"), initRequireWithBrowser(browser), "cordova" !== self.appMode && "android" !== self.appMode || (AppInfo.isNativeApp = !0), require(initialDependencies, init) + if (!window.Promise || browser.web0s) { + initialDependencies.push("bower_components/emby-webcomponents/native-promise-only/lib/npo.src"); + } + initRequireWithBrowser(browser); + if (self.appMode === 'cordova' || self.appMode === 'android' || self.appMode === 'standalone') { + AppInfo.isNativeApp = true; + } + require(initialDependencies, init); } + var localApiClient; - ! function() { + return function() { var urlArgs = "v=" + (window.dashboardVersion || (new Date).getDate()); var bowerPath = getBowerPath(); var apiClientBowerPath = bowerPath + "/emby-apiclient"; @@ -1236,7 +1244,7 @@ var Dashboard = { }, appRouter.showVideoOsd = function() { return Dashboard.navigate("videoosd.html") }, appRouter.showSelectServer = function() { - AppInfo.isNativeApp ? Dashboard.navigate("selectserver.html") : Dashboard.navigate("login.html") + Dashboard.navigate(AppInfo.isNativeApp ? "selectserver.html" : "login.html") }, appRouter.showWelcome = function() { Dashboard.navigate(AppInfo.isNativeApp ? "selectserver.html" : "login.html") }, appRouter.showSettings = function() {