chore: Set up Electron configuration and update dependencies
- Add Electron Forge configuration in forge.config.js for packaging and building the app - Create main Electron entry point in main.cjs for application initialization - Update package.json scripts for Electron development and building - Add necessary Electron dependencies to package.json - Modify .gitignore to exclude build artifacts and temporary files - Refactor Footer and Navbar components to remove unused imports - Enhance NostrFeed component by removing unnecessary connection logic - Update i18n setup for better type safety and locale management - Refactor Home component to clean up unused code - Extend Nostr store to manage account state with TypeScript interfaces
This commit is contained in:
parent
3c05ddde51
commit
a74148a0da
11 changed files with 5831 additions and 13 deletions
48
electron/main.cjs
Normal file
48
electron/main.cjs
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
const { app, BrowserWindow, protocol } = require('electron');
|
||||
const path = require('path');
|
||||
const url = require('url');
|
||||
|
||||
// Handle creating/removing shortcuts on Windows when installing/uninstalling
|
||||
if (require('electron-squirrel-startup')) {
|
||||
app.quit();
|
||||
}
|
||||
|
||||
const createWindow = () => {
|
||||
// Create the browser window
|
||||
const mainWindow = new BrowserWindow({
|
||||
width: 1200,
|
||||
height: 800,
|
||||
webPreferences: {
|
||||
nodeIntegration: false,
|
||||
contextIsolation: true,
|
||||
preload: path.join(__dirname, 'preload.cjs') // Optional: for exposing APIs to renderer
|
||||
}
|
||||
});
|
||||
|
||||
// In production, load the bundled app
|
||||
if (app.isPackaged) {
|
||||
mainWindow.loadFile(path.join(__dirname, '../dist/index.html'));
|
||||
} else {
|
||||
// In dev mode, load from the vite dev server
|
||||
mainWindow.loadURL('http://localhost:5173');
|
||||
mainWindow.webContents.openDevTools();
|
||||
}
|
||||
};
|
||||
|
||||
// Create window when Electron is ready
|
||||
app.whenReady().then(() => {
|
||||
createWindow();
|
||||
|
||||
app.on('activate', () => {
|
||||
// On macOS it's common to re-create a window in the app when the
|
||||
// dock icon is clicked and there are no other windows open.
|
||||
if (BrowserWindow.getAllWindows().length === 0) createWindow();
|
||||
});
|
||||
});
|
||||
|
||||
// Quit when all windows are closed, except on macOS
|
||||
app.on('window-all-closed', () => {
|
||||
if (process.platform !== 'darwin') {
|
||||
app.quit();
|
||||
}
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue