"its more readable" statements by the deranged

This commit is contained in:
Kylie C 2024-10-04 16:47:33 -04:00
parent b44e44686d
commit 5381340074
2 changed files with 6 additions and 4 deletions

View file

@ -72,7 +72,8 @@ function init() {
if (isDeckGameMode) nativeTheme.themeSource = "dark";
app.on("second-instance", (_event, _cmdLine, _cwd, data: any) => {
data.IS_DEV ? app.quit() : restoreVesktop();
if (data.IS_DEV) app.quit();
else restoreVesktop();
});
app.whenReady().then(async () => {

View file

@ -457,12 +457,13 @@ function createMainWindow() {
let uriFiredDarwin = false;
app.on("open-url", (_, url) => {
uriFiredDarwin ? restoreVesktop() : loadUrl(url);
if (uriFiredDarwin) restoreVesktop();
else loadUrl(url);
uriFiredDarwin = true;
});
const uri = process.argv.find(arg => arg.startsWith("discord://"));
uriFiredDarwin || loadUrl(uri);
if (!uriFiredDarwin) loadUrl(uri);
return win;
}
@ -472,7 +473,7 @@ const runVencordMain = once(() => require(join(VENCORD_FILES_DIR, "vencordDeskto
export function loadUrl(uri: string | undefined) {
const branch = Settings.store.discordBranch;
const subdomain = branch === "canary" || branch === "ptb" ? `${branch}.` : "";
mainWin.loadURL(`https://${subdomain}discord.com/${uri?.replace(RegExp("^discord://[^/]*/?"), "") || "app"}`);
mainWin.loadURL(`https://${subdomain}discord.com/${uri ? new URL(uri).pathname.slice(1) || "app" : "app"}`);
}
export function restoreVesktop() {