diff --git a/.eslintrc.js b/.eslintrc.js index 2b65ee767b..a123939b44 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -264,6 +264,8 @@ module.exports = { 'Windows': 'readonly', // Build time definitions __JF_BUILD_VERSION__: 'readonly', + __PACKAGE_JSON_NAME__: 'readonly', + __PACKAGE_JSON_VERSION__: 'readonly', __USE_SYSTEM_FONTS__: 'readonly', __WEBPACK_SERVE__: 'readonly' }, diff --git a/src/components/apphost.js b/src/components/apphost.js index 053b846374..8df5884bb1 100644 --- a/src/components/apphost.js +++ b/src/components/apphost.js @@ -1,4 +1,3 @@ -import Package from '../../package.json'; import appSettings from '../scripts/settings/appSettings'; import browser from '../scripts/browser'; import Events from '../utils/events.ts'; @@ -36,7 +35,7 @@ function getDeviceProfile(item) { let profile; if (window.NativeShell) { - profile = window.NativeShell.AppHost.getDeviceProfile(profileBuilder, Package.version); + profile = window.NativeShell.AppHost.getDeviceProfile(profileBuilder, __PACKAGE_JSON_VERSION__); } else { const builderOpts = getBaseProfileOptions(item); profile = profileBuilder(builderOpts); @@ -378,7 +377,7 @@ export const appHost = { }, appVersion: function () { return window.NativeShell?.AppHost?.appVersion ? - window.NativeShell.AppHost.appVersion() : Package.version; + window.NativeShell.AppHost.appVersion() : __PACKAGE_JSON_VERSION__; }, getPushTokenInfo: function () { return {}; diff --git a/src/controllers/dashboard/dashboard.js b/src/controllers/dashboard/dashboard.js index 3ce4e85160..c85fdec6d6 100644 --- a/src/controllers/dashboard/dashboard.js +++ b/src/controllers/dashboard/dashboard.js @@ -26,8 +26,6 @@ import { getSystemInfoQuery } from 'hooks/useSystemInfo'; import { toApi } from 'utils/jellyfin-apiclient/compat'; import { queryClient } from 'utils/query/queryClient'; -import { version as WEB_VERSION } from '../../../package.json'; - import '../../elements/emby-button/emby-button'; import '../../elements/emby-itemscontainer/emby-itemscontainer'; @@ -210,7 +208,7 @@ function refreshActiveRecordings(view, apiClient) { function reloadSystemInfo(view, apiClient) { view.querySelector('#buildVersion').innerText = __JF_BUILD_VERSION__; - view.querySelector('#webVersion').innerText = WEB_VERSION; + view.querySelector('#webVersion').innerText = __PACKAGE_JSON_VERSION__; queryClient .fetchQuery(getSystemInfoQuery(toApi(apiClient))) diff --git a/src/global.d.ts b/src/global.d.ts index 7d9fad7d73..40a8e170f4 100644 --- a/src/global.d.ts +++ b/src/global.d.ts @@ -16,6 +16,8 @@ export declare global { } const __JF_BUILD_VERSION__: string; + const __PACKAGE_JSON_NAME__: string; + const __PACKAGE_JSON_VERSION__: string; const __USE_SYSTEM_FONTS__: string; const __WEBPACK_SERVE__: string; } diff --git a/src/index.jsx b/src/index.jsx index 9d66a09838..3d65bae640 100644 --- a/src/index.jsx +++ b/src/index.jsx @@ -59,6 +59,9 @@ function loadCoreDictionary() { } function init() { + // Log current version to console to help out with issue triage and debugging + console.log(`${__PACKAGE_JSON_NAME__} version ${__PACKAGE_JSON_VERSION__} build ${__JF_BUILD_VERSION__}`); + // This is used in plugins window.Events = Events; window.TaskButton = taskButton; diff --git a/webpack.common.js b/webpack.common.js index fef8db8a67..ca432d895f 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -5,6 +5,7 @@ const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const { DefinePlugin } = require('webpack'); +const packageJson = require('./package.json'); const Assets = [ 'native-promise-only/npo.js', @@ -51,6 +52,8 @@ const config = { process.env.WEBPACK_SERVE ? 'Dev Server' : process.env.JELLYFIN_VERSION || 'Release'), + __PACKAGE_JSON_NAME__: JSON.stringify(packageJson.name), + __PACKAGE_JSON_VERSION__: JSON.stringify(packageJson.version), __USE_SYSTEM_FONTS__: JSON.stringify(!!process.env.USE_SYSTEM_FONTS), __WEBPACK_SERVE__: JSON.stringify(!!process.env.WEBPACK_SERVE) }),