fix: discord presence on windows (client 1.3.1)

crypto.randomUUID does not exist in Electron 11's Node 12.18, so every
presence update threw in the main process on Windows. Request ids come
from crypto.randomBytes now.
This commit is contained in:
Burrowdev committed 2026-10-18 19:46:27 +03:00
1 parent 92c5042c5e
commit 2b70e10624
2 files changed
+6 -3

No files matched your search

+5 -2
View File
@@ -39,6 +39,9 @@ let ready = false;
let retry = null;
let buffer = Buffer.alloc(0);
// a request's id. (not crypto.randomUUID: Electron 11's Node 12 has none)
const nonce = () => crypto.randomBytes(16).toString("hex");
const frame = (op, data) => {
const body = Buffer.from(JSON.stringify(data));
const head = Buffer.alloc(8);
@@ -52,7 +55,7 @@ const send = () => {
return;
}
socket.write(frame(OP_FRAME, {cmd: "SET_ACTIVITY", args: {pid: process.pid, activity: wanted.activity},
nonce: crypto.randomUUID()}));
nonce: nonce()}));
};
const drop = () => {
@@ -158,7 +161,7 @@ const set = info => {
if (wanted) {
wanted = null;
if (socket && ready) {
socket.write(frame(OP_FRAME, {cmd: "SET_ACTIVITY", args: {pid: process.pid}, nonce: crypto.randomUUID()}));
socket.write(frame(OP_FRAME, {cmd: "SET_ACTIVITY", args: {pid: process.pid}, nonce: nonce()}));
}
}
return;
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "aj-private-client",
"productName": "Burrow",
"version": "1.3.0",
"version": "1.3.1",
"description": "The client for the Burrow private server",
"main": "boot.js",
"license": "UNLICENSED"