From f18ce23cf92d75c81b50916e95272a238113cdd4 Mon Sep 17 00:00:00 2001 From: jusax23 Date: Sat, 1 Apr 2023 11:19:30 +0200 Subject: [PATCH] fix stringify --- src/api/get.ts | 2 +- src/api/ws.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/api/get.ts b/src/api/get.ts index 197c076..f0c2abc 100644 --- a/src/api/get.ts +++ b/src/api/get.ts @@ -75,7 +75,7 @@ var Methods: ([string, (req: Request, res: Response) => Promise])[] = [ } else { out += ` \x1b[1m\x1b[41m[${name}]: \x1b[0m\x1b[41m`; } - out += args.map(a => `${typeof a == 'object' ? JSON.stringify(a) : a}`).join(" "); + out += args.map(a => `${typeof a == 'object' ? JSON.stringify(a, (k, v) => typeof v == "bigint" ? Number(v) : v) : a}`).join(" "); out += "\x1b[0m"; return out; }).join("\x1b[0m\n")); diff --git a/src/api/ws.ts b/src/api/ws.ts index 88881f3..55c59a6 100644 --- a/src/api/ws.ts +++ b/src/api/ws.ts @@ -48,7 +48,7 @@ export class wsClient { debug("WebSocket", "send:", "error", "closed"); return; } - if(!bruteforcecheck(this.client.ip)){ + if (!bruteforcecheck(this.client.ip)) { socket.send(JSON.stringify({ id: json.id, state: "error", @@ -117,7 +117,7 @@ export class wsClient { try { await func(this.client, json.data, (state, data = "") => { debug("WebSocket", "send:", state, data); - socket.send(JSON.stringify({ id: json.id, state, data })); + socket.send(JSON.stringify({ id: json.id, state, data }, (k, v) => typeof v == "bigint" ? Number(v) : v)); send = true; }); } catch (e) {