v0.13.0: 前台导航修复(loader 服务函数化防客户端退化)、全站图片占位图+懒加载、favicon、分页圆点、导航 1400px 居中、缺失图片补齐脚本

This commit is contained in:
bigcode
2026-11-04 10:30:16 +08:00
parent 4fba80a216
commit 7fd9e75887
28 changed files with 599 additions and 208 deletions
+4 -1
View File
@@ -31,7 +31,10 @@ export default {
/** # 函数 请求入口:静态文件优先,其余交给 Start handler */
async fetch(req: Request): Promise<Response> {
const url = new URL(req.url);
const f = staticFiles.get(url.pathname);
// 尾斜杠归一化:偶发的 "<file>.jpg/" 形态请求(SPA 预取取回/上游转发)直接按静态
// 文件应答,避免交给 Start handler 后落入路由 catch-all 返回 404
let f = staticFiles.get(url.pathname);
if (!f && url.pathname.endsWith("/")) f = staticFiles.get(url.pathname.replace(/\/+$/, ""));
if (f) {
return new Response(Bun.file(f), {
headers: { "cache-control": "public, max-age=31536000, immutable" },