From 2b70e106244aa0e5cc70c826dd26f8088f90f24a Mon Sep 17 00:00:00 2001 From: Burrowdev Date: Sun, 18 Oct 2026 19:43:24 +0300 Subject: [PATCH] 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. --- app/discord.js | 7 +++++-- app/package.json | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/discord.js b/app/discord.js index 5a7abff..1118f8e 100644 --- a/app/discord.js +++ b/app/discord.js @@ -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; diff --git a/app/package.json b/app/package.json index 8f94ce3..9693381 100644 --- a/app/package.json +++ b/app/package.json @@ -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"