Drop skip_angle_check

This commit is contained in:
Fam Zheng 2025-05-10 21:31:54 +01:00
parent bba9548c1c
commit 42652eb221
4 changed files with 1 additions and 32 deletions

View File

@ -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:

View File

@ -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);

View File

@ -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;

View File

@ -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/", {