Files
burrow-client/app/gamePreload.js
T
Burrowdev 92c5042c5e feat: discord rich presence
Client 1.3.0 shows "Playing Burrow" on the player's Discord profile while
the game is open: where they are (the game's ajPresence, dens and player
parties never named), the time since they started and a button to the
download page. It goes through the Discord app's local IPC socket (no
packages; Windows pipe, Linux and macOS sockets, Flatpak and Snap too) and
retries quietly while Discord is not running. The server names its Discord
application in its flashvars (discordAppId); none, no presence.
2026-10-18 18:52:34 +03:00

38 lines
778 B
JavaScript

"use strict";
const { ipcRenderer, contextBridge } = require("electron");
const sendWhitelist = new Set()
.add("initialized")
.add("fps")
.add("openPage")
.add("presence")
.add("printImage")
.add("reloadGame")
.add("reportError")
.add("signupCompleted");
const receiveWhitelist = new Set()
.add("flashVarsReady")
.add("hud")
.add("removed");
contextBridge.exposeInMainWorld(
"ipc", {
sendToHost: (channel, ...args) => {
if (sendWhitelist.has(channel)) {
ipcRenderer.sendToHost(channel, ...args);
}
},
on: (channel, listener) => {
if (receiveWhitelist.has(channel)) {
ipcRenderer.on(channel, listener);
}
}
}
);
ipcRenderer.on("redirect-url", (event, url) => {
console.log("REDIRECT");
});