2023-07-29 16:23:38 +02:00
|
|
|
import { BrowserWindow, app, ipcMain } from "electron";
|
2023-07-29 14:29:14 +02:00
|
|
|
import path = require("path");
|
2023-07-29 19:23:18 +02:00
|
|
|
import ffmpegPath = require("ffmpeg-static");
|
2023-07-28 02:46:49 +02:00
|
|
|
|
2023-07-28 02:32:18 +02:00
|
|
|
const createWindow = () => {
|
|
|
|
const win = new BrowserWindow({
|
2023-07-29 19:23:18 +02:00
|
|
|
width: 1280,
|
|
|
|
height: 720,
|
2023-07-29 14:29:14 +02:00
|
|
|
webPreferences: {
|
|
|
|
preload: path.join(__dirname, "preload.js"),
|
|
|
|
},
|
2023-07-28 02:32:18 +02:00
|
|
|
});
|
|
|
|
|
2023-07-29 15:30:41 +02:00
|
|
|
win.loadFile(path.join(path.resolve(__dirname, ".."), "pages", "index.html"));
|
2023-07-29 19:23:18 +02:00
|
|
|
win.webContents.openDevTools(); // debug
|
2023-07-28 02:32:18 +02:00
|
|
|
};
|
2023-07-29 15:30:41 +02:00
|
|
|
|
2023-07-28 02:32:18 +02:00
|
|
|
app.whenReady().then(() => {
|
2023-07-29 19:23:18 +02:00
|
|
|
ipcMain.handle("ffmpeg", () => ffmpegPath);
|
2023-07-29 20:20:55 +02:00
|
|
|
ipcMain.handle("argv", () => process.argv);
|
2023-07-29 16:23:38 +02:00
|
|
|
|
2023-07-28 02:32:18 +02:00
|
|
|
createWindow();
|
2023-07-29 14:29:14 +02:00
|
|
|
|
|
|
|
app.on("activate", () => {
|
2023-07-29 19:23:18 +02:00
|
|
|
if (BrowserWindow.getAllWindows().length === 0) {
|
|
|
|
createWindow();
|
|
|
|
}
|
2023-07-29 14:29:14 +02:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
app.on("window-all-closed", () => {
|
2023-07-29 19:23:18 +02:00
|
|
|
if (process.platform !== "darwin") {
|
|
|
|
app.quit();
|
|
|
|
}
|
2023-07-28 02:32:18 +02:00
|
|
|
});
|