fix(desktop): hide Check for updates in offline builds (#4234)

This commit is contained in:
Ken VanDine authored and GitHub committed 2026-11-19 19:28:49 +01:00
1 parent eddf33b01e
commit 234e838dd1
4 files changed
+23 -8

No files matched your search

+1 -1
View File
@@ -108,7 +108,7 @@ The result is in `fluxer_desktop/dist-electron/linux-unpacked/`, or `linux-arm64
| `BUILD_CHANNEL` | `stable` | `stable`, `canary` or `development`. It picks the app name, app ID, icons, data directory and the instance the app opens. The build passes the same value to the web app. |
| `BUILD_VERSION` | empty | The release version. Without it the app reports a development version. |
| `NODE_ENV` | `development` | Set it to `production` for minified bundles and release native builds. |
| `FLUXER_OFFLINE` | off | `1` turns off the built-in updater and the app's own `.desktop` file, gives the app its own data directory (see [Desktop integration](#desktop-integration)) and turns the WebAssembly size budgets into warnings. Distribution builds should set it. |
| `FLUXER_OFFLINE` | off | `1` turns off the built-in updater, its "Check for updates" menu items and the app's own `.desktop` file, gives the app its own data directory (see [Desktop integration](#desktop-integration)) and turns the WebAssembly size budgets into warnings. Distribution builds should set it. |
| `FLUXER_LAUNCH_COMMAND` | empty | The command your package installs, such as `fluxer` or `/usr/bin/fluxer`. The app writes it into the autostart entry when the user turns on start at login. Without it the app writes the path of the running Electron binary, which is wrong when you start a system Electron with a wrapper, and goes stale when that path changes with each update. A plain command name is looked up on `PATH`. |
| `FLUXER_ALLOW_STOCK_ELECTRON` | off | `1` lets electron-builder package any Electron with the same major version as ours. See [Electron](#electron). |
| `FLUXER_SYSTEM_LIBS` | off | `1` stops the build from copying libfido2 and its dependencies next to the webauthn module, so it uses the system libraries. |
+6 -3
View File
@@ -20,9 +20,12 @@ import {
import {buildAccountMenuEntries, buildAccountMenuItems, createRefreshThrottle} from '@electron/main/AccountMenu';
import {getAppResourcesPath} from '@electron/main/DesktopDistributionPath';
import {getDesktopUpdateState, observeDesktopUpdateState} from '@electron/main/DesktopUpdateGate';
import {checkForUpdatesFromShell, startDesktopUpdateFromShell} from '@electron/main/DesktopUpdatePrompt';
import {
canCheckForUpdatesFromShell,
checkForUpdatesFromShell,
startDesktopUpdateFromShell,
} from '@electron/main/DesktopUpdatePrompt';
import {readKdePanelDark, readKdePanelDarkSync, watchKdePanelTheme} from '@electron/main/KdePanelTheme';
import {shouldDisableModuleUpdatesForLaunch} from '@electron/main/LaunchOptions';
import {relaunchStableLaunchPath} from '@electron/main/LinuxLaunchPath';
import {getLinuxDesktop} from '@electron/main/LinuxSession';
import {onLocaleChange, t} from '@electron/main/MainI18n';
@@ -536,7 +539,7 @@ function buildTrayMenu(): Menu {
click: () => runTrayMenuAction(startDesktopUpdateFromShell),
});
}
if (!shouldDisableModuleUpdatesForLaunch()) {
if (canCheckForUpdatesFromShell()) {
menuTemplate.push({
label: t('desktop.tray.checkForUpdates'),
click: () =>
@@ -3,12 +3,14 @@
import {DESKTOP_APP_NAME} from '@electron/common/DesktopIdentity';
import {errorMessage as describeError} from '@electron/common/ErrorMessage';
import {createChildLogger} from '@electron/common/Logger';
import {IS_OFFLINE_BUILD} from '@electron/common/OfflineBuild';
import {
checkDesktopUpdateNow,
desktopUpdateReplacesShell,
getDesktopUpdateState,
startDesktopUpdate,
} from '@electron/main/DesktopUpdateGate';
import {shouldDisableModuleUpdatesForLaunch} from '@electron/main/LaunchOptions';
import {getFlatpakAppId, isFlatpakRuntime} from '@electron/main/LinuxSandbox';
import {t} from '@electron/main/MainI18n';
import {openExternalDeduped} from '@electron/main/OpenExternal';
@@ -133,7 +135,14 @@ async function offerDesktopUpdate(): Promise<void> {
}
}
export function canCheckForUpdatesFromShell(): boolean {
return !IS_OFFLINE_BUILD && !shouldDisableModuleUpdatesForLaunch();
}
export function checkForUpdatesFromShell(): Promise<void> {
if (IS_OFFLINE_BUILD) {
return Promise.resolve();
}
checking ??= runUpdateCheck()
.catch((error: unknown) => {
logger.error('The native update prompt failed', error);
@@ -156,6 +165,10 @@ export function startDesktopUpdateFromShell(): void {
}
export async function updateFromCommandLine(): Promise<void> {
if (IS_OFFLINE_BUILD) {
logger.info('The command line asked for an update, but this build is updated by its package manager');
return;
}
try {
const state = await checkDesktopUpdateNow({manual: true});
if (!state.available) {
+3 -4
View File
@@ -1,8 +1,7 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
import {DESKTOP_APP_NAME} from '@electron/common/DesktopIdentity';
import {checkForUpdatesFromShell} from '@electron/main/DesktopUpdatePrompt';
import {shouldDisableModuleUpdatesForLaunch} from '@electron/main/LaunchOptions';
import {canCheckForUpdatesFromShell, checkForUpdatesFromShell} from '@electron/main/DesktopUpdatePrompt';
import {onLocaleChange, t} from '@electron/main/MainI18n';
import {openExternalDeduped} from '@electron/main/OpenExternal';
import {buildTroubleshootingMenuItems} from '@electron/main/Troubleshooting';
@@ -32,7 +31,7 @@ function buildTemplate(): Array<MenuItemConstructorOptions> {
role: 'about',
label: t('desktop.appMenu.about', {appName}),
},
...(shouldDisableModuleUpdatesForLaunch() ? [] : [checkForUpdatesItem()]),
...(canCheckForUpdatesFromShell() ? [checkForUpdatesItem()] : []),
{type: 'separator'},
{
label: t('desktop.appMenu.preferences'),
@@ -224,7 +223,7 @@ function buildTemplate(): Array<MenuItemConstructorOptions> {
? `${t('desktop.appMenu.help')}${MACOS_HELP_MENU_TITLE_AUTODETECT_OPT_OUT}`
: t('desktop.appMenu.help'),
submenu: [
...(isMac || shouldDisableModuleUpdatesForLaunch() ? [] : [checkForUpdatesItem(), {type: 'separator' as const}]),
...(isMac || !canCheckForUpdatesFromShell() ? [] : [checkForUpdatesItem(), {type: 'separator' as const}]),
{
label: t('desktop.appMenu.website'),
click: async () => {