AUDITPRO / main.js
MMOON's picture
Upload 13 files
93f9472 verified
const { app, BrowserWindow, Menu } = require('electron');
const path = require('path');
function createWindow() {
const win = new BrowserWindow({
width: 1280,
height: 850,
title: "AuditPro Sync",
show: false,
webPreferences: {
nodeIntegration: true, // Changé à true pour faciliter certains accès locaux si besoin
contextIsolation: false, // Désactivé pour le bundle simple (plus stable pour les débutants)
webSecurity: false, // Nécessaire pour charger certains modules locaux via file:// sans erreurs CORS
sandbox: false
},
backgroundColor: '#ffffff'
});
win.loadFile(path.join(__dirname, 'index.html'));
win.once('ready-to-show', () => {
win.show();
// Optionnel : Ouvrir la console automatiquement en cas de problème au début
// win.webContents.openDevTools();
});
const template = [
{
label: 'AuditPro',
submenu: [
{ label: 'À propos', role: 'about' },
{ type: 'separator' },
{ label: 'Quitter', role: 'quit' }
]
},
{ label: 'Édition', role: 'editMenu' },
{
label: 'Outils',
submenu: [
{ label: 'Actualiser', role: 'reload' },
{ label: 'Outils Développeur', role: 'toggleDevTools' },
{ type: 'separator' },
{ role: 'resetZoom' },
{ role: 'zoomIn' },
{ role: 'zoomOut' }
]
}
];
const menu = Menu.buildFromTemplate(template);
Menu.setApplicationMenu(menu);
}
app.whenReady().then(() => {
createWindow();
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) createWindow();
});
});
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') app.quit();
});