Merge pull request #1712 from albanbruder/fix-dump-serialization

Fix circular serialization in pusher dump endpoint
This commit is contained in:
David Négrier 2022-01-09 22:39:38 +01:00 committed by GitHub
commit e298a35efb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -19,11 +19,13 @@ export class DebugController {
return res.writeStatus("401 Unauthorized").end("Invalid token sent!");
}
const worlds = Object.fromEntries(socketManager.getWorlds().entries());
return res
.writeStatus("200 OK")
.writeHeader("Content-Type", "application/json")
.end(
stringify(socketManager.getWorlds(), (key: unknown, value: unknown) => {
stringify(worlds, (key: unknown, value: unknown) => {
if (value instanceof Map) {
const obj: any = {}; // eslint-disable-line @typescript-eslint/no-explicit-any
for (const [mapKey, mapValue] of value.entries()) {