Add option to disable automatic update install

Adds a new settings option in the interface section to disable to
automatic installation of updates when installed as an Electron app. The
setting defaults to false.

Closes #832
This commit is contained in:
Lenny Angst
2025-07-19 14:52:14 +02:00
parent 29c281f62f
commit 617e40c1fb
10 changed files with 38 additions and 7 deletions
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "Materialious",
"version": "1.9.19",
"version": "1.9.20",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "Materialious",
"version": "1.9.19",
"version": "1.9.20",
"license": "MIT",
"dependencies": {
"@capacitor-community/electron": "^5.0.0",
+6 -2
View File
@@ -58,8 +58,6 @@ let allowInsecureSSL = false;
setupContentSecurityPolicy(myCapacitorApp.getCustomURLScheme());
// Initialize our app, build windows, and load content.
await myCapacitorApp.init();
// Check for updates if we are in a packaged app.
autoUpdater.checkForUpdatesAndNotify();
})();
app.on('certificate-error', (event, webContents, url, error, certificate, callback) => {
@@ -167,3 +165,9 @@ ipcMain.handle('setAllowInsecureSSL', async (_, allow) => {
return allowInsecureSSL;
});
ipcMain.handle('doUpdateCheck', (_, disableAutoUpdate) => {
// Check for updates if we are in a packaged app.
autoUpdater.autoInstallOnAppQuit = !disableAutoUpdate
autoUpdater.checkForUpdatesAndNotify();
})
+2 -1
View File
@@ -8,5 +8,6 @@ contextBridge.exposeInMainWorld('electronAPI', {
ipcRenderer.invoke('generatePoToken', bgChallenge, requestKey, visitorData),
setAllowInsecureSSL: async (allow: boolean) => {
return await ipcRenderer.invoke('setAllowInsecureSSL', allow);
}
},
doUpdateCheck: (disableAutoUpdate) => ipcRenderer.invoke('doUpdateCheck', disableAutoUpdate)
});
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "materialious",
"version": "1.9.19",
"version": "1.9.20",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "materialious",
"version": "1.9.19",
"version": "1.9.20",
"hasInstallScript": true,
"dependencies": {
"@capacitor-community/electron": "^5.0.1",
+1
View File
@@ -19,6 +19,7 @@ declare global {
visitorData: string
) => Promise<string>;
setAllowInsecureSSL: (allowInsecureSSL: boolean) => Promoise<boolean>;
doUpdateCheck: (disableAutoUpdate: boolean) => Promise<void>;
};
}
}
@@ -21,6 +21,7 @@
interfaceAutoExpandComments,
interfaceAutoExpandDesc,
interfaceDefaultPage,
interfaceDisableAutoUpdate,
interfaceForceCase,
interfaceLowBandwidthMode,
interfaceRegionStore,
@@ -288,6 +289,24 @@
</nav>
</div>
{#if Capacitor.getPlatform() == 'electron'}
<div class="field no-margin">
<nav class="no-padding">
<div class="max">
<div>{$_('layout.disableAutoUpdate')}</div>
</div>
<label class="switch" tabindex="0" role="switch">
<input
type="checkbox"
bind:checked={$interfaceDisableAutoUpdate}
onclick={() => interfaceDisableAutoUpdate.set(!$interfaceDisableAutoUpdate)}
/>
<span></span>
</label>
</nav>
</div>
{/if}
<div class="field label suffix border">
<select
tabindex="0"
@@ -124,6 +124,7 @@
"previewVideoOnHover": "Video-Vorschau beim Hovern",
"expandDescription": "Beschreibung standardmäßig erweitern",
"expandComments": "Kommentare standardmäßig erweitern",
"disableAutoUpdate": "Automatische Installation von Updates deaktivieren",
"dataPreferences": {
"content": "Du möchtest Abonnements importieren/exportieren, dein Passwort ändern oder dein Konto löschen? Klicke hier und scrolle bis zum Ende der Seite.",
"dataPreferences": "Dateneinstellungen"
@@ -136,6 +136,7 @@
"expandChapters": "Expand chapters by default",
"expandComments": "Expand comments by default",
"allowInsecureRequests": "Allow insecure requests",
"disableAutoUpdate": "Disable automatic update installation",
"dataPreferences": {
"content": "Looking to import/export subscriptions, change password or delete account? Click here and scroll to the bottom of the page.",
"dataPreferences": "Data preferences"
+1
View File
@@ -92,6 +92,7 @@ export const interfaceDisplayThumbnailAvatars = persisted('disableThumbnailAvata
export const interfaceDefaultPage = persisted('defaultPage', '/');
export const interfaceSearchHistoryEnabled = persisted('searchHistoryEnabled', false);
export const interfaceAllowInsecureRequests = persisted('allowInsecureRequests', false);
export const interfaceDisableAutoUpdate = persisted('disableAutoUpdate', false)
export const sponsorBlockStore = persisted('sponsorBlock', true);
export const sponsorBlockUrlStore: Writable<string | null | undefined> = persisted(
@@ -20,6 +20,7 @@
instanceStore,
interfaceAmoledTheme,
interfaceDefaultPage,
interfaceDisableAutoUpdate,
isAndroidTvStore,
syncPartyPeerStore,
themeColorStore
@@ -210,6 +211,8 @@
if (isLoggedIn) {
loadNotifications().catch(() => authStore.set(null));
}
window.electronAPI.doUpdateCheck($interfaceDisableAutoUpdate)
});
function linkClickOverwrite(event: MouseEvent) {