feat: add web layer (FastAPI + worker)
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
document.getElementById("verify-form").addEventListener("submit", async (e) => {
|
||||
e.preventDefault();
|
||||
const btn = e.target.querySelector("button");
|
||||
btn.disabled = true;
|
||||
btn.textContent = "Submitting...";
|
||||
document.getElementById("status").textContent = "";
|
||||
document.getElementById("result").innerHTML = "";
|
||||
|
||||
const fd = new FormData(e.target);
|
||||
try {
|
||||
const r = await fetch("/verify", { method: "POST", body: fd });
|
||||
const d = await r.json();
|
||||
if (r.ok) {
|
||||
document.getElementById("status").textContent = "Task " + d.task_id + " queued";
|
||||
document.getElementById("result").innerHTML =
|
||||
'<p><a href="/result/' + d.task_id + '">View result →</a></p>';
|
||||
} else {
|
||||
document.getElementById("status").textContent = "Error: " + (d.detail || "unknown");
|
||||
}
|
||||
} catch (err) {
|
||||
document.getElementById("status").textContent = "Upload failed: " + err.message;
|
||||
}
|
||||
btn.disabled = false;
|
||||
btn.textContent = "Verify";
|
||||
});
|
||||
@@ -0,0 +1,11 @@
|
||||
body { font-family: monospace; max-width: 900px; margin: 2rem auto; padding: 0 1rem; color: #333; }
|
||||
h1 { font-size: 1.2rem; }
|
||||
label { display: block; margin: .75rem 0; }
|
||||
input, select { display: block; margin-top: .25rem; }
|
||||
button { margin-top: 1rem; padding: .5rem 1.5rem; cursor: pointer; font-size: 1rem; }
|
||||
#status { margin-top: 1rem; font-weight: bold; }
|
||||
#result { margin-top: 1rem; }
|
||||
pre { background: #f0f0f0; padding: 1rem; border-radius: 4px; }
|
||||
.pass { border-left: 4px solid #4caf50; }
|
||||
.fail { border-left: 4px solid #f44336; }
|
||||
.container a { display: inline-block; margin-top: 1rem; }
|
||||
Reference in New Issue
Block a user