mirror of
https://github.com/shuaiplus/nodewarden.git
synced 2026-08-04 22:40:11 +00:00
fix: decode uploaded TOTP QR images when BarcodeDetector is unavailable
The TOTP QR reader relied solely on window.BarcodeDetector. On desktop Chrome/Edge (Windows/Linux) that interface exists but has no working backend, so detect() returns an empty array: uploading a valid QR image fell through to "no QR code found" and the camera path bailed to "unsupported" with an empty preview. Add a dependency-free jsQR canvas fallback. decodeTotpQrImage now tries BarcodeDetector first when present, then decodes the image via jsQR before reporting not-found. The camera reader no longer hard-returns "unsupported" when only BarcodeDetector is missing: it starts the camera whenever getUserMedia is available and decodes frames with jsQR, which also lets the preview render. Fixes #276
This commit is contained in:
@@ -67,6 +67,7 @@
|
||||
"@tanstack/react-query": "^5.101.2",
|
||||
"@zip.js/zip.js": "^2.8.26",
|
||||
"fflate": "^0.8.3",
|
||||
"jsqr": "1.4.0",
|
||||
"lucide-preact": "^1.22.0",
|
||||
"preact": "^10.29.3",
|
||||
"qrcode-generator": "^2.0.4",
|
||||
|
||||
Reference in New Issue
Block a user