First commit on the local Gitea server, made after moving the tree off the Windows machine. Build outputs, node_modules and the AI models stay out (see .gitignore); everything the installer build needs is tracked. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
61 lines
1.6 KiB
JavaScript
61 lines
1.6 KiB
JavaScript
// This file remains for backward compatibility in dev environments that import main.js.
|
|
// The production Electron entrypoint is main.cjs (CommonJS). Redirect there.
|
|
import('./main.cjs');
|
|
|
|
function createWindow () {
|
|
const win = new BrowserWindow({
|
|
width: 1200,
|
|
height: 900,
|
|
fullscreen: true,
|
|
autoHideMenuBar: true,
|
|
backgroundColor: '#1a1a1a',
|
|
show: true,
|
|
webPreferences: {
|
|
nodeIntegration: false,
|
|
contextIsolation: true,
|
|
webSecurity: false, // Allow loading local files
|
|
preload: path.join(__dirname, 'preload.js')
|
|
}
|
|
});
|
|
|
|
win.loadFile('index.html');
|
|
}
|
|
|
|
app.whenReady().then(createWindow);
|
|
|
|
app.on('window-all-closed', () => {
|
|
if (process.platform !== 'darwin') app.quit();
|
|
});
|
|
|
|
// Handle local file operations
|
|
ipcMain.handle('read-directory', async (event, dirPath) => {
|
|
try {
|
|
const files = await fs.readdir(dirPath);
|
|
const fileStats = await Promise.all(
|
|
files.map(async (file) => {
|
|
const filePath = path.join(dirPath, file);
|
|
const stats = await fs.stat(filePath);
|
|
return {
|
|
name: file,
|
|
path: filePath,
|
|
size: stats.size,
|
|
type: path.extname(file).slice(1)
|
|
};
|
|
})
|
|
);
|
|
return fileStats;
|
|
} catch (error) {
|
|
console.error('Error reading directory:', error);
|
|
throw error;
|
|
}
|
|
});
|
|
|
|
ipcMain.handle('read-file', async (event, filePath) => {
|
|
try {
|
|
const content = await fs.readFile(filePath);
|
|
return content;
|
|
} catch (error) {
|
|
console.error('Error reading file:', error);
|
|
throw error;
|
|
}
|
|
});
|