Add arRPC integration
This commit is contained in:
21
src/main/arrpc.ts
Normal file
21
src/main/arrpc.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
import Server from "arrpc";
|
||||
import { send as sendToBridge } from "arrpc/src/bridge";
|
||||
|
||||
import { Settings } from "./settings";
|
||||
|
||||
let server: any;
|
||||
|
||||
export async function initArRPC() {
|
||||
if (server || !Settings.store.arRPC) return;
|
||||
|
||||
server = await new Server();
|
||||
server.on("activity", sendToBridge);
|
||||
}
|
||||
|
||||
Settings.addChangeListener("arRPC", initArRPC);
|
||||
@@ -12,6 +12,7 @@ import { checkUpdates } from "updater/main";
|
||||
|
||||
import { ICON_PATH } from "../shared/paths";
|
||||
import { once } from "../shared/utils/once";
|
||||
import { initArRPC } from "./arrpc";
|
||||
import { DATA_DIR, VENCORD_FILES_DIR } from "./constants";
|
||||
import { createMainWindow } from "./mainWindow";
|
||||
import { Settings } from "./settings";
|
||||
@@ -94,6 +95,8 @@ async function createWindows() {
|
||||
mainWin!.maximize();
|
||||
}
|
||||
});
|
||||
|
||||
initArRPC();
|
||||
}
|
||||
|
||||
app.on("window-all-closed", () => {
|
||||
|
||||
Reference in New Issue
Block a user