feat(demo): the public demo's module-side locks and seed hook #62
Reference in New Issue
Block a user
No description provided.
Delete Branch "feat/demo-mode"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Step 2 of
docs/website/DEMO_MODE.md§10 (RunicGateway/website#222). Core half: RunicGateway/website#224 (MODULE_API 1.19.0). This PR needs it, soci/core-ref.jsonpins #224's head for now and moves to the sha #224 merges as.Off the demo nothing changes. Every rule below sits behind
ctx.demoMode(newcore.demoModegetter, read in one place:server/demo.js).The locks
demoLocksinmodule.json:PUT/DELETE /admin/rust/servers/:id(§3.3). Core refuses them before the handler.quit,restart,oxide.unload,oxide.reload,rcon.*,fps.limit,server.tickrate.global.stripped ando.read asoxide.. SoGlobal.O.Unload RunicGatewayis caught.rust.command.runandrust.command.reward), teardown commands included.demoRefuses(DM18), so core answers403 DEMO_LOCKED: "quit" is turned off on the demo site.retry: false, before the rig is asked.GET …/files;GET/POST …/filerefused 403;GET …/writes, andGET …/writes/:idrefused.RunicGatewayas a floor (so a catalogue that cannot be read never unlocks it), and also by the catalogue'sself../RunicGateway.jsonis caught. Without that, it would have passed the existing path-shape check and reached the host.SECRET_WORDSreading are redacted in thetextand in the formfields, and markedlocked, so the form shows them read-only;currentfile is redacted too.sidecarBaseUrlis left out of the admin list (hasTokenstays). The form now tolerates its absence, so a save attempt reaches the server lock instead of crashing onundefined.trim().The seed hook (§7.3, DM15)
onDemoSeedwrites fromfixture.modules.rust:servers: upserted, with the token encrypted.links: demo-player's stand-in Steam id. A link is a plain insert by design (D23), so the upsert is spelled out: a link the right owner already holds is left alone, and one held by someone else is moved.The whole section is checked before anything is written.
The release (§7.5, DM12)
release.ymladdsprotocol(read fromPROTOCOL_VERSIONinserver/sidecarClient.js, and failing the release if it is missing) tomodule-rust-<v>.json. The demo's wipe picks the newest release whose protocol equals the bundle's. Core's installer ignores the extra field.Verified
npm test(server): 728 pass, 0 fail. Newtest/demo.test.jshas 19 tests; each lock is checked on the demo and off it.check:imports,check:bundle(the newdemo.js/demoSeed.jsare inci/bundle.json),check:swaggerandcheck:engagementall pass.engagement-triggers.jsonwas regenerated (it embedscoreApi).check:externalsOK.release.yml, run locally:14.DEMO_MODE=true, this branch installed, scratch DB, 13/13 probes passed:seed:demowith a Rust section ran twice (the second run kept the link);quitandglobal.restartare refused at create,say hisaves, and an edit to a teardown ofo.unload RunicGatewayis refused;./RunicGateway.json), and so are a raw save and a credential edit;Docs: RunicGateway/docs PR on
docs/demo-mode-module.🤖 Generated with Claude Code
https://claude.ai/code/session_01E14m6SuuY6i1vASFeGDBeY