fix rewards and bypass ip limits
build container / build (push) Failing after 2s

This commit is contained in:
2026-11-02 02:49:23 +01:00
parent 3de09009d6
commit d589dd4d64
6 changed files with 344 additions and 10 deletions
+47
View File
@@ -0,0 +1,47 @@
#!/usr/bin/env node
// Local patch: make the platform auth-id requirement for rewards optional.
//
// Adventure Land's tutorial (ureward) and class (creward) handlers require
// player.verified and player.auth_id. auth_id is only populated for Steam/MAS
// accounts; plain web accounts have an empty pid/auth_id and therefore can
// never claim these rewards. On a self-hosted server that requirement is
// usually unnecessary.
//
// options.tutorial_reward_requires_auth_id:
// true/absent -> upstream behaviour (auth_id required)
// false -> verified web accounts may claim the rewards too
//
// The patch is idempotent and fails loudly if the two anchors are gone.
const fs = require("node:fs");
const path = require("node:path");
const app = path.resolve(process.argv[2] || "/app");
const file = path.join(app, "node", "server.js");
let source = fs.readFileSync(file, "utf8");
const from = `\t\t\tif (!player.verified || !player.auth_id) {`;
const to = `\t\t\tif (
\t\t\t\t!player.verified ||
\t\t\t\t((typeof options === "undefined" || options.tutorial_reward_requires_auth_id !== false) && !player.auth_id)
\t\t\t) {`;
function fail(message) {
console.error("patch-tutorial-reward-auth: " + message);
process.exit(1);
}
const unpatched = source.split(from).length - 1;
const patched = source.split(to).length - 1;
if (unpatched === 2) {
source = source.split(from).join(to);
console.log("patch-tutorial-reward-auth: patched ureward and creward gates");
} else if (unpatched === 0 && patched === 2) {
console.log("patch-tutorial-reward-auth: already patched");
} else {
fail("expected 2 reward gates, found " + unpatched + " unpatched and " + patched + " patched; refusing partial patch");
}
fs.writeFileSync(file, source);
console.log("patch-tutorial-reward-auth: wrote " + file);