diff --git a/web/public/camera-5.1/js/main.js b/web/public/camera-5.1/js/main.js index c439c34..0949562 100644 --- a/web/public/camera-5.1/js/main.js +++ b/web/public/camera-5.1/js/main.js @@ -192,15 +192,19 @@ function do_handle_frame() { async function start_check_auto_torch(qrcode) { should_check_auto_torch = false; - var r = await fetch("https://themblem.com/api/v1/check-auto-torch/?qrcode=" + encodeURIComponent(qrcode), { - method: "GET", - }); - var d = await r.json(); - debug_log(JSON.stringify(d)); - if (d.enable_auto_torch && !torch) { - toggle_torch(); + try { + var r = await fetch("https://themblem.com/api/v1/check-auto-torch/?qrcode=" + encodeURIComponent(qrcode), { + method: "GET", + }); + var d = await r.json(); + debug_log(JSON.stringify(d)); + if (d.enable_auto_torch && !torch) { + toggle_torch(); + } + camera_sensitivity = d.camera_sensitivity || 1.0; + } catch (e) { + debug_log("start_check_auto_torch exception: " + e); } - camera_sensitivity = d.camera_sensitivity || 1.0; setTimeout(() => { done_checking_auto_torch = true; }, 200);