From ad6303ff87c32bbf79e521782014aec8be647aa1 Mon Sep 17 00:00:00 2001 From: Azalea <22280294+hykilpikonna@users.noreply.github.com> Date: Sun, 23 Mar 2025 00:32:36 -0400 Subject: [PATCH] [+] Input validation --- web/src/App.svelte | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/web/src/App.svelte b/web/src/App.svelte index 17377e7..52328ac 100644 --- a/web/src/App.svelte +++ b/web/src/App.svelte @@ -8,6 +8,7 @@ let [error, loading, done, edit] = ["", false, false, false] function scan(uid: string) { + if (loading) return loading = true post('/scan', { uid }) .then(() => done = true) @@ -24,7 +25,7 @@ // Card must match either \d{20} or [0-9A-Fa-f]{16} if (!/^\d{20}$/.test(inputCard) && !/^[0-9A-Fa-f]{16}$/.test(inputCard)) - return error = "Invalid card ID" + return error = "卡号格式不对" cards.push({ id: inputCard, name: inputName }) cards = cards @@ -44,12 +45,12 @@
点击一个卡就可以刷了,没有卡的话请先添加卡片。如果不知道卡号的话可以去 NFC Tools 扫