fix: add HTTPS requirement check for camera access

- Check for secure context before attempting camera access
- Show clear user feedback when HTTPS is required
- Prevent confusing permission errors on insecure connections
This commit is contained in:
Matthew Raymer
2025-04-24 09:55:01 +00:00
parent b4101b7d65
commit 656871660c
2 changed files with 19 additions and 0 deletions

View File

@@ -41,6 +41,12 @@ export class WebDialogQRScanner implements QRScannerService {
}
async isSupported(): Promise<boolean> {
// Check for secure context first
if (!window.isSecureContext) {
logger.warn("Camera access requires HTTPS (secure context)");
return false;
}
// Then check for camera API support
return !!(navigator.mediaDevices && navigator.mediaDevices.getUserMedia);
}