Always write a whitelist on server start

This commit is contained in:
Cooldude2606 committed 2026-03-08 18:51:45 +00:00
1 parent 101886e522
commit 5b5b2c28f7
2 files changed
+41 -1

No files matched your search

+11
View File
@@ -866,6 +866,17 @@ end`.replace(/\r?\n/g, " ");
this.server.writePath("server-whitelist.json"),
JSON.stringify([...this._host.whitelist], null, "\t")
);
} else {
// Always create the whitelist even if unused
// This allows it to be watched for changes without a server restart
try {
// wx will throw an error if the file already exists to prevent overwrite
await fs.writeFile(this.server.writePath("server-whitelist.json"), "\n[]\n", { flag: "wx" });
} catch (err: any) {
if (err.code !== "EEXIST") {
throw err;
}
}
}
await this.syncMods();