A local-first personal finance app
:electron: Remove ngrok from electron server embed (#4768)
Michael Clarkaba97e8b7479
diff --git a/packages/desktop-electron/index.ts b/packages/desktop-electron/index.tsindex 2aec63e0cb..d1a8e15c45 100644--- a/packages/desktop-electron/index.ts+++ b/packages/desktop-electron/index.ts@@ -2,7 +2,6 @@ import fs from 'fs';import { createServer, Server } from 'http';import path from 'path';-import ngrok from '@ngrok/ngrok';import {net,app,@@ -311,41 +310,6 @@ async function startSyncServer() {}}-async function exposeSyncServer(- syncServerConfig: GlobalPrefsJson['syncServerConfig'],-) {- const hasRequiredConfig =- syncServerConfig?.ngrokConfig?.authToken &&- syncServerConfig?.ngrokConfig?.domain &&- syncServerConfig?.port;-- if (!hasRequiredConfig) {- logMessage(- 'error',- 'Sync-Server: Cannot expose sync server: missing ngrok settings',- );- return { error: 'Missing ngrok settings' };- }-- try {- const listener = await ngrok.forward({- schemes: ['https'],- addr: syncServerConfig.port,- authtoken: syncServerConfig?.ngrokConfig?.authToken,- domain: syncServerConfig?.ngrokConfig?.domain,- });-- logMessage(- 'info',- `Sync-Server: Exposing actual server on url: ${listener.url()}`,- );- return { url: listener.url() };- } catch (error) {- logMessage('error', `Unable to run ngrok: ${error}`);- return { error: `Unable to run ngrok. ${error}` };- }-}-async function createWindow() {const windowState = await getWindowState();@@ -488,11 +452,8 @@ app.on('ready', async () => {const globalPrefs = await loadGlobalPrefs();if (globalPrefs.syncServerConfig?.autoStart) {- // wait for both server and ngrok to start before starting the Actual client to ensure server is available- await Promise.allSettled([- startSyncServer(),- exposeSyncServer(globalPrefs.syncServerConfig),- ]);+ // wait for the server to start before starting the Actual client to ensure server is available+ await startSyncServer();}protocol.handle('app', request => {diff --git a/packages/desktop-electron/package.json b/packages/desktop-electron/package.jsonindex 0f9ee630aa..6d8ca71b2a 100644--- a/packages/desktop-electron/package.json+++ b/packages/desktop-electron/package.json@@ -90,7 +90,6 @@},"dependencies": {"@actual-app/sync-server": "workspace:*",- "@ngrok/ngrok": "^1.4.1","better-sqlite3": "^11.9.1","fs-extra": "^11.3.0","promise-retry": "^2.0.1"diff --git a/packages/loot-core/src/types/prefs.d.ts b/packages/loot-core/src/types/prefs.d.tsindex e29428f1fc..afdbbb1d94 100644--- a/packages/loot-core/src/types/prefs.d.ts+++ b/packages/loot-core/src/types/prefs.d.ts@@ -94,10 +94,6 @@ export type GlobalPrefs = Partial<{// Electron onlyautoStart?: boolean;port?: number;- ngrokConfig?: {- domain?: string;- authToken?: string;- };};}>;diff --git a/upcoming-release-notes/4768.md b/upcoming-release-notes/4768.mdnew file mode 100644index 0000000000..50ca5d7fcc--- /dev/null+++ b/upcoming-release-notes/4768.md@@ -0,0 +1,6 @@+---+category: Maintenance+authors: [MikesGlitch]+---++Remove ngrok from electron. In future we'll move to a plugin.diff --git a/yarn.lock b/yarn.lockindex 71a94852ec..130eff08a4 100644--- a/yarn.lock+++ b/yarn.lock@@ -2873,145 +2873,6 @@ __metadata:languageName: nodelinkType: hard-"@ngrok/ngrok-android-arm-eabi@npm:1.4.1":- version: 1.4.1- resolution: "@ngrok/ngrok-android-arm-eabi@npm:1.4.1"- conditions: os=android & cpu=arm- languageName: node- linkType: hard--"@ngrok/ngrok-android-arm64@npm:1.4.1":- version: 1.4.1- resolution: "@ngrok/ngrok-android-arm64@npm:1.4.1"- conditions: os=android & cpu=arm64- languageName: node- linkType: hard--"@ngrok/ngrok-darwin-arm64@npm:1.4.1":- version: 1.4.1- resolution: "@ngrok/ngrok-darwin-arm64@npm:1.4.1"- conditions: os=darwin & cpu=arm64- languageName: node- linkType: hard--"@ngrok/ngrok-darwin-universal@npm:1.4.1":- version: 1.4.1- resolution: "@ngrok/ngrok-darwin-universal@npm:1.4.1"- conditions: os=darwin- languageName: node- linkType: hard--"@ngrok/ngrok-darwin-x64@npm:1.4.1":- version: 1.4.1- resolution: "@ngrok/ngrok-darwin-x64@npm:1.4.1"- conditions: os=darwin & cpu=x64- languageName: node- linkType: hard--"@ngrok/ngrok-freebsd-x64@npm:1.4.1":- version: 1.4.1- resolution: "@ngrok/ngrok-freebsd-x64@npm:1.4.1"- conditions: os=freebsd & cpu=x64- languageName: node- linkType: hard--"@ngrok/ngrok-linux-arm-gnueabihf@npm:1.4.1":- version: 1.4.1- resolution: "@ngrok/ngrok-linux-arm-gnueabihf@npm:1.4.1"- conditions: os=linux & cpu=arm- languageName: node- linkType: hard--"@ngrok/ngrok-linux-arm64-gnu@npm:1.4.1":- version: 1.4.1- resolution: "@ngrok/ngrok-linux-arm64-gnu@npm:1.4.1"- conditions: os=linux & cpu=arm64 & libc=glibc- languageName: node- linkType: hard--"@ngrok/ngrok-linux-arm64-musl@npm:1.4.1":- version: 1.4.1- resolution: "@ngrok/ngrok-linux-arm64-musl@npm:1.4.1"- conditions: os=linux & cpu=arm64 & libc=musl- languageName: node- linkType: hard--"@ngrok/ngrok-linux-x64-gnu@npm:1.4.1":- version: 1.4.1- resolution: "@ngrok/ngrok-linux-x64-gnu@npm:1.4.1"- conditions: os=linux & cpu=x64 & libc=glibc- languageName: node- linkType: hard--"@ngrok/ngrok-linux-x64-musl@npm:1.4.1":- version: 1.4.1- resolution: "@ngrok/ngrok-linux-x64-musl@npm:1.4.1"- conditions: os=linux & cpu=x64 & libc=musl- languageName: node- linkType: hard--"@ngrok/ngrok-win32-ia32-msvc@npm:1.4.1":- version: 1.4.1- resolution: "@ngrok/ngrok-win32-ia32-msvc@npm:1.4.1"- conditions: os=win32 & cpu=ia32- languageName: node- linkType: hard--"@ngrok/ngrok-win32-x64-msvc@npm:1.4.1":- version: 1.4.1- resolution: "@ngrok/ngrok-win32-x64-msvc@npm:1.4.1"- conditions: os=win32 & cpu=x64- languageName: node- linkType: hard--"@ngrok/ngrok@npm:^1.4.1":- version: 1.4.1- resolution: "@ngrok/ngrok@npm:1.4.1"- dependencies:- "@ngrok/ngrok-android-arm-eabi": "npm:1.4.1"- "@ngrok/ngrok-android-arm64": "npm:1.4.1"- "@ngrok/ngrok-darwin-arm64": "npm:1.4.1"- "@ngrok/ngrok-darwin-universal": "npm:1.4.1"- "@ngrok/ngrok-darwin-x64": "npm:1.4.1"- "@ngrok/ngrok-freebsd-x64": "npm:1.4.1"- "@ngrok/ngrok-linux-arm-gnueabihf": "npm:1.4.1"- "@ngrok/ngrok-linux-arm64-gnu": "npm:1.4.1"- "@ngrok/ngrok-linux-arm64-musl": "npm:1.4.1"- "@ngrok/ngrok-linux-x64-gnu": "npm:1.4.1"- "@ngrok/ngrok-linux-x64-musl": "npm:1.4.1"- "@ngrok/ngrok-win32-ia32-msvc": "npm:1.4.1"- "@ngrok/ngrok-win32-x64-msvc": "npm:1.4.1"- dependenciesMeta:- "@ngrok/ngrok-android-arm-eabi":- optional: true- "@ngrok/ngrok-android-arm64":- optional: true- "@ngrok/ngrok-darwin-arm64":- optional: true- "@ngrok/ngrok-darwin-universal":- optional: true- "@ngrok/ngrok-darwin-x64":- optional: true- "@ngrok/ngrok-freebsd-x64":- optional: true- "@ngrok/ngrok-linux-arm-gnueabihf":- optional: true- "@ngrok/ngrok-linux-arm64-gnu":- optional: true- "@ngrok/ngrok-linux-arm64-musl":- optional: true- "@ngrok/ngrok-linux-x64-gnu":- optional: true- "@ngrok/ngrok-linux-x64-musl":- optional: true- "@ngrok/ngrok-win32-ia32-msvc":- optional: true- "@ngrok/ngrok-win32-x64-msvc":- optional: true- checksum: 10/c86956756af6eb9f2cc47aba19ac14f59a0d031defc52ee6845b17363b051213abd29c984f11501d88a482f343fbadb0e7bf855803068bceb96bf5fb16dfb2cb- languageName: node- linkType: hard-"@nodelib/fs.scandir@npm:2.1.5":version: 2.1.5resolution: "@nodelib/fs.scandir@npm:2.1.5"@@ -9709,7 +9570,6 @@ __metadata:"@actual-app/sync-server": "workspace:*""@electron/notarize": "npm:2.4.0""@electron/rebuild": "npm:3.6.0"- "@ngrok/ngrok": "npm:^1.4.1""@playwright/test": "npm:1.41.2""@types/copyfiles": "npm:^2""@types/fs-extra": "npm:^11"