LegacyLauncher/main.js
gardenGnostic f5d44043a7
bug fixes
2026-03-05 23:35:01 +01:00

69 lines
1.7 KiB
JavaScript

const { app, BrowserWindow, shell, ipcMain } = require('electron');
const path = require('path');
const Store = require('electron-store');
const fs = require('fs');
const https = require('https');
const extractZip = require('extract-zip');
const { exec } = require('child_process');
const store = new Store();
function createWindow() {
const win = new BrowserWindow({
width: 1280,
height: 720,
minWidth: 1024,
minHeight: 600,
center: true,
resizable: true,
frame: false,
icon: path.join(__dirname, '512x512.png'),
transparent: true,
autoHideMenuBar: true,
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
enableRemoteModule: true
}
});
win.loadFile('index.html');
ipcMain.on('window-minimize', () => win.minimize());
ipcMain.on('window-maximize', () => {
if (win.isMaximized()) {
win.unmaximize();
} else {
win.maximize();
}
});
ipcMain.on('window-close', () => win.close());
ipcMain.handle('store-get', (event, key) => store.get(key));
ipcMain.handle('store-set', (event, key, value) => store.set(key, value));
win.on('maximize', () => win.webContents.send('window-is-maximized', true));
win.on('unmaximize', () => win.webContents.send('window-is-maximized', false));
win.webContents.setWindowOpenHandler(({ url }) => {
shell.openExternal(url);
return { action: 'deny' };
});
}
app.whenReady().then(() => {
createWindow();
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow();
}
});
});
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
});