mirror of
https://github.com/Fabio286/antares.git
synced 2025-04-18 20:17:24 +02:00
fix: error with multiple sessions in non-dev environment
This commit is contained in:
parent
075f542dc8
commit
169f610b2e
@ -78,9 +78,6 @@ async function createMainWindow () {
|
|||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gotTheLock && !safeStorage.isEncryptionAvailable()) // Disable multiple instances if is not possible to share session keys
|
|
||||||
app.quit();
|
|
||||||
else {
|
|
||||||
require('@electron/remote/main').initialize();
|
require('@electron/remote/main').initialize();
|
||||||
|
|
||||||
// Initialize ipcHandlers
|
// Initialize ipcHandlers
|
||||||
@ -114,6 +111,9 @@ else {
|
|||||||
|
|
||||||
// create main BrowserWindow when electron is ready
|
// create main BrowserWindow when electron is ready
|
||||||
app.on('ready', async () => {
|
app.on('ready', async () => {
|
||||||
|
if (!gotTheLock && !safeStorage.isEncryptionAvailable()) // Disable multiple instances if is not possible to share session keys
|
||||||
|
app.quit();
|
||||||
|
|
||||||
mainWindowState = windowStateKeeper({
|
mainWindowState = windowStateKeeper({
|
||||||
defaultWidth: 1024,
|
defaultWidth: 1024,
|
||||||
defaultHeight: 800
|
defaultHeight: 800
|
||||||
@ -128,12 +128,6 @@ else {
|
|||||||
// if (isDevelopment)
|
// if (isDevelopment)
|
||||||
// mainWindow.webContents.openDevTools();
|
// mainWindow.webContents.openDevTools();
|
||||||
|
|
||||||
// const key = safeStorage.encryptString('godisnothere');
|
|
||||||
// console.log('KEY:', key.toString('hex'));
|
|
||||||
|
|
||||||
// const decrypted = safeStorage.decryptString(key);
|
|
||||||
// console.log(decrypted.toString());
|
|
||||||
|
|
||||||
process.on('uncaughtException', error => {
|
process.on('uncaughtException', error => {
|
||||||
mainWindow.webContents.send('unhandled-exception', error);
|
mainWindow.webContents.send('unhandled-exception', error);
|
||||||
});
|
});
|
||||||
@ -158,7 +152,6 @@ else {
|
|||||||
w.close();
|
w.close();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
function createAppMenu () {
|
function createAppMenu () {
|
||||||
const menuTemplate: OsMenu = {
|
const menuTemplate: OsMenu = {
|
||||||
|
@ -6,7 +6,7 @@ import * as Store from 'electron-store';
|
|||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
|
|
||||||
import { useWorkspacesStore } from '@/stores/workspaces';
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
const key = localStorage.getItem('key');
|
let key = localStorage.getItem('key');
|
||||||
|
|
||||||
export interface SidebarElement {
|
export interface SidebarElement {
|
||||||
isFolder: boolean;
|
isFolder: boolean;
|
||||||
@ -18,17 +18,20 @@ export interface SidebarElement {
|
|||||||
icon?: null | string;
|
icon?: null | string;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!key) {
|
if (!key) { // If no key in local storace
|
||||||
const storedKey = ipcRenderer.sendSync('get-key');
|
const storedKey = ipcRenderer.sendSync('get-key');// Ask for key stored on disk
|
||||||
|
|
||||||
if (!storedKey) {
|
if (!storedKey) { // Of nop stored key on disk
|
||||||
const newKey = crypto.randomBytes(16).toString('hex');
|
const newKey = crypto.randomBytes(16).toString('hex');
|
||||||
localStorage.setItem('key', newKey);
|
localStorage.setItem('key', newKey);
|
||||||
|
key = newKey;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
localStorage.setItem('key', storedKey);
|
||||||
|
key = storedKey;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
localStorage.setItem('key', storedKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
ipcRenderer.send('set-key', key);
|
ipcRenderer.send('set-key', key);
|
||||||
|
|
||||||
const persistentStore = new Store({
|
const persistentStore = new Store({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user