42 lines
1.2 KiB
JavaScript
Executable File
42 lines
1.2 KiB
JavaScript
Executable File
"use strict";
|
|
const { app, BrowserWindow, ipcMain } = require('electron');
|
|
const path = require('path');
|
|
function createWindow() {
|
|
const mainWindow = new BrowserWindow({
|
|
width: 1200,
|
|
height: 800,
|
|
webPreferences: {
|
|
nodeIntegration: true,
|
|
contextIsolation: true,
|
|
preload: path.join(__dirname, '../preload.js'),
|
|
},
|
|
});
|
|
// In development, load from Vite dev server
|
|
if (process.env.NODE_ENV === 'development') {
|
|
mainWindow.loadURL('http://localhost:5173');
|
|
mainWindow.webContents.openDevTools();
|
|
}
|
|
else {
|
|
// In production, load the built index.html
|
|
mainWindow.loadFile(path.join(__dirname, '../renderer/index.html'));
|
|
}
|
|
}
|
|
app.whenReady().then(() => {
|
|
createWindow();
|
|
app.on('activate', () => {
|
|
if (BrowserWindow.getAllWindows().length === 0) {
|
|
createWindow();
|
|
}
|
|
});
|
|
});
|
|
app.on('window-all-closed', () => {
|
|
if (process.platform !== 'darwin') {
|
|
app.quit();
|
|
}
|
|
});
|
|
// Handle machine connection (stub)
|
|
ipcMain.handle('connect-to-machine', async (_event, machine) => {
|
|
console.log('Connecting to machine:', machine);
|
|
return { success: true, message: 'Connection successful (stub)' };
|
|
});
|