continue watching section, recently added section, new endpoints in collab with server, scan for new files, and more
This commit is contained in:
24
main.js
24
main.js
@@ -1,14 +1,31 @@
|
||||
const { app, BrowserWindow } = require('electron');
|
||||
const path = require('path');
|
||||
|
||||
// Catch unhandled exceptions to prevent crashes
|
||||
process.on('uncaughtException', (error) => {
|
||||
console.error('Unhandled exception:', error);
|
||||
});
|
||||
|
||||
process.on('unhandledRejection', (reason, promise) => {
|
||||
console.error('Unhandled rejection at:', promise, 'reason:', reason);
|
||||
});
|
||||
|
||||
function createWindow() {
|
||||
const win = new BrowserWindow({
|
||||
width: 1000,
|
||||
height: 700,
|
||||
webPreferences: {
|
||||
preload: path.join(__dirname, 'preload.js')
|
||||
preload: path.join(__dirname, 'preload.js'),
|
||||
contextIsolation: true,
|
||||
nodeIntegration: false,
|
||||
sandbox: false // disable sandbox to enable Node built-ins in preload
|
||||
}
|
||||
});
|
||||
|
||||
win.webContents.on('preload-error', (event, preloadPath, error) => {
|
||||
console.error(`Failed to load preload script from ${preloadPath}:`, error);
|
||||
});
|
||||
|
||||
win.loadFile('index.html');
|
||||
}
|
||||
|
||||
@@ -18,4 +35,9 @@ app.on('window-all-closed', () => {
|
||||
});
|
||||
app.on('activate', () => {
|
||||
if (BrowserWindow.getAllWindows().length === 0) createWindow();
|
||||
});
|
||||
|
||||
app.on('renderer-process-crashed', (event, webContents, killed) => {
|
||||
console.error('Renderer process crashed. Restarting...');
|
||||
createWindow(); // Restart the renderer process
|
||||
});
|
||||
Reference in New Issue
Block a user