carlos / platform Public

console: claim page nits from review (one submit guard, bfcache, abort)

One page-wide submit guard so the code and different-address forms
can't both go inside the working window; a page restored from the
back/forward cache gets its buttons back; a reloaded aborted claim
shows the failure heading, as the live page does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev e5bff4fae5469abd2187158f5dd316219ebaced9 parent bddc8b2
2 files changed, +17 −2
  • internal/console/static/demo_claim.js +16 −1
  • internal/console/templates/demo_claim.html +1 −1

CI passed — run details

Intent

Human

<paseo-system version="1" kind="agent-message" source-agent-id="d99e59f2-a713-4207-8f01-81ad52ed095b" message-id="554b811b-b536-4fba-b1e3-d248dcf3c1f3" source-agent-title="Release v0.34.15 dev console-only (demo CSP)"> canary done: dev canary on v0.34.22 (main 16629f1a, S22 linux-arm64 330d53b7683cdc33799ce06a3ad098a041371abe369a644029f870b658f08bf5). demo box-1 restarted 21:11:21Z, sophie 21:15:22Z; both NRestarts 0, no ERROR/REFUSING/LEASE HELD, host.env and CARLOS_DEMO_CLAIM unchanged. Claim check: no open demo_claim_ops row at any of 35 readings (polled ~8 s apart), including the readings just before each box restart. New banner CSS live on demo hosts (one-line, no 16rem padding); moved.css served. Stable stays v0.34.19, console untouched (ha_pools unchanged), HA group untouched. Published Latest + tap #112. apt v0.34.22-1 HELD until 8a3d302 says &apos;apt ok&apos;. FLAGSHIP: NOT ROLLED. </paseo-system>

diff --git a/internal/console/static/demo_claim.js b/internal/console/static/demo_claim.js
index 5a2392cb1..465e589da 100644
--- a/internal/console/static/demo_claim.js
+++ b/internal/console/static/demo_claim.js
@@ -21,13 +21,28 @@
claim.dataset.state = "missing";
opening.hidden = false;
}
+ // One guard for the page: two forms (the code and a different address)
+ // must not both go inside the working window.
+ let submitted = false;
+ const working = [];
+ addEventListener("pageshow", event => {
+ if (!event.persisted) return;
+ submitted = false;
+ for (const [button, label] of working) {
+ button.disabled = false;
+ button.classList.remove("is-working");
+ button.removeAttribute("aria-busy");
+ button.textContent = label;
+ }
+ working.length = 0;
+ });
for (const form of document.querySelectorAll("#claim form")) {
- let submitted = false;
form.addEventListener("submit", async event => {
event.preventDefault();
if (submitted) return;
submitted = true;
for (const button of form.querySelectorAll('button[type="submit"]')) {
+ working.push([button, button.textContent]);
button.disabled = true;
button.classList.add("is-working");
button.setAttribute("aria-busy", "true");
diff --git a/internal/console/templates/demo_claim.html b/internal/console/templates/demo_claim.html
index 8e29def90..9bd379816 100644
--- a/internal/console/templates/demo_claim.html
+++ b/internal/console/templates/demo_claim.html
@@ -145,7 +145,7 @@
<span class="claim-life"><svg class="claim-clock" viewBox="0 0 16 16" aria-hidden="true"><circle cx="8" cy="8" r="6"/><path class="claim-hands" d="M8 4v4l3 2"/><path class="claim-tick" d="M4 8l3 3 5-6"/></svg><time class="claim-old" datetime="{{.EndTime}}" title="{{.EndTime}}">{{.TimeLeft}}</time><span class="claim-new">{{.Copy.done}}</span></span></div>
<span class="claim-burst" aria-hidden="true"><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i></span>
</div>{{end}}
-<h1 id="claim-heading">{{if eq .State "claimed"}}{{.Copy.completeHeading}}{{else if eq .State "stopping"}}{{.Copy.failureHeading}}{{else if .EmailPending}}{{.Copy.codeHeading}}{{else if and .Address (gt .Eligible 1)}}{{.Copy.accountsHeading}}{{else if eq .State "proof"}}{{.Copy.heading}}{{else}}{{.Copy.title}}{{end}}</h1>
+<h1 id="claim-heading">{{if eq .State "claimed"}}{{.Copy.completeHeading}}{{else if or (eq .State "stopping") (eq .State "aborted")}}{{.Copy.failureHeading}}{{else if .EmailPending}}{{.Copy.codeHeading}}{{else if and .Address (gt .Eligible 1)}}{{.Copy.accountsHeading}}{{else if eq .State "proof"}}{{.Copy.heading}}{{else}}{{.Copy.title}}{{end}}</h1>
{{if .Error}}<p role="alert">{{.Error}}</p><p><a href="/demo/claim">{{.Copy.back}}</a></p>{{end}}
{{if eq .State "no_accounts"}}<p>{{.Copy.identity}} <strong>{{.Address}}</strong></p><p>{{.Copy.noAccounts}}</p>
<fieldset class="claim-unavailable"><legend>{{.Copy.accountsLabel}}</legend>{{range .Accounts}}{{template "claim_card" .}}{{end}}</fieldset>{{end}}