2023-04-10 05:49:50 +09:00
|
|
|
/*
|
|
|
|
* SPDX-License-Identifier: GPL-3.0
|
2023-07-14 02:03:13 +09:00
|
|
|
* Vesktop, a desktop app aiming to give you a snappier Discord Experience
|
2023-04-10 05:49:50 +09:00
|
|
|
* Copyright (c) 2023 Vendicated and Vencord contributors
|
|
|
|
*/
|
|
|
|
|
2023-07-14 09:14:48 +09:00
|
|
|
import {
|
|
|
|
app,
|
|
|
|
BrowserWindow,
|
|
|
|
BrowserWindowConstructorOptions,
|
|
|
|
dialog,
|
|
|
|
Menu,
|
|
|
|
MenuItemConstructorOptions,
|
2023-10-14 12:04:44 +09:00
|
|
|
nativeTheme,
|
2023-07-14 09:14:48 +09:00
|
|
|
Tray
|
|
|
|
} from "electron";
|
|
|
|
import { rm } from "fs/promises";
|
2023-03-30 08:02:30 +09:00
|
|
|
import { join } from "path";
|
2023-06-25 10:44:19 +09:00
|
|
|
import { IpcEvents } from "shared/IpcEvents";
|
2023-07-12 04:35:15 +09:00
|
|
|
import { isTruthy } from "shared/utils/guards";
|
2023-06-21 21:39:41 +09:00
|
|
|
import { once } from "shared/utils/once";
|
2023-06-25 23:48:26 +09:00
|
|
|
import type { SettingsStore } from "shared/utils/SettingsStore";
|
2023-04-10 05:49:50 +09:00
|
|
|
|
2023-04-04 08:35:37 +09:00
|
|
|
import { ICON_PATH } from "../shared/paths";
|
2023-04-06 00:55:49 +09:00
|
|
|
import { createAboutWindow } from "./about";
|
2023-06-21 21:39:41 +09:00
|
|
|
import { initArRPC } from "./arrpc";
|
2023-07-14 09:14:48 +09:00
|
|
|
import { DATA_DIR, DEFAULT_HEIGHT, DEFAULT_WIDTH, MIN_HEIGHT, MIN_WIDTH, VENCORD_FILES_DIR } from "./constants";
|
2023-04-09 12:25:45 +09:00
|
|
|
import { Settings, VencordSettings } from "./settings";
|
2023-06-21 21:39:41 +09:00
|
|
|
import { createSplashWindow } from "./splash";
|
2023-04-06 00:55:49 +09:00
|
|
|
import { makeLinksOpenExternally } from "./utils/makeLinksOpenExternally";
|
2023-06-21 21:39:41 +09:00
|
|
|
import { downloadVencordFiles, ensureVencordFiles } from "./utils/vencordLoader";
|
2023-03-30 08:02:30 +09:00
|
|
|
|
2023-04-04 08:47:33 +09:00
|
|
|
let isQuitting = false;
|
2023-04-11 02:12:58 +09:00
|
|
|
let tray: Tray;
|
2023-04-04 07:41:52 +09:00
|
|
|
|
2023-04-04 08:47:33 +09:00
|
|
|
app.on("before-quit", () => {
|
|
|
|
isQuitting = true;
|
|
|
|
});
|
|
|
|
|
2023-04-05 12:19:48 +09:00
|
|
|
export let mainWin: BrowserWindow;
|
|
|
|
|
2023-06-25 23:48:26 +09:00
|
|
|
function makeSettingsListenerHelpers<O extends object>(o: SettingsStore<O>) {
|
|
|
|
const listeners = new Map<(data: any) => void, PropertyKey>();
|
|
|
|
|
|
|
|
const addListener: typeof o.addChangeListener = (path, cb) => {
|
|
|
|
listeners.set(cb, path);
|
|
|
|
o.addChangeListener(path, cb);
|
|
|
|
};
|
2023-06-26 07:05:08 +09:00
|
|
|
const removeAllListeners = () => {
|
2023-06-25 23:48:26 +09:00
|
|
|
for (const [listener, path] of listeners) {
|
|
|
|
o.removeChangeListener(path as any, listener);
|
|
|
|
}
|
|
|
|
|
|
|
|
listeners.clear();
|
|
|
|
};
|
|
|
|
|
2023-06-26 07:05:08 +09:00
|
|
|
return [addListener, removeAllListeners] as const;
|
2023-06-25 23:48:26 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
const [addSettingsListener, removeSettingsListeners] = makeSettingsListenerHelpers(Settings);
|
|
|
|
const [addVencordSettingsListener, removeVencordSettingsListeners] = makeSettingsListenerHelpers(VencordSettings);
|
|
|
|
|
2023-04-04 08:47:33 +09:00
|
|
|
function initTray(win: BrowserWindow) {
|
2023-04-04 08:35:37 +09:00
|
|
|
const trayMenu = Menu.buildFromTemplate([
|
|
|
|
{
|
|
|
|
label: "Open",
|
|
|
|
click() {
|
|
|
|
win.show();
|
|
|
|
},
|
|
|
|
enabled: false
|
|
|
|
},
|
2023-04-06 07:08:28 +09:00
|
|
|
{
|
|
|
|
label: "About",
|
|
|
|
click: createAboutWindow
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: "Update Vencord",
|
|
|
|
async click() {
|
|
|
|
await downloadVencordFiles();
|
|
|
|
app.relaunch();
|
|
|
|
app.quit();
|
|
|
|
}
|
|
|
|
},
|
2023-07-14 09:14:48 +09:00
|
|
|
{
|
|
|
|
label: "Reset Vesktop",
|
|
|
|
async click() {
|
|
|
|
await clearData(win);
|
|
|
|
}
|
|
|
|
},
|
2023-04-06 10:52:06 +09:00
|
|
|
{
|
|
|
|
type: "separator"
|
|
|
|
},
|
2023-04-06 07:08:28 +09:00
|
|
|
{
|
|
|
|
label: "Relaunch",
|
|
|
|
click() {
|
|
|
|
app.relaunch();
|
|
|
|
app.quit();
|
|
|
|
}
|
|
|
|
},
|
2023-04-04 08:35:37 +09:00
|
|
|
{
|
2023-07-14 02:03:13 +09:00
|
|
|
label: "Quit Vesktop",
|
2023-04-04 08:35:37 +09:00
|
|
|
click() {
|
|
|
|
isQuitting = true;
|
|
|
|
app.quit();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]);
|
|
|
|
|
2023-04-11 02:12:58 +09:00
|
|
|
tray = new Tray(ICON_PATH);
|
2023-07-14 02:03:13 +09:00
|
|
|
tray.setToolTip("Vesktop");
|
2023-04-04 08:35:37 +09:00
|
|
|
tray.setContextMenu(trayMenu);
|
|
|
|
tray.on("click", () => win.show());
|
|
|
|
|
2023-04-04 08:47:33 +09:00
|
|
|
win.on("show", () => {
|
|
|
|
trayMenu.items[0].enabled = false;
|
|
|
|
});
|
|
|
|
|
|
|
|
win.on("hide", () => {
|
|
|
|
trayMenu.items[0].enabled = true;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2023-07-14 09:14:48 +09:00
|
|
|
const enum MessageBoxChoice {
|
|
|
|
Default,
|
|
|
|
Cancel
|
|
|
|
}
|
|
|
|
|
|
|
|
async function clearData(win: BrowserWindow) {
|
|
|
|
const { response } = await dialog.showMessageBox(win, {
|
|
|
|
message: "Are you sure you want to reset Vesktop?",
|
|
|
|
detail: "This will log you out, clear caches and reset all your settings!\n\nVesktop will automatically restart after this operation.",
|
|
|
|
buttons: ["Yes", "No"],
|
|
|
|
cancelId: MessageBoxChoice.Cancel,
|
|
|
|
defaultId: MessageBoxChoice.Default,
|
|
|
|
type: "warning"
|
|
|
|
});
|
|
|
|
|
|
|
|
if (response === MessageBoxChoice.Cancel) return;
|
|
|
|
|
|
|
|
win.close();
|
|
|
|
|
|
|
|
await win.webContents.session.clearStorageData();
|
|
|
|
await win.webContents.session.clearCache();
|
|
|
|
await win.webContents.session.clearCodeCaches({});
|
|
|
|
await rm(DATA_DIR, { force: true, recursive: true });
|
|
|
|
|
|
|
|
app.relaunch();
|
|
|
|
app.quit();
|
|
|
|
}
|
|
|
|
|
2023-10-01 05:43:27 +09:00
|
|
|
type MenuItemList = Array<MenuItemConstructorOptions | false>;
|
|
|
|
|
2023-04-06 00:25:29 +09:00
|
|
|
function initMenuBar(win: BrowserWindow) {
|
2023-04-09 12:25:45 +09:00
|
|
|
const isWindows = process.platform === "win32";
|
2023-07-12 04:35:15 +09:00
|
|
|
const isDarwin = process.platform === "darwin";
|
2023-04-10 08:04:41 +09:00
|
|
|
const wantCtrlQ = !isWindows || VencordSettings.store.winCtrlQ;
|
2023-04-09 12:25:45 +09:00
|
|
|
|
2023-07-12 04:35:15 +09:00
|
|
|
const subMenu = [
|
|
|
|
{
|
2023-07-14 02:03:13 +09:00
|
|
|
label: "About Vesktop",
|
2023-07-12 04:35:15 +09:00
|
|
|
click: createAboutWindow
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: "Force Update Vencord",
|
|
|
|
async click() {
|
|
|
|
await downloadVencordFiles();
|
|
|
|
app.relaunch();
|
|
|
|
app.quit();
|
|
|
|
},
|
2023-07-14 02:03:13 +09:00
|
|
|
toolTip: "Vesktop will automatically restart after this operation"
|
2023-07-12 04:35:15 +09:00
|
|
|
},
|
2023-07-14 09:14:48 +09:00
|
|
|
{
|
|
|
|
label: "Reset Vesktop",
|
|
|
|
async click() {
|
|
|
|
await clearData(win);
|
|
|
|
},
|
|
|
|
toolTip: "Vesktop will automatically restart after this operation"
|
|
|
|
},
|
2023-07-12 04:35:15 +09:00
|
|
|
{
|
|
|
|
label: "Relaunch",
|
|
|
|
accelerator: "CmdOrCtrl+Shift+R",
|
|
|
|
click() {
|
|
|
|
app.relaunch();
|
|
|
|
app.quit();
|
|
|
|
}
|
|
|
|
},
|
2023-10-01 05:43:27 +09:00
|
|
|
...(!isDarwin
|
|
|
|
? []
|
|
|
|
: ([
|
|
|
|
{
|
|
|
|
type: "separator"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: "Settings",
|
|
|
|
accelerator: "CmdOrCtrl+,",
|
|
|
|
async click() {
|
|
|
|
mainWin.webContents.executeJavaScript(
|
|
|
|
"Vencord.Webpack.Common.SettingsRouter.open('My Account')"
|
|
|
|
);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: "separator"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: "Hide Vesktop", // Should probably remove the label, but it says "Hide VencordDesktop" instead of "Hide Vesktop"
|
|
|
|
role: "hide"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
role: "hideOthers"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
role: "unhide"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: "separator"
|
|
|
|
}
|
|
|
|
] satisfies MenuItemList)),
|
2023-07-12 04:35:15 +09:00
|
|
|
{
|
|
|
|
label: "Quit",
|
|
|
|
accelerator: wantCtrlQ ? "CmdOrCtrl+Q" : void 0,
|
|
|
|
visible: !isWindows,
|
|
|
|
role: "quit",
|
|
|
|
click() {
|
|
|
|
app.quit();
|
|
|
|
}
|
|
|
|
},
|
2023-07-14 02:07:19 +09:00
|
|
|
isWindows && {
|
2023-07-12 04:35:15 +09:00
|
|
|
label: "Quit",
|
2023-07-14 02:07:19 +09:00
|
|
|
accelerator: "Alt+F4",
|
2023-07-12 04:35:15 +09:00
|
|
|
role: "quit",
|
|
|
|
click() {
|
|
|
|
app.quit();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
// See https://github.com/electron/electron/issues/14742 and https://github.com/electron/electron/issues/5256
|
|
|
|
{
|
|
|
|
label: "Zoom in (hidden, hack for Qwertz and others)",
|
|
|
|
accelerator: "CmdOrCtrl+=",
|
|
|
|
role: "zoomIn",
|
|
|
|
visible: false
|
|
|
|
}
|
2023-10-01 05:43:27 +09:00
|
|
|
] satisfies MenuItemList;
|
2023-07-12 04:35:15 +09:00
|
|
|
|
2023-04-06 00:25:29 +09:00
|
|
|
const menu = Menu.buildFromTemplate([
|
|
|
|
{
|
2023-07-14 02:03:13 +09:00
|
|
|
label: "Vesktop",
|
2023-04-15 19:37:52 +09:00
|
|
|
role: "appMenu",
|
2023-07-12 04:35:15 +09:00
|
|
|
submenu: subMenu.filter(isTruthy)
|
2023-04-06 00:25:29 +09:00
|
|
|
},
|
2023-04-15 19:37:52 +09:00
|
|
|
{ role: "fileMenu" },
|
|
|
|
{ role: "editMenu" },
|
|
|
|
{ role: "viewMenu" },
|
2023-04-27 09:23:17 +09:00
|
|
|
{ role: "windowMenu" }
|
2023-04-06 00:25:29 +09:00
|
|
|
]);
|
|
|
|
|
|
|
|
Menu.setApplicationMenu(menu);
|
|
|
|
}
|
|
|
|
|
2023-04-09 12:04:49 +09:00
|
|
|
function getWindowBoundsOptions(): BrowserWindowConstructorOptions {
|
2023-04-10 08:04:41 +09:00
|
|
|
const { x, y, width, height } = Settings.store.windowBounds ?? {};
|
2023-04-09 12:04:49 +09:00
|
|
|
|
|
|
|
const options = {
|
|
|
|
width: width ?? DEFAULT_WIDTH,
|
|
|
|
height: height ?? DEFAULT_HEIGHT
|
|
|
|
} as BrowserWindowConstructorOptions;
|
|
|
|
|
2023-04-04 11:17:38 +09:00
|
|
|
if (x != null && y != null) {
|
|
|
|
options.x = x;
|
|
|
|
options.y = y;
|
|
|
|
}
|
|
|
|
|
2023-04-10 08:04:41 +09:00
|
|
|
if (!Settings.store.disableMinSize) {
|
2023-04-09 12:04:49 +09:00
|
|
|
options.minWidth = MIN_WIDTH;
|
|
|
|
options.minHeight = MIN_HEIGHT;
|
|
|
|
}
|
2023-04-04 11:17:38 +09:00
|
|
|
|
|
|
|
return options;
|
|
|
|
}
|
|
|
|
|
|
|
|
function initWindowBoundsListeners(win: BrowserWindow) {
|
2023-04-09 12:04:49 +09:00
|
|
|
const saveState = () => {
|
2023-04-10 08:04:41 +09:00
|
|
|
Settings.store.maximized = win.isMaximized();
|
|
|
|
Settings.store.minimized = win.isMinimized();
|
2023-04-09 12:04:49 +09:00
|
|
|
};
|
2023-04-04 11:17:38 +09:00
|
|
|
|
2023-04-09 12:04:49 +09:00
|
|
|
win.on("maximize", saveState);
|
|
|
|
win.on("minimize", saveState);
|
|
|
|
win.on("unmaximize", saveState);
|
2023-04-04 11:17:38 +09:00
|
|
|
|
|
|
|
const saveBounds = () => {
|
2023-04-10 08:04:41 +09:00
|
|
|
Settings.store.windowBounds = win.getBounds();
|
2023-04-04 11:17:38 +09:00
|
|
|
};
|
|
|
|
|
|
|
|
win.on("resize", saveBounds);
|
|
|
|
win.on("move", saveBounds);
|
|
|
|
}
|
|
|
|
|
2023-04-10 08:43:47 +09:00
|
|
|
function initSettingsListeners(win: BrowserWindow) {
|
2023-06-25 23:48:26 +09:00
|
|
|
addSettingsListener("tray", enable => {
|
2023-04-11 02:18:00 +09:00
|
|
|
if (enable) initTray(win);
|
|
|
|
else tray?.destroy();
|
2023-04-11 02:12:58 +09:00
|
|
|
});
|
2023-06-25 23:48:26 +09:00
|
|
|
addSettingsListener("disableMinSize", disable => {
|
2023-04-10 08:55:48 +09:00
|
|
|
if (disable) {
|
|
|
|
// 0 no work
|
|
|
|
win.setMinimumSize(1, 1);
|
|
|
|
} else {
|
|
|
|
win.setMinimumSize(MIN_WIDTH, MIN_HEIGHT);
|
|
|
|
|
|
|
|
const { width, height } = win.getBounds();
|
|
|
|
win.setBounds({
|
|
|
|
width: Math.max(width, MIN_WIDTH),
|
|
|
|
height: Math.max(height, MIN_HEIGHT)
|
|
|
|
});
|
|
|
|
}
|
2023-04-10 08:43:47 +09:00
|
|
|
});
|
2023-04-11 02:21:45 +09:00
|
|
|
|
2023-06-25 23:48:26 +09:00
|
|
|
addVencordSettingsListener("macosTranslucency", enabled => {
|
2023-04-11 02:21:45 +09:00
|
|
|
if (enabled) {
|
|
|
|
win.setVibrancy("sidebar");
|
|
|
|
win.setBackgroundColor("#ffffff00");
|
|
|
|
} else {
|
|
|
|
win.setVibrancy(null);
|
|
|
|
win.setBackgroundColor("#ffffff");
|
|
|
|
}
|
|
|
|
});
|
2023-07-29 04:54:17 +09:00
|
|
|
|
|
|
|
addSettingsListener("enableMenu", enabled => {
|
|
|
|
win.setAutoHideMenuBar(enabled ?? false);
|
|
|
|
});
|
2023-04-10 08:43:47 +09:00
|
|
|
}
|
|
|
|
|
2023-06-25 10:44:19 +09:00
|
|
|
function initSpellCheck(win: BrowserWindow) {
|
|
|
|
win.webContents.on("context-menu", (_, data) => {
|
|
|
|
win.webContents.send(IpcEvents.SPELLCHECK_RESULT, data.misspelledWord, data.dictionarySuggestions);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2023-06-21 21:39:41 +09:00
|
|
|
function createMainWindow() {
|
2023-06-25 23:48:26 +09:00
|
|
|
// Clear up previous settings listeners
|
|
|
|
removeSettingsListeners();
|
|
|
|
removeVencordSettingsListeners();
|
|
|
|
|
2023-10-14 12:04:44 +09:00
|
|
|
const { staticTitle, transparencyOption, splashTheming, splashBackground, enableMenu, discordWindowsTitleBar } =
|
|
|
|
Settings.store;
|
|
|
|
|
2023-07-13 01:56:50 +09:00
|
|
|
const { frameless, macosTranslucency } = VencordSettings.store;
|
2023-08-07 07:23:27 +09:00
|
|
|
|
|
|
|
const noFrame = frameless === true || (process.platform === "win32" && discordWindowsTitleBar === true);
|
|
|
|
|
2023-04-10 05:49:50 +09:00
|
|
|
const win = (mainWin = new BrowserWindow({
|
2023-04-04 08:47:33 +09:00
|
|
|
show: false,
|
|
|
|
webPreferences: {
|
|
|
|
nodeIntegration: false,
|
|
|
|
sandbox: false,
|
|
|
|
contextIsolation: true,
|
|
|
|
devTools: true,
|
2023-06-25 10:44:19 +09:00
|
|
|
preload: join(__dirname, "preload.js"),
|
|
|
|
spellcheck: true
|
2023-04-04 08:47:33 +09:00
|
|
|
},
|
2023-04-04 11:17:38 +09:00
|
|
|
icon: ICON_PATH,
|
2023-08-07 07:23:27 +09:00
|
|
|
frame: !noFrame,
|
2023-07-13 01:56:50 +09:00
|
|
|
...(transparencyOption && transparencyOption !== "none"
|
2023-07-12 03:45:30 +09:00
|
|
|
? {
|
|
|
|
backgroundColor: "#00000000",
|
2023-10-14 12:04:44 +09:00
|
|
|
backgroundMaterial: transparencyOption,
|
2023-07-12 03:45:30 +09:00
|
|
|
transparent: true
|
|
|
|
}
|
2023-07-13 01:56:50 +09:00
|
|
|
: {}),
|
2023-08-03 06:59:02 +09:00
|
|
|
...(staticTitle ? { title: "Vesktop" } : {}),
|
2023-07-13 01:56:50 +09:00
|
|
|
...(macosTranslucency
|
2023-04-11 02:21:45 +09:00
|
|
|
? {
|
|
|
|
vibrancy: "sidebar",
|
|
|
|
backgroundColor: "#ffffff00"
|
|
|
|
}
|
2023-10-14 12:04:44 +09:00
|
|
|
: {
|
|
|
|
backgroundColor: splashTheming
|
|
|
|
? splashBackground
|
|
|
|
: nativeTheme.shouldUseDarkColors
|
|
|
|
? "#313338"
|
|
|
|
: "#ffffff",
|
|
|
|
transparent: false
|
|
|
|
}),
|
2023-07-14 09:07:48 +09:00
|
|
|
...(process.platform === "darwin" ? { titleBarStyle: "hiddenInset" } : {}),
|
2023-07-29 04:54:17 +09:00
|
|
|
...getWindowBoundsOptions(),
|
|
|
|
autoHideMenuBar: enableMenu
|
2023-04-10 05:49:50 +09:00
|
|
|
}));
|
2023-07-04 05:25:11 +09:00
|
|
|
win.setMenuBarVisibility(false);
|
2023-04-04 07:41:52 +09:00
|
|
|
|
|
|
|
win.on("close", e => {
|
2023-07-27 07:46:25 +09:00
|
|
|
const useTray = Settings.store.minimizeToTray !== false && Settings.store.tray !== false;
|
2023-07-12 03:57:10 +09:00
|
|
|
if (isQuitting || (process.platform !== "darwin" && !useTray)) return;
|
2023-04-04 07:41:52 +09:00
|
|
|
|
|
|
|
e.preventDefault();
|
2023-07-12 03:57:10 +09:00
|
|
|
|
|
|
|
if (process.platform === "darwin") app.hide();
|
|
|
|
else win.hide();
|
2023-04-04 07:41:52 +09:00
|
|
|
|
|
|
|
return false;
|
2023-03-30 08:02:30 +09:00
|
|
|
});
|
|
|
|
|
2023-04-20 11:26:56 +09:00
|
|
|
if (Settings.store.staticTitle) win.on("page-title-updated", e => e.preventDefault());
|
|
|
|
|
2023-04-04 11:17:38 +09:00
|
|
|
initWindowBoundsListeners(win);
|
2023-07-27 09:20:15 +09:00
|
|
|
if ((Settings.store.tray ?? true) && process.platform !== "darwin") initTray(win);
|
2023-04-06 00:25:29 +09:00
|
|
|
initMenuBar(win);
|
2023-04-06 00:55:49 +09:00
|
|
|
makeLinksOpenExternally(win);
|
2023-04-10 08:43:47 +09:00
|
|
|
initSettingsListeners(win);
|
2023-06-25 10:44:19 +09:00
|
|
|
initSpellCheck(win);
|
2023-04-04 07:41:52 +09:00
|
|
|
|
2023-04-16 03:13:18 +09:00
|
|
|
win.webContents.setUserAgent(
|
2023-06-23 23:03:31 +09:00
|
|
|
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
|
2023-04-16 03:13:18 +09:00
|
|
|
);
|
|
|
|
|
2023-04-10 05:49:50 +09:00
|
|
|
const subdomain =
|
2023-04-10 08:04:41 +09:00
|
|
|
Settings.store.discordBranch === "canary" || Settings.store.discordBranch === "ptb"
|
|
|
|
? `${Settings.store.discordBranch}.`
|
|
|
|
: "";
|
2023-04-04 11:40:03 +09:00
|
|
|
|
|
|
|
win.loadURL(`https://${subdomain}discord.com/app`);
|
2023-03-30 08:02:30 +09:00
|
|
|
|
|
|
|
return win;
|
|
|
|
}
|
2023-06-21 21:39:41 +09:00
|
|
|
|
|
|
|
const runVencordMain = once(() => require(join(VENCORD_FILES_DIR, "vencordDesktopMain.js")));
|
|
|
|
|
|
|
|
export async function createWindows() {
|
|
|
|
const splash = createSplashWindow();
|
|
|
|
|
|
|
|
await ensureVencordFiles();
|
|
|
|
runVencordMain();
|
|
|
|
|
|
|
|
mainWin = createMainWindow();
|
|
|
|
|
|
|
|
mainWin.once("ready-to-show", () => {
|
|
|
|
splash.destroy();
|
|
|
|
mainWin!.show();
|
|
|
|
|
|
|
|
if (Settings.store.maximized) {
|
|
|
|
mainWin!.maximize();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
initArRPC();
|
|
|
|
}
|