mirror of
https://github.com/Matysh/houseplan-card
synced 2026-09-29 03:09:36 +00:00
A picked raster is now classified from its HEADER BYTES ONLY before anything heavy happens: src/backdrop-probe.ts parses PNG IHDR (+colour type/tRNS for alpha), JPEG SOF and WebP VP8/VP8L/VP8X at fixed offsets, never using a file field as an allocation size; hostile or truncated headers collapse to 'unknown', which warns without numbers instead of passing silently. The thresholds live in that module as the single calibration point (WARN_DECODED_BYTES 128 MiB ≈ 32 MP, HARD_DIMENSION 16384 — the browser canvas cap, DOWNSCALE_TARGET_PX 4096), derived from the desktop-Chromium matrix now committed as demo/benchmark_backdrop_decode.mjs with a conservative tablet margin documented in the spec. The shared pick flow (src/backdrop-pick.ts) feeds BOTH lazy runtimes — the editor space dialog and the onboarding first-space dialog — so the guard cannot drift between them, and nothing of it enters the eager View graph. Warn shows the real numbers and three actions; the reduced copy decodes EXIF-aware, keeps aspect and alpha (PNG stays PNG, opaque becomes JPEG q0.9) and flows through the ordinary planFile → upload path. Hard has two phases with one outcome: beyond 16384 px only Cancel; a failed or timed-out (10 s) reduce closes with a toast, clean staging and NO silent fallback to the original the user just declined. SVG never reaches the probe. The safe path swaps the manual byte-loop base64 for FileReader — half the JS-heap peak on every upload, byte-identical output (parity asserted in the smoke). Proofs: header-table units incl. a fuzz set of hostile headers and ±1 threshold bounds; smoke_backdrop_guard on the real bundle — zero decode calls before the choice, byte parity of keep-original, a real 6200 px reduce to 4096 for both alpha and opaque branches, cancel-only hard dialog, both phase-2 failures (reject and hang under the test-only timeout override), re-pick after refusal, SVG bypass; four registry mutants (probe-always-safe, alpha-dropped, hard-demoted, phase-2 silent fallback). Spec anchor corrected alongside: the server plan limit is 8 MB (MAX_PLAN_BYTES), attachments are the 50 MB path — an 8 MB JPEG is easily 80-160 MP decoded, so the client-side guard stays the primary defence. Issue: #39 User-Visible: yes
50 lines
2.4 KiB
JSON
50 lines
2.4 KiB
JSON
{
|
|
"extends": "./tsconfig.json",
|
|
"compilerOptions": {
|
|
"module": "esnext",
|
|
"outDir": "test-build",
|
|
"noEmit": false,
|
|
"declaration": false,
|
|
"resolveJsonModule": true,
|
|
"incremental": true,
|
|
"tsBuildInfoFile": "test-build/.tsbuildinfo"
|
|
},
|
|
"include": [
|
|
"src/color.ts", "src/styles.ts", "src/styles/*.styles.ts", "src/logic.ts", "src/i18n.ts", "src/i18n/registry.ts", "src/i18n/language-runtime.ts", "src/glow-blend.ts", "src/grid-scale.ts", "src/device-visual.ts", "src/device-pulse.ts", "src/device-presentation.ts", "src/device-marker-geometry.ts",
|
|
"src/device-face.ts", "src/device-toggle.ts", "src/marker-toggle-entity.ts", "src/activity-runtime.ts",
|
|
"src/ha-binding-status.ts",
|
|
"src/integration-provider.ts", "src/vacuum.ts",
|
|
"src/sun.ts",
|
|
"src/light-visibility.ts",
|
|
"src/resize.ts", "src/resize-labels.ts", "src/resize-controller.ts", "src/wall-record-preservation.ts",
|
|
"src/rules.ts",
|
|
"src/devices.ts", "src/device-inbox.ts",
|
|
"src/virtual-light-state.ts",
|
|
"src/backdrop-probe.ts",
|
|
"src/types.ts",
|
|
"src/space-geometry.ts", "src/junction-limits.ts",
|
|
"src/space-order.ts", "src/card-editor-validation.ts",
|
|
"src/signing.ts", "src/initial-load.ts", "src/space-model-selection.ts", "src/space-dialog.ts",
|
|
"src/visual-continuity.ts", "src/mode-transition.ts", "src/editor-runtime-loader.ts", "src/pointer-modality.ts",
|
|
"src/render-device-snapshot.ts",
|
|
"src/command-stack.ts",
|
|
"src/coordinate-canonicalization.ts",
|
|
"src/serialized-write-queue.ts",
|
|
"src/align-grid.ts",
|
|
"src/plan-optimizer.ts", "src/space-reference-repair.ts", "src/space-deletion.ts",
|
|
"src/plan-geometry-preflight.ts",
|
|
"src/furniture.ts",
|
|
"src/floating-surface.ts", "src/floating-surface-controller.ts", "src/help-behavior.ts",
|
|
"src/hp-help.ts", "src/hp-dialog.ts", "src/hp-color-opacity.ts",
|
|
"src/opening-placement.ts", "src/opening-dimensions.ts", "src/partition-openings.ts", "src/plan-snap-overlay.ts", "src/wall-face-graph.ts", "src/wall-face-repair.ts", "src/room-deletion.ts", "src/render/opening-symbol.ts",
|
|
"src/wall-thickness.ts",
|
|
"src/wall-segment-model.ts",
|
|
"src/wall-merge.ts",
|
|
"src/physical-geometry.ts",
|
|
"src/labs.ts", "src/iso-projection.ts", "src/iso-walls.ts", "src/iso-openings.ts",
|
|
"src/open-spans.ts",
|
|
"src/zero-walls.ts",
|
|
"src/editors/decor/geometry.ts"
|
|
]
|
|
}
|