Cleanup
This commit is contained in:
parent
4abce9d084
commit
477ecbb4ba
11 changed files with 12 additions and 34 deletions
1
src/globals.d.ts
vendored
1
src/globals.d.ts
vendored
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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");
|
||||
});
|
||||
|
|
|
@ -23,7 +23,7 @@ export function addPatch<P extends PatchData>(p: P) {
|
|||
}
|
||||
|
||||
patch.plugin = "VencordDesktop";
|
||||
Vencord.Plugins.patches.push(patch as Patch);
|
||||
Vencord.Plugins.patches.push(patch);
|
||||
}
|
||||
|
||||
Object.assign(VCDP, globals);
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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<O extends object>(
|
||||
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;
|
||||
}
|
|
@ -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";
|
||||
|
|
|
@ -155,7 +155,10 @@
|
|||
<label>
|
||||
<div>
|
||||
<h2>Rich Presence</h2>
|
||||
<span>Enable Rich presence (game activity) via arRPC</span>
|
||||
<span
|
||||
>Enable Rich presence (game activity) via
|
||||
<a href="https://github.com/OpenAsar/arrpc" target="_blank">arRPC</a></span
|
||||
>
|
||||
</div>
|
||||
<input type="checkbox" name="richPresence" checked />
|
||||
</label>
|
||||
|
|
Loading…
Reference in a new issue