| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- "use strict";
- const { app, BrowserWindow, ipcMain, shell } = require("electron");
- const { join } = require("path");
- let mainWindow = null;
- const VITE_DEV_SERVER_URL = process.env.VITE_DEV_SERVER_URL;
- function createWindow() {
- mainWindow = new BrowserWindow({
- width: 1400,
- height: 900,
- minWidth: 1200,
- minHeight: 700,
- webPreferences: {
- preload: join(__dirname, "preload.js"),
- nodeIntegration: false,
- contextIsolation: true
- },
- titleBarStyle: "hiddenInset",
- frame: process.platform !== "darwin",
- show: false
- });
- mainWindow.once("ready-to-show", () => {
- mainWindow == null ? void 0 : mainWindow.show();
- });
- if (VITE_DEV_SERVER_URL) {
- mainWindow.loadURL(VITE_DEV_SERVER_URL);
- mainWindow.webContents.openDevTools();
- } else {
- mainWindow.loadFile(join(__dirname, "../dist/index.html"));
- }
- mainWindow.webContents.setWindowOpenHandler(({ url }) => {
- shell.openExternal(url);
- return { action: "deny" };
- });
- mainWindow.on("closed", () => {
- mainWindow = null;
- });
- }
- const gotTheLock = app.requestSingleInstanceLock();
- if (!gotTheLock) {
- app.quit();
- } else {
- app.on("second-instance", () => {
- if (mainWindow) {
- if (mainWindow.isMinimized()) mainWindow.restore();
- mainWindow.focus();
- }
- });
- app.whenReady().then(() => {
- createWindow();
- app.on("activate", () => {
- if (BrowserWindow.getAllWindows().length === 0) {
- createWindow();
- }
- });
- });
- }
- app.on("window-all-closed", () => {
- if (process.platform !== "darwin") {
- app.quit();
- }
- });
- ipcMain.handle("get-app-version", () => {
- return app.getVersion();
- });
- ipcMain.handle("get-platform", () => {
- return process.platform;
- });
- ipcMain.on("window-minimize", () => {
- mainWindow == null ? void 0 : mainWindow.minimize();
- });
- ipcMain.on("window-maximize", () => {
- if (mainWindow == null ? void 0 : mainWindow.isMaximized()) {
- mainWindow.unmaximize();
- } else {
- mainWindow == null ? void 0 : mainWindow.maximize();
- }
- });
- ipcMain.on("window-close", () => {
- mainWindow == null ? void 0 : mainWindow.close();
- });
- //# sourceMappingURL=main.js.map
|