diff --git a/.eslintrc.js b/.eslintrc.js index d0c5cef897..21ac86277a 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -81,7 +81,6 @@ module.exports = { 'requirejs': 'readonly', // Jellyfin globals 'ApiClient': 'writable', - 'AppInfo': 'writable', 'chrome': 'writable', 'DlnaProfilePage': 'writable', 'Dashboard': 'writable', diff --git a/src/components/AppInfo.js b/src/components/AppInfo.js new file mode 100644 index 0000000000..a89c55d0b1 --- /dev/null +++ b/src/components/AppInfo.js @@ -0,0 +1,4 @@ + +export default { + isNativeApp: false +}; diff --git a/src/components/appRouter.js b/src/components/appRouter.js index e396cfcb08..e93d4d825d 100644 --- a/src/components/appRouter.js +++ b/src/components/appRouter.js @@ -8,6 +8,7 @@ import itemHelper from './itemHelper'; import loading from './loading/loading'; import page from 'page'; import viewManager from './viewManager/viewManager'; +import AppInfo from './AppInfo'; class AppRouter { allRoutes = []; diff --git a/src/controllers/dashboard/general.js b/src/controllers/dashboard/general.js index fb7b1c59d5..e181ae42b6 100644 --- a/src/controllers/dashboard/general.js +++ b/src/controllers/dashboard/general.js @@ -6,6 +6,7 @@ import '../../elements/emby-textarea/emby-textarea'; import '../../elements/emby-input/emby-input'; import '../../elements/emby-select/emby-select'; import '../../elements/emby-button/emby-button'; +import AppInfo from '../../components/AppInfo'; /* eslint-disable indent */ diff --git a/src/scripts/clientUtils.js b/src/scripts/clientUtils.js index 024ffd7d4f..c9eaf7fc59 100644 --- a/src/scripts/clientUtils.js +++ b/src/scripts/clientUtils.js @@ -1,3 +1,5 @@ +import AppInfo from '../components/AppInfo'; + export function getCurrentUser() { return window.ApiClient.getCurrentUser(false); } diff --git a/src/scripts/site.js b/src/scripts/site.js index c0fedd3ebc..3643ca1d43 100644 --- a/src/scripts/site.js +++ b/src/scripts/site.js @@ -8,6 +8,7 @@ import 'whatwg-fetch'; import 'resize-observer-polyfill'; import 'jellyfin-noto'; import '../assets/css/site.css'; +import AppInfo from '../components/AppInfo'; // TODO: Move this elsewhere window.getWindowLocationSearch = function(win) { @@ -60,7 +61,11 @@ window.pageIdOn = function(eventName, id, fn) { }); }; -const AppInfo = {}; +if (self.appMode === 'cordova' || self.appMode === 'android' || self.appMode === 'standalone') { + AppInfo.isNativeApp = true; +} + +Object.freeze(AppInfo); function initClient() { function bindConnectionManagerEvents(connectionManager, events, userSettings) { @@ -95,7 +100,7 @@ function initClient() { import('../components/apphost'), import('./settings/userSettings') ]) - .then(([{ ConnectionManager, Credentials, Events }, { appHost} , userSettings]) => { + .then(([{ ConnectionManager, Credentials, Events }, { appHost }, userSettings]) => { var credentialProviderInstance = new Credentials(); var promises = [appHost.init()]; @@ -202,7 +207,7 @@ function initClient() { import('../assets/css/fonts.css'); } - import('../assets/css/librarybrowser.css') + import('../assets/css/librarybrowser.css'); import('../components/apphost') .then(({ appHost }) => { loadPlugins(appHost, browser).then(function () { @@ -365,10 +370,6 @@ function initClient() { let localApiClient; - if (self.appMode === 'cordova' || self.appMode === 'android' || self.appMode === 'standalone') { - AppInfo.isNativeApp = true; - } - init(); }