mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-09-30 03:01:21 +02:00
Reporter typed into the Add Spool modal's hex colour input and only the first character stuck - everything after that defaulted to "0" with no way to override except by pasting the full hex. Pre-fix, the #1055 fix aggressively normalized the input to a valid 8-char rgba on every keystroke. After typing the first char the controlled input value snapped to e.g. "A00000", the browser placed the cursor at the end, and the user's next keystroke landed at position 7. The #1055 fix's 7-char branch then truncated that byte away, leaving the form state unchanged - so the user appeared to type nothing. Fix splits the typing-state from the backend-state: - The hex input gets its own `hexDraft` useState holding 0-6 chars freely. Typing one char at a time works naturally because the controlled value matches what the user typed. - `updateField('rgba', ...)` fires only when the draft reaches a complete 6-char RGB (commits as `<6chars>FF`). Below that, the form state stays untouched - no mid-keystroke snap. - On blur, a partial 1-5 char draft is right-padded with `0` and committed. Keeps the #1055 invariant: anything reaching the backend is exactly 8 hex chars matching /^[0-9A-F]{8}$/. - A `useEffect` resyncs the draft when an external action (color picker, swatch click, edit-mode load) changes the canonical hex. - Paste of 7-/8-char strings truncates to the leading RGB. Bambu filaments are opaque; the UI never exposed an alpha affordance, so dropping the (undocumented) paste-with-alpha case is fine.
41 lines
1.8 KiB
HTML
41 lines
1.8 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
|
<!-- L-4: Restrict Referer header to origin-only on cross-origin navigation so
|
|
sensitive tokens in query parameters are not leaked to third-party servers. -->
|
|
<meta name="referrer" content="strict-origin-when-cross-origin" />
|
|
<title>Bambuddy</title>
|
|
|
|
<!-- PWA Meta Tags -->
|
|
<meta name="description" content="Monitor and manage your Bambu Lab 3D printers" />
|
|
<meta name="theme-color" content="#00ae42" />
|
|
<meta name="mobile-web-app-capable" content="yes" />
|
|
<meta name="apple-mobile-web-app-capable" content="yes" />
|
|
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
|
<meta name="apple-mobile-web-app-title" content="Bambuddy" />
|
|
|
|
<!-- Manifest -->
|
|
<link rel="manifest" href="/manifest.json" />
|
|
|
|
<!-- Favicons -->
|
|
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png" />
|
|
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png" />
|
|
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png" />
|
|
|
|
<!-- Splash screens for iOS -->
|
|
<link rel="apple-touch-startup-image" href="/img/android-chrome-512x512.png" />
|
|
<script type="module" crossorigin src="/assets/index-BvnKyMoU.js"></script>
|
|
<link rel="stylesheet" crossorigin href="/assets/index-KYwGxnG9.css">
|
|
</head>
|
|
<body>
|
|
<div id="root"></div>
|
|
|
|
<!-- Service Worker Registration (skip on SpoolBuddy kiosk).
|
|
Kept as an external file so the CSP `script-src 'self'` covers it
|
|
without needing 'unsafe-inline' or per-build hashes. -->
|
|
<script src="/sw-register.js"></script>
|
|
</body>
|
|
</html>
|