feat: 产品视频改后台上传,promotion-media 公开访问;gitignore 大文件;保留原文件名上传

Made-with: Cursor
This commit is contained in:
whm
2026-03-20 17:10:56 +08:00
parent 5067fb6f76
commit 654b683067
20 changed files with 225 additions and 47 deletions

View File

@@ -79,7 +79,7 @@ func main() {
}
r := gin.Default()
r.MaxMultipartMemory = 200 << 20 // 200MB Nginx client_max_body_size 一致,避免上传 413
r.MaxMultipartMemory = 32 << 20 // 大单片先落临时文件;整体体积受 Nginx client_max_body_size 限制
r.Use(middleware.ErrorLogger())
// CORSALLOWED_ORIGINS 为空则允许所有来源;否则仅允许配置的域名)
@@ -215,6 +215,8 @@ func main() {
web.GET("/info", func(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{"message": "web api"})
})
// 推广/产品视频:站点 uploads 下 promotion 目录(无需鉴权,与后台上传到 promotion/… 对应)
web.GET("/sites/:site_id/promotion-media/*filepath", handlers.ServePromotionMedia)
// 可下载资源公开下载(首页等链接指向此路径)
web.GET("/sites/:site_id/assets/:asset_id/download", handlers.DownloadSiteAsset)
}