This commit is contained in:
2025-10-21 15:19:56 +08:00
parent f9ec18abd1
commit e617c6fa57

View File

@@ -79,14 +79,8 @@ app.get("/api/projects", async (c) => {
} }
}) })
// 代理路由:将 /projects/:slug 重定向到 /api/projects/:slug // 项目访问路由 - 直接处理项目内容
app.get("/projects/:slug", async (c) => { app.get("/projects/:slug", async (c) => {
const slug = c.req.param("slug")
return c.redirect(`/api/projects/${slug}`)
})
// 获取项目内容(托管)
app.get("/api/projects/:slug", async (c) => {
try { try {
const slug = c.req.param("slug") const slug = c.req.param("slug")
const project = await findProjectBySlug(slug) const project = await findProjectBySlug(slug)
@@ -121,6 +115,7 @@ app.get("/api/projects/:slug", async (c) => {
} }
}) })
// 项目上传API // 项目上传API
app.post("/api/upload", async (c) => { app.post("/api/upload", async (c) => {
try { try {