fix stringify

This commit is contained in:
jusax23 2023-04-01 11:19:30 +02:00
parent acb6fe2c4b
commit f18ce23cf9
Signed by: jusax23
GPG key ID: 499E2AA870C1CD41
2 changed files with 3 additions and 3 deletions

View file

@ -75,7 +75,7 @@ var Methods: ([string, (req: Request, res: Response) => Promise<void>])[] = [
} else { } else {
out += ` \x1b[1m\x1b[41m[${name}]: \x1b[0m\x1b[41m`; 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"; out += "\x1b[0m";
return out; return out;
}).join("\x1b[0m\n")); }).join("\x1b[0m\n"));

View file

@ -117,7 +117,7 @@ export class wsClient {
try { try {
await func(this.client, json.data, (state, data = "") => { await func(this.client, json.data, (state, data = "") => {
debug("WebSocket", "send:", 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; send = true;
}); });
} catch (e) { } catch (e) {