UNPKG

gmail-to-exchange365

Version:

Complete Gmail to Exchange 365 migration tool with UI - Migrate emails, attachments, and folders seamlessly

65 lines (54 loc) 1.71 kB
const { app, BrowserWindow } = require("electron"); const path = require("path"); let mainWindow; function createWindow() { mainWindow = new BrowserWindow({ width: 1000, height: 900, webPreferences: { nodeIntegration: false, contextIsolation: true, webSecurity: true }, icon: path.join(__dirname, "../assets/icon.png"), // Optional icon title: "Gmail → Exchange Migrator" }); // Load the local server const port = process.env.PORT || 3000; mainWindow.loadURL(`http://localhost:${port}`); // Open DevTools in development if (process.env.NODE_ENV === "development") { mainWindow.webContents.openDevTools(); } mainWindow.on("closed", () => { mainWindow = null; }); } // This method will be called when Electron has finished initialization app.whenReady().then(() => { createWindow(); app.on("activate", () => { // On macOS, re-create window when dock icon is clicked if (BrowserWindow.getAllWindows().length === 0) { createWindow(); } }); }); // Quit when all windows are closed app.on("window-all-closed", () => { // On macOS, keep app running even when all windows are closed if (process.platform !== "darwin") { app.quit(); } }); // Handle external links app.on("web-contents-created", (event, contents) => { contents.on("new-window", (event, navigationUrl) => { event.preventDefault(); // Open OAuth URLs in default browser if (navigationUrl.includes("login.microsoftonline.com") || navigationUrl.includes("accounts.google.com")) { require("electron").shell.openExternal(navigationUrl); } }); });