fix(export): give the keepsake viewer the two-phase preflight it was meant to get

The two-phase preflight from eb0e405 landed in ONE place and was spliced inside
the other. `run_zip_export` ended up containing both blocks nested, so the
Gallery path pruned "Memories" archives that were not its to reclaim, while
`run_html_export` silently kept the single-phase form.

That left the exact deadlock the two-phase preflight exists to break, still
open on half the product. At a gallery size where a rebuild needs the previous
generation's bytes: the ZIP prunes its own superseded archive and rebuilds, and
the HTML preflight fails against a Memories archive still on disk. The prune
that would free it runs only after a success that can never happen, and any
epoch bump — a guest deleting one photo — retires the current viewer
immediately. Permanently stuck, unreachable from any handler, discovered at the
end of the night with nobody there.

Both halves now call one `ensure_export_space_reclaiming`, keyed on the
caller's OWN prefix, so they cannot drift again.

Three smaller things found in the same pass:

- The boot-failure panel hardcoded light-mode colours, and its heading set none
  at all — the UA default black on the `#100f0f` dark background. On the one
  screen whose entire job is to be readable, and in the failure mode where the
  app's own stylesheet may be what did not load. Moved to classes in the inline
  <style> so the `html.dark` variants apply.

- `.env.example` assigned RUST_LOG twice, 120 lines apart. Compose takes the
  last one, so an operator raising the level mid-event to chase a problem would
  have changed nothing, silently.

- The comment justifying `detail = ?message` in error.rs still claimed
  `validate_display_name` allows newlines. It rejects control characters now —
  but that is one input against every 4xx message in the app, so the escaping
  is what makes the guarantee general. Said so.

151/151 backend, 58/58 vitest, clippy clean, svelte-check 0 errors, both
builds, caddy validate.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
MechaCat02
2026-08-08 22:48:22 +02:00
parent 5b705317ef
commit 253878e027
4 changed files with 108 additions and 61 deletions

View File

@@ -64,11 +64,18 @@
setTimeout(function () {
var boot = document.getElementById('app-boot');
if (!boot) return; // app mounted — nothing to do
// Classes, not inline styles. The panel must stay legible in dark mode, and
// the only stylesheet guaranteed to be present here is the inline <style>
// below — a boot failure includes the case where the app's own CSS 404'd
// too, so nothing may set a text colour. Inline styles cannot express the
// `html.dark` variant, and the first version's un-coloured heading rendered
// as the UA default black on the #100f0f dark background: invisible, on the
// one screen whose entire job is to be readable.
boot.innerHTML =
'<div style="max-width:20rem;text-align:center">' +
'<p style="font-family:Georgia,serif;font-size:1.125rem;font-weight:600;margin:0 0 .5rem">Die App konnte nicht geladen werden</p>' +
'<p style="margin:0 0 1.25rem;color:#545350;line-height:1.5">Bitte prüf deine Verbindung und lade die Seite neu.</p>' +
'<button id="app-boot-reload" style="font:inherit;font-weight:600;cursor:pointer;border:0;border-radius:.5rem;padding:.625rem 1.25rem;background:#8a6a2b;color:#fff">Neu laden</button>' +
'<div class="app-boot__fail">' +
'<p class="app-boot__fail-title">Die App konnte nicht geladen werden</p>' +
'<p class="app-boot__fail-text">Bitte prüf deine Verbindung und lade die Seite neu.</p>' +
'<button id="app-boot-reload" class="app-boot__fail-btn">Neu laden</button>' +
'</div>';
var btn = document.getElementById('app-boot-reload');
if (btn) btn.addEventListener('click', function () { location.reload(); });
@@ -138,6 +145,46 @@
transform: rotate(360deg);
}
}
/* Boot-failure panel, swapped in by the backstop timer above. Every colour is
stated explicitly in both themes: when this renders, the app's own stylesheet
may well be one of the things that failed to load. */
.app-boot__fail {
max-width: 20rem;
text-align: center;
font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
.app-boot__fail-title {
margin: 0 0 0.5rem;
font-family: Georgia, 'Times New Roman', serif;
font-size: 1.125rem;
font-weight: 600;
color: #1c1b1a;
}
.app-boot__fail-text {
margin: 0 0 1.25rem;
line-height: 1.5;
color: #545350;
}
html.dark .app-boot__fail-title {
color: #f2f0ed;
}
html.dark .app-boot__fail-text {
color: #a6a4a1;
}
.app-boot__fail-btn {
font: inherit;
font-weight: 600;
cursor: pointer;
border: 0;
border-radius: 0.5rem;
padding: 0.625rem 1.25rem;
background: #8a6a2b;
color: #fff;
}
html.dark .app-boot__fail-btn {
background: #c6a24a;
color: #100f0f;
}
/* Sits above #app-boot, which is `position: fixed` and would otherwise cover it. */
.app-boot__noscript {
position: fixed;