Initial commit

This commit is contained in:
Vendicated
2023-03-30 01:02:30 +02:00
commit 0a3a0ca076
12 changed files with 1654 additions and 0 deletions

26
src/main/index.ts Normal file
View File

@@ -0,0 +1,26 @@
import { app, BrowserWindow } from 'electron';
import { createMainWindow } from "./mainWindow";
import { createSplashWindow } from "./splash";
function createWindows() {
const mainWindow = createMainWindow();
const splash = createSplashWindow();
mainWindow.once("ready-to-show", () => {
splash.destroy();
mainWindow.show();
});
}
app.whenReady().then(() => {
createWindows();
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) createWindows();
});
});
app.on("window-all-closed", () => {
if (process.platform !== "darwin")
app.quit();
});

19
src/main/mainWindow.ts Normal file
View File

@@ -0,0 +1,19 @@
import { BrowserWindow } from "electron";
import { join } from "path";
export function createMainWindow() {
const win = new BrowserWindow({
show: false,
webPreferences: {
nodeIntegration: false,
sandbox: true,
contextIsolation: true,
devTools: true,
preload: join(__dirname, "preload.js")
}
});
win.loadURL("https://discord.com/app");
return win;
}

18
src/main/splash.ts Normal file
View File

@@ -0,0 +1,18 @@
import { BrowserWindow } from "electron";
import { join } from "path";
export function createSplashWindow() {
const splash = new BrowserWindow({
transparent: true,
frame: false,
height: 350,
width: 300,
center: true,
resizable: false,
maximizable: false
});
splash.loadFile(join(__dirname, "..", "static", "splash.html"));
return splash;
}