Skip to content

A local-first personal finance app

:electron: Remove "About" screen and broken updater (#2983)

Michael Clarkf36c5e002b40
diff --git a/packages/desktop-electron/about.js b/packages/desktop-electron/about.js
deleted file mode 100644
index 54809a5419..0000000000
--- a/packages/desktop-electron/about.js
+++ /dev/null
@@ -1,31 +0,0 @@
-const { BrowserWindow } = require('electron');
-const isDev = require('electron-is-dev');
-
-let window;
-
-function openAboutWindow() {
- if (window != null) {
- window.focus();
- return window;
- }
-
- window = new BrowserWindow({
- width: 290,
- height: process.platform === 'win32' ? 255 : 240,
- show: true,
- resizable: isDev,
- webPreferences: {
- nodeIntegration: true,
- contextIsolation: false,
- },
- });
- window.setBackgroundColor('white');
- window.setTitle('');
- window.loadURL(`file://${__dirname}/about/about.html`);
-
- window.once('closed', () => {
- window = null;
- });
-}
-
-module.exports = { openAboutWindow, getWindow: () => window };
diff --git a/packages/desktop-electron/about/about.html b/packages/desktop-electron/about/about.html
deleted file mode 100644
index 7452f5f12b..0000000000
--- a/packages/desktop-electron/about/about.html
+++ /dev/null
@@ -1,16 +0,0 @@
-<!DOCTYPE html>
-<html>
- <head>
- <style type="text/css">
- body {
- font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif;
- color: #303030;
- font-size: 12px;
- }
- </style>
- </head>
- <body>
- <div id="root" />
- <script src="index.js"></script>
- </body>
-</html>
diff --git a/packages/desktop-electron/about/index.js b/packages/desktop-electron/about/index.js
deleted file mode 100644
index 06678cbbf3..0000000000
--- a/packages/desktop-electron/about/index.js
+++ /dev/null
@@ -1,94 +0,0 @@
-const { ipcRenderer } = require('electron');
-
-const root = document.querySelector('#root');
-
-const { version: appVersion } = ipcRenderer.sendSync('get-bootstrap-data');
-
-const iconPath = __dirname + '/../icons/icon.png';
-
-root.style.display = 'flex';
-root.style.flexDirection = 'column';
-root.style.alignItems = 'center';
-root.style.padding = '10px';
-root.innerHTML = `
- <img src="${iconPath}" width="60" height="60" />
- <strong style="font-size:14px; padding-top: 15px">Actual</strong>
- <div style="padding-bottom:15px; padding-top: 5px">Version ${appVersion}</div>
- <div id="container">
- <div id="update-check"><button>Check for updates</button></div>
- <div id="apply-update"><button>Restart to Update</button></div>
- <div id="success"></div>
- <div id="error"></div>
- </div>
-`;
-
-const container = root.querySelector('#container');
-container.style.height = '45px';
-container.style.textAlign = 'center';
-
-const updateEl = root.querySelector('#update-check');
-const applyUpdateEl = root.querySelector('#apply-update');
-applyUpdateEl.style.display = 'none';
-const successEl = root.querySelector('#success');
-successEl.style.display = 'none';
-successEl.style.textAlign = 'center';
-const errorEl = root.querySelector('#error');
-errorEl.style.display = 'none';
-
-root.querySelector('#update-check button').addEventListener('click', () => {
- ipcRenderer.send('check-for-update');
-});
-
-root.querySelector('#apply-update button').addEventListener('click', () => {
- ipcRenderer.send('apply-update');
-});
-
-ipcRenderer.on('update-checking', () => {
- updateEl.style.display = 'none';
- successEl.innerHTML = 'Checking...';
- successEl.style.display = 'block';
- errorEl.style.display = 'none';
-});
-
-ipcRenderer.on('update-available', () => {
- updateEl.style.display = 'none';
- successEl.innerHTML = 'Update available! Downloading...';
- successEl.style.display = 'block';
-});
-
-ipcRenderer.on('update-downloaded', () => {
- updateEl.style.display = 'none';
- successEl.style.display = 'none';
- applyUpdateEl.style.display = 'block';
-});
-
-ipcRenderer.on('update-not-available', () => {
- updateEl.style.display = 'none';
- successEl.innerHTML = 'All up to date!';
- successEl.style.display = 'block';
-});
-
-ipcRenderer.on('update-error', (event, msg) => {
- updateEl.style.display = 'block';
- successEl.style.display = 'none';
-
- let text;
- if (msg.domain === 'SQRLUpdaterErrorDomain' && msg.code === 8) {
- text = `
- Error updating the app. It looks like it’s running outside of the applications
- folder and can’t be written to. Please install the app before updating.
- `;
- } else {
- text = 'Error updating the app. Please try again later.';
- }
-
- errorEl.innerHTML = `<div style="text-align:center; color:#F65151">${text}</div>`;
- errorEl.style.display = 'block';
-});
-
-document.addEventListener('keydown', e => {
- // Disable zoom with keys + and -
- if (e.key === '+' || e.key === '-') {
- e.preventDefault();
- }
-});
diff --git a/packages/desktop-electron/index.ts b/packages/desktop-electron/index.ts
index 76f8b2d545..3b4206d9f4 100644
--- a/packages/desktop-electron/index.ts
+++ b/packages/desktop-electron/index.ts
@@ -16,9 +16,7 @@ import {
import isDev from 'electron-is-dev';
import promiseRetry from 'promise-retry';
-import about from './about';
import { getMenu } from './menu';
-import updater from './updater';
import {
get as getWindowState,
listen as listenToWindowState,
@@ -55,17 +53,6 @@ if (!isDev || !process.env.ACTUAL_DATA_DIR) {
let clientWin: BrowserWindow | null;
let serverProcess: UtilityProcess | null;
-updater.onEvent((type: string, data: Record<string, string> | string) => {
- // Notify both the app and the about window
- if (clientWin) {
- clientWin.webContents.send(type, data);
- }
-
- if (about.getWindow()) {
- about.getWindow().webContents.send(type, data);
- }
-});
-
if (isDev) {
process.traceProcessWarnings = true;
}
@@ -82,13 +69,6 @@ function createBackgroundProcess() {
case 'captureEvent':
case 'captureBreadcrumb':
break;
- case 'shouldAutoUpdate':
- if (msg.flag) {
- updater.start();
- } else {
- updater.stop();
- }
- break;
case 'reply':
case 'error':
case 'push':
@@ -331,10 +311,6 @@ ipcMain.handle('open-external-url', (event, url) => {
shell.openExternal(url);
});
-ipcMain.on('show-about', () => {
- about.openAboutWindow();
-});
-
ipcMain.on('message', (_event, msg) => {
if (!serverProcess) {
return;
@@ -354,23 +330,6 @@ ipcMain.on('screenshot', () => {
}
});
-ipcMain.on('check-for-update', () => {
- // If the updater is in the middle of an update already, send the
- // about window the current status
- if (updater.isChecking()) {
- // This should always come from the about window so we can
- // guarantee that it exists. If we ever see an error here
- // something is wrong
- about.getWindow().webContents.send(updater.getLastEvent());
- } else {
- updater.check();
- }
-});
-
-ipcMain.on('apply-update', () => {
- updater.apply();
-});
-
ipcMain.on('update-menu', (event, budgetId?: string) => {
updateMenu(budgetId);
});
diff --git a/packages/desktop-electron/menu.ts b/packages/desktop-electron/menu.ts
index 34ec10550f..33f4883dc6 100644
--- a/packages/desktop-electron/menu.ts
+++ b/packages/desktop-electron/menu.ts
@@ -182,27 +182,11 @@ export function getMenu(
},
];
- if (process.platform === 'win32') {
- // Add about to help menu on Windows
- (
- template[template.length - 1].submenu as MenuItemConstructorOptions[]
- ).unshift({
- label: 'About Actual',
- click() {
- ipcMain.emit('show-about');
- },
- });
- } else if (process.platform === 'darwin') {
+ if (process.platform === 'darwin') {
const name = app.getName();
template.unshift({
label: name,
submenu: [
- {
- label: 'About Actual',
- click() {
- ipcMain.emit('show-about');
- },
- },
isDev
? {
label: 'Screenshot',
diff --git a/packages/desktop-electron/package.json b/packages/desktop-electron/package.json
index 1134f506cd..ba1f60d541 100644
--- a/packages/desktop-electron/package.json
+++ b/packages/desktop-electron/package.json
@@ -58,7 +58,6 @@
"dependencies": {
"electron-is-dev": "2.0.0",
"electron-log": "4.4.8",
- "electron-updater": "6.1.7",
"loot-core": "*",
"node-fetch": "^2.7.0",
"promise-retry": "^2.0.1"
diff --git a/packages/desktop-electron/preload.js b/packages/desktop-electron/preload.js
index f5f63f059a..e4c75c0ff6 100644
--- a/packages/desktop-electron/preload.js
+++ b/packages/desktop-electron/preload.js
@@ -45,10 +45,6 @@ contextBridge.exposeInMainWorld('Actual', {
ipcRenderer.on(type, handler);
},
- applyAppUpdate: () => {
- ipcRenderer.send('apply-update');
- },
-
updateAppMenu: budgetId => {
ipcRenderer.send('update-menu', budgetId);
},
diff --git a/packages/desktop-electron/updater.js b/packages/desktop-electron/updater.js
deleted file mode 100644
index 5c95e745d1..0000000000
--- a/packages/desktop-electron/updater.js
+++ /dev/null
@@ -1,103 +0,0 @@
-const isDev = require('electron-is-dev');
-const { autoUpdater } = require('electron-updater');
-
-// Every 5 minutes
-const INTERVAL = 1000 * 60 * 5;
-let updateTimer = null;
-let isCheckingForUpdates = false;
-let emitEvent = null;
-let lastEvent;
-
-autoUpdater.on('checking-for-update', () => {
- isCheckingForUpdates = true;
- fireEvent('update-checking');
-});
-
-autoUpdater.on('update-available', () => {
- fireEvent('update-available');
-});
-
-autoUpdater.on('update-downloaded', info => {
- fireEvent('update-downloaded', {
- releaseNotes: info.releaseNotes,
- releaseName: info.releaseName,
- version: info.version,
- });
-});
-
-autoUpdater.on('update-not-available', () => {
- isCheckingForUpdates = false;
- fireEvent('update-not-available');
-});
-
-autoUpdater.on('error', message => {
- isCheckingForUpdates = false;
- // This is a common error, so don't report it. All sorts of reasons
- // why this can user that isn't our fault.
- console.log('There was a problem updating the application: ' + message);
- fireEvent('update-error', message);
-});
-
-function fireEvent(type, args) {
- emitEvent?.(type, args);
- lastEvent = type;
-}
-
-function start() {
- if (updateTimer) {
- return null;
- }
-
- if (!isDev) {
- console.log('Starting autoupdate check...');
-
- updateTimer = setInterval(() => {
- if (!isCheckingForUpdates) {
- autoUpdater.checkForUpdates().catch(() => {
- // Do nothing with the error (make sure it's not logged to sentry)
- });
- }
- }, INTERVAL);
- }
-}
-
-function onEvent(handler) {
- emitEvent = handler;
-}
-
-function stop() {
- console.log('Stopping autoupdate check...');
-
- clearInterval(updateTimer);
- updateTimer = null;
-}
-
-function check() {
- if (!isDev && !isCheckingForUpdates) {
- autoUpdater.checkForUpdates().catch(() => {
- // Do nothing with the error (make sure it's not logged to sentry)
- });
- }
-}
-
-function isChecking() {
- return isCheckingForUpdates;
-}
-
-function getLastEvent() {
- return lastEvent;
-}
-
-function apply() {
- autoUpdater.quitAndInstall();
-}
-
-module.exports = {
- start,
- stop,
- onEvent,
- apply,
- check,
- isChecking,
- getLastEvent,
-};
diff --git a/packages/loot-core/src/server/main.ts b/packages/loot-core/src/server/main.ts
index 44738736f8..c137cc123a 100644
--- a/packages/loot-core/src/server/main.ts
+++ b/packages/loot-core/src/server/main.ts
@@ -1216,13 +1216,6 @@ handlers['save-global-prefs'] = async function (prefs) {
if ('maxMonths' in prefs) {
await asyncStorage.setItem('max-months', '' + prefs.maxMonths);
}
- if ('autoUpdate' in prefs) {
- await asyncStorage.setItem('auto-update', '' + prefs.autoUpdate);
- process.parentPort.postMessage({
- type: 'shouldAutoUpdate',
- flag: prefs.autoUpdate,
- });
- }
if ('documentDir' in prefs) {
if (await fs.exists(prefs.documentDir)) {
await asyncStorage.setItem('document-dir', prefs.documentDir);
@@ -1241,14 +1234,12 @@ handlers['load-global-prefs'] = async function () {
const [
[, floatingSidebar],
[, maxMonths],
- [, autoUpdate],
[, documentDir],
[, encryptKey],
[, theme],
] = await asyncStorage.multiGet([
'floating-sidebar',
'max-months',
- 'auto-update',
'document-dir',
'encrypt-key',
'theme',
@@ -1256,7 +1247,6 @@ handlers['load-global-prefs'] = async function () {
return {
floatingSidebar: floatingSidebar === 'true' ? true : false,
maxMonths: stringToInteger(maxMonths || ''),
- autoUpdate: autoUpdate == null || autoUpdate === 'true' ? true : false,
documentDir: documentDir || getDefaultDocumentDir(),
keyId: encryptKey && JSON.parse(encryptKey).id,
theme:
@@ -2118,14 +2108,6 @@ export async function initApp(isDev, socketName) {
connection.init(socketName, app.handlers);
- if (!isDev && !Platform.isMobile && !Platform.isWeb) {
- const autoUpdate = await asyncStorage.getItem('auto-update');
- process.parentPort.postMessage({
- type: 'shouldAutoUpdate',
- flag: autoUpdate == null || autoUpdate === 'true',
- });
- }
-
// Allow running DB queries locally
global.$query = aqlQuery;
global.$q = q;
diff --git a/packages/loot-core/src/types/prefs.d.ts b/packages/loot-core/src/types/prefs.d.ts
index 68230ffea1..81c51951c0 100644
--- a/packages/loot-core/src/types/prefs.d.ts
+++ b/packages/loot-core/src/types/prefs.d.ts
@@ -61,7 +61,6 @@ export type Theme = 'light' | 'dark' | 'auto' | 'midnight' | 'development';
export type GlobalPrefs = Partial<{
floatingSidebar: boolean;
maxMonths: number;
- autoUpdate: boolean;
keyId?: string;
theme: Theme;
documentDir: string; // Electron only
diff --git a/upcoming-release-notes/2983.md b/upcoming-release-notes/2983.md
new file mode 100644
index 0000000000..a26f11fed6
--- /dev/null
+++ b/upcoming-release-notes/2983.md
@@ -0,0 +1,6 @@
+---
+category: Bugfix
+authors: [MikesGlitch]
+---
+
+Removed broken update functionality and "About" screen for Electron app
diff --git a/yarn.lock b/yarn.lock
index 345c0eed3f..3261a182b7 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -7345,16 +7345,6 @@ __metadata:
languageName: node
linkType: hard
-"builder-util-runtime@npm:9.2.3":
- version: 9.2.3
- resolution: "builder-util-runtime@npm:9.2.3"
- dependencies:
- debug: "npm:^4.3.4"
- sax: "npm:^1.2.4"
- checksum: 15f9618af1a2224d0ade19fa7dca12f80bc2ceeb4fc89242f2505b44f58d13d3439bb08a5bec865bb0f8e930fa57bd112d9ee9024f22f1654925ffe2bed3925b
- languageName: node
- linkType: hard
-
"builder-util-runtime@npm:9.2.4":
version: 9.2.4
resolution: "builder-util-runtime@npm:9.2.4"
@@ -8687,7 +8677,6 @@ __metadata:
electron-builder: "npm:24.13.3"
electron-is-dev: "npm:2.0.0"
electron-log: "npm:4.4.8"
- electron-updater: "npm:6.1.7"
loot-core: "npm:*"
node-fetch: "npm:^2.7.0"
promise-retry: "npm:^2.0.1"
@@ -9048,22 +9037,6 @@ __metadata:
languageName: node
linkType: hard
-"electron-updater@npm:6.1.7":
- version: 6.1.7
- resolution: "electron-updater@npm:6.1.7"
- dependencies:
- builder-util-runtime: "npm:9.2.3"
- fs-extra: "npm:^10.1.0"
- js-yaml: "npm:^4.1.0"
- lazy-val: "npm:^1.0.5"
- lodash.escaperegexp: "npm:^4.1.2"
- lodash.isequal: "npm:^4.5.0"
- semver: "npm:^7.3.8"
- tiny-typed-emitter: "npm:^2.1.0"
- checksum: c6a5b566d70de550cd959a3af0bed98da868b997d7ef741ede488027a8c876af2e1bf981becfeac767c4dbf7af856ed4e53053e7fcd246dc2af5fc71fd5ef7cc
- languageName: node
- linkType: hard
-
"electron@npm:30.0.6":
version: 30.0.6
resolution: "electron@npm:30.0.6"
@@ -13028,20 +13001,6 @@ __metadata:
languageName: node
linkType: hard
-"lodash.escaperegexp@npm:^4.1.2":
- version: 4.1.2
- resolution: "lodash.escaperegexp@npm:4.1.2"
- checksum: 6d99452b1cfd6073175a9b741a9b09ece159eac463f86f02ea3bee2e2092923fce812c8d2bf446309cc52d1d61bf9af51c8118b0d7421388e6cead7bd3798f0f
- languageName: node
- linkType: hard
-
-"lodash.isequal@npm:^4.5.0":
- version: 4.5.0
- resolution: "lodash.isequal@npm:4.5.0"
- checksum: 82fc58a83a1555f8df34ca9a2cd300995ff94018ac12cc47c349655f0ae1d4d92ba346db4c19bbfc90510764e0c00ddcc985a358bdcd4b3b965abf8f2a48a214
- languageName: node
- linkType: hard
-
"lodash.merge@npm:^4.6.2":
version: 4.6.2
resolution: "lodash.merge@npm:4.6.2"
@@ -17698,13 +17657,6 @@ __metadata:
languageName: node
linkType: hard
-"tiny-typed-emitter@npm:^2.1.0":
- version: 2.1.0
- resolution: "tiny-typed-emitter@npm:2.1.0"
- checksum: 709bca410054e08df4dc29d5ea0916328bb2900d60245c6a743068ea223887d9fd2c945b6070eb20336275a557a36c2808e5c87d2ed4b60633458632be4a3e10
- languageName: node
- linkType: hard
-
"tinybench@npm:^2.5.1":
version: 2.5.1
resolution: "tinybench@npm:2.5.1"