mirror of
https://github.com/Fabio286/antares.git
synced 2025-06-05 21:59:22 +02:00
fix: error with multiple sessions in non-dev environment
This commit is contained in:
@ -78,9 +78,6 @@ async function createMainWindow () {
|
||||
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();
|
||||
|
||||
// Initialize ipcHandlers
|
||||
@ -114,6 +111,9 @@ else {
|
||||
|
||||
// create main BrowserWindow when electron is ready
|
||||
app.on('ready', async () => {
|
||||
if (!gotTheLock && !safeStorage.isEncryptionAvailable()) // Disable multiple instances if is not possible to share session keys
|
||||
app.quit();
|
||||
|
||||
mainWindowState = windowStateKeeper({
|
||||
defaultWidth: 1024,
|
||||
defaultHeight: 800
|
||||
@ -128,12 +128,6 @@ else {
|
||||
// if (isDevelopment)
|
||||
// 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 => {
|
||||
mainWindow.webContents.send('unhandled-exception', error);
|
||||
});
|
||||
@ -158,7 +152,6 @@ else {
|
||||
w.close();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function createAppMenu () {
|
||||
const menuTemplate: OsMenu = {
|
||||
|
@ -6,7 +6,7 @@ import * as Store from 'electron-store';
|
||||
import { defineStore } from 'pinia';
|
||||
|
||||
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||
const key = localStorage.getItem('key');
|
||||
let key = localStorage.getItem('key');
|
||||
|
||||
export interface SidebarElement {
|
||||
isFolder: boolean;
|
||||
@ -18,17 +18,20 @@ export interface SidebarElement {
|
||||
icon?: null | string;
|
||||
}
|
||||
|
||||
if (!key) {
|
||||
const storedKey = ipcRenderer.sendSync('get-key');
|
||||
if (!key) { // If no key in local storace
|
||||
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');
|
||||
localStorage.setItem('key', newKey);
|
||||
key = newKey;
|
||||
}
|
||||
else {
|
||||
localStorage.setItem('key', storedKey);
|
||||
key = storedKey;
|
||||
}
|
||||
}
|
||||
else
|
||||
localStorage.setItem('key', storedKey);
|
||||
}
|
||||
|
||||
ipcRenderer.send('set-key', key);
|
||||
|
||||
const persistentStore = new Store({
|
||||
|
Reference in New Issue
Block a user