diff --git a/apps/client-standalone/src/lightweight/browser_routes.ts b/apps/client-standalone/src/lightweight/browser_routes.ts index b47974ecd..f4e3befd9 100644 --- a/apps/client-standalone/src/lightweight/browser_routes.ts +++ b/apps/client-standalone/src/lightweight/browser_routes.ts @@ -58,6 +58,7 @@ function bootstrapRoute() { const assetPath = "."; return { + triliumVersion: "1.2.3", assetPath, baseApiUrl: "../api/", themeCssUrl: null, @@ -67,6 +68,7 @@ function bootstrapRoute() { layoutOrientation: "vertical", platform: "web", isElectron: false, + isStandalone: true, hasNativeTitleBar: false, hasBackgroundEffects: true, currentLocale: { id: "en", rtl: false }, diff --git a/apps/client/src/services/utils.ts b/apps/client/src/services/utils.ts index 74de00884..055067009 100644 --- a/apps/client/src/services/utils.ts +++ b/apps/client/src/services/utils.ts @@ -133,6 +133,8 @@ export function isElectron() { return !!(window && window.process && window.process.type); } +export const isStandalone = window.glob.isStandalone; + /** * Returns `true` if the client is running as a PWA, otherwise `false`. */ @@ -814,7 +816,7 @@ function compareVersions(v1: string, v2: string): number { /** * Compares two semantic version strings and returns `true` if the latest version is greater than the current version. */ -function isUpdateAvailable(latestVersion: string | null | undefined, currentVersion: string): boolean { +export function isUpdateAvailable(latestVersion: string | null | undefined, currentVersion: string): boolean { if (!latestVersion) { return false; } diff --git a/apps/client/src/types.d.ts b/apps/client/src/types.d.ts index 4572c4030..4985eb624 100644 --- a/apps/client/src/types.d.ts +++ b/apps/client/src/types.d.ts @@ -36,6 +36,7 @@ interface CustomGlobals { isProtectedSessionAvailable: boolean; isDev: boolean; isMainWindow: boolean; + isStandalone?: boolean; maxEntityChangeIdAtLoad: number; maxEntityChangeSyncIdAtLoad: number; assetPath: string; diff --git a/apps/client/src/widgets/buttons/global_menu.tsx b/apps/client/src/widgets/buttons/global_menu.tsx index 255cf89c9..732286a36 100644 --- a/apps/client/src/widgets/buttons/global_menu.tsx +++ b/apps/client/src/widgets/buttons/global_menu.tsx @@ -8,7 +8,7 @@ import { CommandNames } from "../../components/app_context"; import Component from "../../components/component"; import { ExperimentalFeature, ExperimentalFeatureId, experimentalFeatures, isExperimentalFeatureEnabled, toggleExperimentalFeature } from "../../services/experimental_features"; import { t } from "../../services/i18n"; -import utils, { dynamicRequire, isElectron, isMobile, reloadFrontendApp } from "../../services/utils"; +import utils, { dynamicRequire, isElectron, isMobile, isStandalone, reloadFrontendApp } from "../../services/utils"; import Dropdown from "../react/Dropdown"; import { FormDropdownDivider, FormDropdownSubmenu, FormListHeader, FormListItem } from "../react/FormList"; import { useStaticTooltip, useStaticTooltipWithKeyboardShortcut, useTriliumOption, useTriliumOptionBool, useTriliumOptionInt } from "../react/hooks"; @@ -249,7 +249,7 @@ function ToggleWindowOnTop() { function useTriliumUpdateStatus() { const [ latestVersion, setLatestVersion ] = useState(); const [ checkForUpdates ] = useTriliumOptionBool("checkForUpdates"); - const isUpdateAvailable = utils.isUpdateAvailable(latestVersion, glob.triliumVersion); + const isUpdateAvailable = utils.isUpdateAvailable(latestVersion, window.glob.triliumVersion); async function updateVersionStatus() { const RELEASES_API_URL = "https://api.github.com/repos/TriliumNext/Trilium/releases/latest"; @@ -267,7 +267,7 @@ function useTriliumUpdateStatus() { } useEffect(() => { - if (!checkForUpdates) { + if (!checkForUpdates || !isStandalone) { setLatestVersion(undefined); return; }