BUGFIX: Prevent renaming servers to hacknet. (#1112)

* Add hacknet check to renaming
* Handle manual server purchases
* Handle automated server purchases
* Remove unnecessary parenthesis

fixes #1111
This commit is contained in:
LJ
2024-02-20 19:22:24 -07:00
committed by GitHub
parent ac05135f59
commit 1577467fe1
2 changed files with 12 additions and 0 deletions
+4
View File
@@ -1167,6 +1167,10 @@ export const ns: InternalAPI<NSFull> = {
helpers.log(ctx, () => `Invalid argument: hostname='${hostnameStr}'`);
return "";
}
if (hostnameStr.startsWith("hacknet-node-") || hostnameStr.startsWith("hacknet-server-")) {
helpers.log(ctx, () => `Invalid argument: hostname='${hostnameStr}' is a reserved hostname.`);
return "";
}
if (Player.purchasedServers.length >= getPurchaseServerLimit()) {
helpers.log(