Jiakaaa commited on
Commit
2f5e009
·
verified ·
1 Parent(s): 3be2f5f

Update templates

Browse files
Files changed (1) hide show
  1. templates +46 -0
templates CHANGED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <title>批量登录测试</title>
6
+ <style>
7
+ body { font-family: sans-serif; padding: 1rem; }
8
+ textarea { width: 100%; height: 300px; margin-top: 1rem; }
9
+ </style>
10
+ </head>
11
+ <body>
12
+ <h2>上传 hosts.csv</h2>
13
+ <form id="upload-form" enctype="multipart/form-data">
14
+ <input type="file" name="file" required>
15
+ <button type="submit">上传</button>
16
+ </form>
17
+
18
+ <h3>操作</h3>
19
+ <button onclick="startTest()">开始测试</button>
20
+ <a href="/download" target="_blank">下载结果</a>
21
+
22
+ <h3>进度</h3>
23
+ <textarea id="output" readonly></textarea>
24
+
25
+ <script>
26
+ document.getElementById("upload-form").onsubmit = function (e) {
27
+ e.preventDefault();
28
+ let formData = new FormData(this);
29
+ fetch("/upload", {
30
+ method: "POST",
31
+ body: formData
32
+ }).then(() => alert("上传成功!"));
33
+ };
34
+ function startTest() {
35
+ fetch("/start", { method: "POST" });
36
+ }
37
+ setInterval(() => {
38
+ fetch("/progress")
39
+ .then(res => res.json())
40
+ .then(data => {
41
+ document.getElementById("output").value = data.join("\n");
42
+ });
43
+ }, 2000);
44
+ </script>
45
+ </body>
46
+ </html>