Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 24 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,15 @@ 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([
Expand Down Expand Up @@ -634,6 +640,21 @@ 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));
}
const profileName = CUSTOM_ACCOUNT_PROFILE ?? 'default';
const 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) {
Expand Down