feat: batch delete

This commit is contained in:
tao.chen
2026-08-28 10:54:08 +08:00
parent a897a08534
commit 51f1fe96bf
11 changed files with 408 additions and 184 deletions
+13 -3
View File
@@ -4,6 +4,7 @@ import (
"flag"
"log"
"net/http"
"strings"
"time"
"github.com/gin-gonic/gin"
@@ -38,19 +39,28 @@ func main() {
}
initQuota()
gin.SetMode(gin.ReleaseMode)
r := gin.New()
r.Use(gin.Logger(), gin.Recovery(), auditT0())
// 嵌入式首页
// 嵌入式首页 (HTML 骨架, CSS/JS 经 /static 引用)
r.GET("/", func(c *gin.Context) {
c.Data(http.StatusOK, "text/html; charset=utf-8", pageHTML)
c.Data(http.StatusOK, "text/html; charset=utf-8", indexTpl)
})
// 静态资源 (CSS/JS): no-cache 防止二进制升级后浏览器使用旧缓存 JS
r.Use(func(c *gin.Context) {
if strings.HasPrefix(c.Request.URL.Path, "/static") {
c.Header("Cache-Control", "no-cache")
}
c.Next()
})
r.StaticFS("/static", http.FS(staticFS))
// 业务路由
r.POST("/upload", uploadHandler)
r.GET("/download/:filename", downloadHandler)
r.POST("/download-zip", batchDownloadHandler)
r.POST("/files-delete", batchDeleteHandler)
r.DELETE("/files/:filename", deleteHandler)
r.GET("/files", listHandler)