From 42652eb221804dae0ce9868ad0c26fbe40bbf2e6 Mon Sep 17 00:00:00 2001 From: Fam Zheng Date: Sat, 10 May 2025 21:31:54 +0100 Subject: [PATCH] Drop skip_angle_check --- api/products/views.py | 27 -------------------------- scanner/pages/camwebview/camwebview.js | 3 +-- scanner/upload.js | 1 - web/public/camera-5.0/js/main.js | 2 -- 4 files changed, 1 insertion(+), 32 deletions(-) diff --git a/api/products/views.py b/api/products/views.py index 623db74..2d91ff0 100644 --- a/api/products/views.py +++ b/api/products/views.py @@ -659,19 +659,6 @@ def get_code_from_url(url): class QrVerifyView(BaseView): name = 'qr-verify' - def dot_angle_check(self, batch, filename, messages, angle): - if batch.qr_angle_allowed_error < 0.01: - messages.append(f"batch.qr_angle_allowed_error {batch.qr_angle_allowed_error} < 0.01, not checking angle") - return - if angle is None: - raise Exception("Angle check failed, angle is missing?") - diff = abs(batch.qr_angle - float(angle)) - if diff > batch.qr_angle_allowed_error: - messages.append(f"Angle check failed, captured {angle} but expecting {batch.qr_angle} with error margin {batch.qr_angle_allowed_error}") - raise Exception("Angle check failed") - else: - messages.append(f"Angle check passed, captured {angle} and expecting {batch.qr_angle} with error margin {batch.qr_angle_allowed_error}") - def do_v5_qr_verify(self, img_fn, messages): resp = requests.post( "https://themblem.com/api/v5/qr_verify", @@ -697,7 +684,6 @@ class QrVerifyView(BaseView): filebody, filename = get_image(request) if not filebody: return http400("image is missing") - begin = time.time() tf = tempfile.NamedTemporaryFile(dir="/tmp/", suffix=filename) tf.write(filebody) tf.flush() @@ -712,15 +698,6 @@ class QrVerifyView(BaseView): sd.location = ip_to_region(sd.ip) qrcode = request.data.get("qrcode") - skip_angle_check = request.data.get("skip_angle_check") - # Allow the client to override the threshold. It's not a security - # problem because this API is advisory and doesn't authenticate or - # authorize the client or the product for anything else except to - # display product information. - try: - threshold = float(request.data.get("threshold")) - except: - threshold = None if not qrcode: return http400("qrcode is missing") code = get_code_from_url(qrcode) @@ -736,10 +713,6 @@ class QrVerifyView(BaseView): tenant = product.tenant sd.tenant = tenant sd.batch = sc.batch - if not skip_angle_check: - self.dot_angle_check(sc.batch, tf.name, messages, request.data.get("angle")) - else: - messages.append("skip angle check") if sc.batch.feature_comparison_threshold > 0.01: self.do_v5_qr_verify(tf.name, messages) else: diff --git a/scanner/pages/camwebview/camwebview.js b/scanner/pages/camwebview/camwebview.js index 7295293..07a28bf 100644 --- a/scanner/pages/camwebview/camwebview.js +++ b/scanner/pages/camwebview/camwebview.js @@ -15,8 +15,7 @@ function make_query(zoom, ai_chat_mode) { ret += "&nick_name=" + encodeURIComponent(ui.nickName || ""); ret += "&tenant=" + (gd.tenant_id || ""); ret += "&tk=" + Date.now(); - ret += "&skip_angle_check=1"; - if (ai_chat_mode) { + if (ai_chat_mode) / ret += "&ai_chat_mode=" + ai_chat_mode; } console.log(ret); diff --git a/scanner/upload.js b/scanner/upload.js index c326b3a..48a2b82 100644 --- a/scanner/upload.js +++ b/scanner/upload.js @@ -45,7 +45,6 @@ function do_upload(image_data_url, success, fail, log) { phonemodel: gd.phone_model, image_data_url, use_roi_verify: 1, - skip_angle_check: 1, log, }; var ci = gd.caller_info; diff --git a/web/public/camera-5.0/js/main.js b/web/public/camera-5.0/js/main.js index 69059b7..974ab7a 100644 --- a/web/public/camera-5.0/js/main.js +++ b/web/public/camera-5.0/js/main.js @@ -246,7 +246,6 @@ async function submit_image(qrcode, angle, image_data_url) { var nick_name = get_query("nick_name"); var realip = get_query("realip"); var phonemodel = get_query("phonemodel"); - var skip_angle_check = get_query("skip_angle_check"); var data = { emblem_id, nick_name, @@ -255,7 +254,6 @@ async function submit_image(qrcode, angle, image_data_url) { angle, phonemodel, image_data_url, - skip_angle_check, log: debug_logs.join("\n"), }; var r = await fetch("https://themblem.com/api/v1/qr-verify/", {