Skip to content

Commit

Permalink
Open invites in app
Browse files Browse the repository at this point in the history
  • Loading branch information
Milkshiift committed Aug 26, 2024
1 parent 07e05ff commit 4840596
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/modules/arrpc.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
import { getConfig } from "../config";
import { mainWindow } from "../window";

export async function initArrpc() {
if (!getConfig("arrpc")) return;
try {
const { default: Server } = await import("arrpc");
const Bridge = await import("arrpc/src/bridge.js");
const server = await new Server();
server.on("activity", (data: any) => Bridge.send(data));
server.on("activity", (data: object) => Bridge.send(data));
server.on("invite", (code: string) => {
mainWindow.webContents.executeJavaScript(`
shelter.http.post({
url: "/invites/${code}"
})
`);
mainWindow.show();
});
} catch (e) {
console.error("Failed to start arRPC server", e);
}
Expand Down

0 comments on commit 4840596

Please sign in to comment.