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 87438e7b6b
commit c6c49260ef
2 changed files with 19 additions and 0 deletions

View File

@@ -214,6 +214,19 @@ export default class ContactQRScanShow extends Vue {
const scanner = QRScannerFactory.getInstance();
// Check if scanning is supported first
if (!(await scanner.isSupported())) {
this.error = "Camera access requires HTTPS. Please use a secure connection.";
this.isScanning = false;
this.$notify({
group: "alert",
type: "warning",
title: "HTTPS Required",
text: "Camera access requires a secure (HTTPS) connection"
}, 5000);
return;
}
// Check permissions first
if (!(await scanner.checkPermissions())) {
const granted = await scanner.requestPermissions();