feat: add web layer (FastAPI + worker)

This commit is contained in:
hangshuo652
2026-05-24 12:52:20 +08:00
parent 818e81269c
commit 331b38eac1
8 changed files with 218 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html><head><meta charset="utf-8"><title>Result - {{ task.id }}</title>
<link rel="stylesheet" href="/static/style.css"></head><body>
<div class="container">
<h1>Verification Result</h1>
{% if task.status == "done" and task.result %}
<pre class="pass">Status: {{ task.result.status }}
Program: {{ task.result.program }}
Matched: {{ task.result.matched }} | Mismatched: {{ task.result.mismatched }}
Runner: {{ task.result.runner }} | Duration: {{ task.result.duration }}s</pre>
{% elif task.status == "error" %}
<pre class="fail">{{ task.result }}</pre>
{% else %}
<div id="poll-status">Status: {{ task.status }} — polling...</div>
<script>
const id = "{{ task.id }}";
setInterval(async () => {
const r = await fetch("/status/" + id);
const d = await r.json();
document.getElementById("poll-status").textContent = "Status: " + d.status;
if (d.status === "done" || d.status === "error") location.reload();
}, 3000);
</script>
{% endif %}
<a href="/">← New verification</a>
</div>
</body></html>