From f8444b382c4385d50774cc80c933c83d04769259 Mon Sep 17 00:00:00 2001 From: Armin Date: Sun, 2 Nov 2025 09:56:04 +0100 Subject: [PATCH 1/9] allow mutliple instances and profiles --- src/index.ts | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/index.ts b/src/index.ts index 05d0b95256..7dc279fe24 100644 --- a/src/index.ts +++ b/src/index.ts @@ -71,11 +71,18 @@ unhandled({ let mainWindow: Electron.BrowserWindow | null; autoUpdater.autoDownload = false; -const gotTheLock = app.requestSingleInstanceLock(); -if (!gotTheLock) { - app.exit(); +// Allow multi instance +const ALLOW_MULTI_INSTANCE = process.env.ALLOW_MULTI_INSTANCE; +if (ALLOW_MULTI_INSTANCE) { + console.log("Starting with ALLOW_MULTI_INSTANCE") +} else { + const gotTheLock = app.requestSingleInstanceLock(); + if (!gotTheLock) { + app.exit(); + } } + protocol.registerSchemesAsPrivileged([ { scheme: 'http', @@ -634,6 +641,16 @@ const getDefaultLocale = async (locale: string) => Object.keys(await languageResources()).includes(locale) ? locale : null; app.whenReady().then(async () => { + // Use custom profile + const CUSTOM_ACCOUNT_PROFILE = process.env.CUSTOM_ACCOUNT_PROFILE; + if (CUSTOM_ACCOUNT_PROFILE) { + const baseFolder = path.join(app.getPath('userData'), 'Custom Account Profiles'); + app.setPath('userData', path.join(baseFolder, CUSTOM_ACCOUNT_PROFILE)); + } + let profileName = CUSTOM_ACCOUNT_PROFILE ?? 'default'; + let appPath = app.getPath('userData') + console.log('Using Account Profile: \'${profileName}\' at \'${appPath}\''); + if (!config.get('options.language')) { const locale = await getDefaultLocale(app.getLocale()); if (locale) { From d1a6e434c123ec5b5669ea1d9d37a91260f101db Mon Sep 17 00:00:00 2001 From: Armin Date: Sun, 2 Nov 2025 10:05:37 +0100 Subject: [PATCH 2/9] oops --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 7dc279fe24..6e9ffe3881 100644 --- a/src/index.ts +++ b/src/index.ts @@ -649,7 +649,7 @@ app.whenReady().then(async () => { } let profileName = CUSTOM_ACCOUNT_PROFILE ?? 'default'; let appPath = app.getPath('userData') - console.log('Using Account Profile: \'${profileName}\' at \'${appPath}\''); + console.log('Using Account Profile: \'' + profileName + '\' at \'' + appPath + '\''); if (!config.get('options.language')) { const locale = await getDefaultLocale(app.getLocale()); From 78f6cc3f73bbd35baf1bb8e4805ae191533ae5f8 Mon Sep 17 00:00:00 2001 From: HasselAssel <71652213+HasselAssel@users.noreply.github.com> Date: Thu, 6 Nov 2025 20:12:49 +0100 Subject: [PATCH 3/9] ok Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 6e9ffe3881..649d25673f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -74,7 +74,7 @@ autoUpdater.autoDownload = false; // Allow multi instance const ALLOW_MULTI_INSTANCE = process.env.ALLOW_MULTI_INSTANCE; if (ALLOW_MULTI_INSTANCE) { - console.log("Starting with ALLOW_MULTI_INSTANCE") + console.log('Starting with ALLOW_MULTI_INSTANCE'); } else { const gotTheLock = app.requestSingleInstanceLock(); if (!gotTheLock) { From 3921f0faafdf1b16b008ea4587e76dced3e7f00c Mon Sep 17 00:00:00 2001 From: HasselAssel <71652213+HasselAssel@users.noreply.github.com> Date: Thu, 6 Nov 2025 20:13:32 +0100 Subject: [PATCH 4/9] ok daddy github actions bot Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- src/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 649d25673f..96af6e9bf6 100644 --- a/src/index.ts +++ b/src/index.ts @@ -644,7 +644,10 @@ app.whenReady().then(async () => { // Use custom profile const CUSTOM_ACCOUNT_PROFILE = process.env.CUSTOM_ACCOUNT_PROFILE; if (CUSTOM_ACCOUNT_PROFILE) { - const baseFolder = path.join(app.getPath('userData'), 'Custom Account Profiles'); + const baseFolder = path.join( + app.getPath('userData'), + 'Custom Account Profiles', + ); app.setPath('userData', path.join(baseFolder, CUSTOM_ACCOUNT_PROFILE)); } let profileName = CUSTOM_ACCOUNT_PROFILE ?? 'default'; From d4a3ed5b1d285bc362fbda5209bd287d594800cf Mon Sep 17 00:00:00 2001 From: HasselAssel <71652213+HasselAssel@users.noreply.github.com> Date: Thu, 6 Nov 2025 20:13:50 +0100 Subject: [PATCH 5/9] ok sure Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 96af6e9bf6..5f9aaa434b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -650,7 +650,7 @@ app.whenReady().then(async () => { ); app.setPath('userData', path.join(baseFolder, CUSTOM_ACCOUNT_PROFILE)); } - let profileName = CUSTOM_ACCOUNT_PROFILE ?? 'default'; + const profileName = CUSTOM_ACCOUNT_PROFILE ?? 'default'; let appPath = app.getPath('userData') console.log('Using Account Profile: \'' + profileName + '\' at \'' + appPath + '\''); From c2066274df9ce39a46c73e665483193f3a2ebacc Mon Sep 17 00:00:00 2001 From: HasselAssel <71652213+HasselAssel@users.noreply.github.com> Date: Thu, 6 Nov 2025 20:14:04 +0100 Subject: [PATCH 6/9] i love semicolons Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 5f9aaa434b..541afaf90e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -651,7 +651,7 @@ app.whenReady().then(async () => { app.setPath('userData', path.join(baseFolder, CUSTOM_ACCOUNT_PROFILE)); } const profileName = CUSTOM_ACCOUNT_PROFILE ?? 'default'; - let appPath = app.getPath('userData') + let appPath = app.getPath('userData'); console.log('Using Account Profile: \'' + profileName + '\' at \'' + appPath + '\''); if (!config.get('options.language')) { From 7951055277931506f3c167b4f3e7f7b8a251e4b6 Mon Sep 17 00:00:00 2001 From: HasselAssel <71652213+HasselAssel@users.noreply.github.com> Date: Thu, 6 Nov 2025 20:14:35 +0100 Subject: [PATCH 7/9] this makes it so much better YIPPIE Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- src/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 541afaf90e..d8ff53a11a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -652,7 +652,9 @@ app.whenReady().then(async () => { } const profileName = CUSTOM_ACCOUNT_PROFILE ?? 'default'; let appPath = app.getPath('userData'); - console.log('Using Account Profile: \'' + profileName + '\' at \'' + appPath + '\''); + console.log( + "Using Account Profile: '" + profileName + "' at '" + appPath + "'", + ); if (!config.get('options.language')) { const locale = await getDefaultLocale(app.getLocale()); From d7eced9499bc081d046a17c634278c54081efe44 Mon Sep 17 00:00:00 2001 From: HasselAssel <71652213+HasselAssel@users.noreply.github.com> Date: Thu, 6 Nov 2025 20:15:51 +0100 Subject: [PATCH 8/9] actually good idea Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- src/index.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index d8ff53a11a..80de54a687 100644 --- a/src/index.ts +++ b/src/index.ts @@ -82,7 +82,6 @@ if (ALLOW_MULTI_INSTANCE) { } } - protocol.registerSchemesAsPrivileged([ { scheme: 'http', From e0d4938f25f8ea180ff60a3828af1fcd127f3874 Mon Sep 17 00:00:00 2001 From: HasselAssel <71652213+HasselAssel@users.noreply.github.com> Date: Thu, 6 Nov 2025 20:16:17 +0100 Subject: [PATCH 9/9] i am gonna const Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 80de54a687..00494527cb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -650,7 +650,7 @@ app.whenReady().then(async () => { app.setPath('userData', path.join(baseFolder, CUSTOM_ACCOUNT_PROFILE)); } const profileName = CUSTOM_ACCOUNT_PROFILE ?? 'default'; - let appPath = app.getPath('userData'); + const appPath = app.getPath('userData'); console.log( "Using Account Profile: '" + profileName + "' at '" + appPath + "'", );