feat: batch delete
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user