diff --git a/resources/fixture/components.html b/resources/fixture/components.html new file mode 100644 index 0000000..41c25b0 --- /dev/null +++ b/resources/fixture/components.html @@ -0,0 +1,44 @@ + + +网页元素演练场 + + +

网页元素演练场

+
+

基础表单

+

+

+

+ + +

+ + +
等待提交…
+
+
+

属性测试

+
属性目标元素

+ +
+
悬停我变色
+
+
页底区域(滚动测试目标)
+ \ No newline at end of file diff --git a/src/main/fixture/server.ts b/src/main/fixture/server.ts index 893a66b..76bb5a6 100644 --- a/src/main/fixture/server.ts +++ b/src/main/fixture/server.ts @@ -28,6 +28,13 @@ export async function startFixtureServer(preferredPort = 17863): Promise return; } if (url.pathname !== "/" && url.pathname !== "/index.html") { + const safe = path.basename(url.pathname); + const file = path.join(root, safe); + if (/\.(html|css|js|png|jpg|svg)$/i.test(safe) && fs.existsSync(file)) { + response.writeHead(200, { "Content-Type": safe.endsWith(".html") ? "text/html; charset=utf-8" : "application/octet-stream", "Cache-Control": "no-store" }); + fs.createReadStream(file).pipe(response); + return; + } response.writeHead(404).end("Not found"); return; }