diff --git a/src/globals.d.ts b/src/globals.d.ts index 90633f9..d05fe1b 100644 --- a/src/globals.d.ts +++ b/src/globals.d.ts @@ -7,7 +7,6 @@ declare global { export var VencordDesktopNative: typeof import("preload/VencordDesktopNative").VencordDesktopNative; export var VencordDesktop: typeof import("renderer/index"); - export var vcdLS: typeof localStorage; export var VCDP: any; export var IS_DEV: boolean; diff --git a/src/main/firstLaunch.ts b/src/main/firstLaunch.ts index f1b39dd..b91784e 100644 --- a/src/main/firstLaunch.ts +++ b/src/main/firstLaunch.ts @@ -15,6 +15,7 @@ import { autoStart } from "./autoStart"; import { DATA_DIR } from "./constants"; import { createWindows } from "./mainWindow"; import { Settings } from "./settings"; +import { makeLinksOpenExternally } from "./utils/makeLinksOpenExternally"; interface Data { minimizeToTray: boolean; @@ -33,6 +34,8 @@ export function createFirstLaunchTour() { width: 550 }); + makeLinksOpenExternally(win); + win.loadFile(join(VIEW_DIR, "first-launch.html")); win.webContents.addListener("console-message", (_e, _l, msg) => { if (msg === "cancel") return app.exit(); diff --git a/src/main/index.ts b/src/main/index.ts index 0fa67eb..1461714 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -24,8 +24,6 @@ if (IS_DEV) { process.env.VENCORD_USER_DATA_DIR = DATA_DIR; function init() { - // <-- BEGIN COPY PASTED FROM DISCORD --> - // work around chrome 66 disabling autoplay by default app.commandLine.appendSwitch("autoplay-policy", "no-user-gesture-required"); @@ -38,8 +36,6 @@ function init() { "WinRetrieveSuggestionsOnlyOnDemand,HardwareMediaKeyHandling,MediaSessionService,WidgetLayering" ); - // <-- END COPY PASTED FROM DISCORD --> - app.on("second-instance", (_event, _cmdLine, _cwd, data: any) => { if (data.IS_DEV) app.quit(); else if (mainWin) { diff --git a/src/preload/VencordDesktopNative.ts b/src/preload/VencordDesktopNative.ts index f0f7c9c..6f0f402 100644 --- a/src/preload/VencordDesktopNative.ts +++ b/src/preload/VencordDesktopNative.ts @@ -9,7 +9,7 @@ import type { Settings } from "shared/settings"; import type { LiteralUnion } from "type-fest"; import { IpcEvents } from "../shared/IpcEvents"; -import { invoke, sendSync } from "./typedIpcs"; +import { invoke, sendSync } from "./typedIpc"; type SpellCheckerResultCallback = (word: string, suggestions: string[]) => void; diff --git a/src/preload/typedIpcs.ts b/src/preload/typedIpc.ts similarity index 100% rename from src/preload/typedIpcs.ts rename to src/preload/typedIpc.ts diff --git a/src/renderer/fixes.ts b/src/renderer/fixes.ts index 48b2b94..805aac5 100644 --- a/src/renderer/fixes.ts +++ b/src/renderer/fixes.ts @@ -22,11 +22,11 @@ Object.defineProperty(Notification.prototype, "onclick", { configurable: true }); -// Enable Desktop Notifications by default if (isFirstRun) { // Hide "Download Discord Desktop now!!!!" banner localStorage.setItem("hideNag", "true"); + // Enable Desktop Notifications by default waitFor("setDesktopType", m => { m.setDesktopType("all"); }); diff --git a/src/renderer/patches/shared.ts b/src/renderer/patches/shared.ts index 6ec9d5d..7749c8e 100644 --- a/src/renderer/patches/shared.ts +++ b/src/renderer/patches/shared.ts @@ -23,7 +23,7 @@ export function addPatch

(p: P) { } patch.plugin = "VencordDesktop"; - Vencord.Plugins.patches.push(patch as Patch); + Vencord.Plugins.patches.push(patch); } Object.assign(VCDP, globals); diff --git a/src/renderer/utils.ts b/src/renderer/utils.ts index 8c1050f..edc3e97 100644 --- a/src/renderer/utils.ts +++ b/src/renderer/utils.ts @@ -4,7 +4,7 @@ * Copyright (c) 2023 Vendicated and Vencord contributors */ -export const localStorage = (window.vcdLS = window.localStorage); +export const { localStorage } = window; export const isFirstRun = (() => { const key = "VCD_FIRST_RUN"; diff --git a/src/shared/utils/monkeyPatch.ts b/src/shared/utils/monkeyPatch.ts deleted file mode 100644 index 25f0f80..0000000 --- a/src/shared/utils/monkeyPatch.ts +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SPDX-License-Identifier: GPL-3.0 - * Vencord Desktop, a desktop app aiming to give you a snappier Discord Experience - * Copyright (c) 2023 Vendicated and Vencord contributors - */ - -type Func = (...args: any[]) => any; - -export function monkeyPatch( - object: O, - key: keyof O, - replacement: (original: Func, ...args: any[]) => any -): void { - const original = object[key] as Func; - - const replacer = (object[key] = function (this: unknown, ...args: any[]) { - return replacement.call(this, original, ...args); - } as any); - - Object.defineProperties(replacer, Object.getOwnPropertyDescriptors(original)); - replacer.toString = () => original.toString(); - replacer.$$original = original; -} diff --git a/src/updater/preload.ts b/src/updater/preload.ts index 8b539b8..4404144 100644 --- a/src/updater/preload.ts +++ b/src/updater/preload.ts @@ -5,7 +5,7 @@ */ import { contextBridge } from "electron"; -import { invoke } from "preload/typedIpcs"; +import { invoke } from "preload/typedIpc"; import { IpcEvents } from "shared/IpcEvents"; import type { UpdateData } from "./main"; diff --git a/static/views/first-launch.html b/static/views/first-launch.html index 1687033..e7ca9de 100644 --- a/static/views/first-launch.html +++ b/static/views/first-launch.html @@ -155,7 +155,10 @@

Rich Presence

- Enable Rich presence (game activity) via arRPC + Enable Rich presence (game activity) via + arRPC