Based on QuantumNous/new-api v1.0.0-rc.36 (shallow history squashed). - CNY quota display mode: RMB-denominated top-up and crediting across Epay/Waffo channels - New CheckinButton in both authenticated and public headers (Turnstile supported) - New /subscribe page with public plan snapshot, Alipay/balance payment, auto group upgrade/reset - New /docs 12-section beginner guide with anchor navigation - New home PromoBanner linking to /docs; i18n synced (en/zh/zh-TW/fr/ja/ru/vi) - README: document custom features, live demo https://ai.88531.cn
23 lines
522 B
Go
23 lines
522 B
Go
package middleware
|
|
|
|
import (
|
|
"github.com/QuantumNous/new-api/common"
|
|
"github.com/QuantumNous/new-api/service"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
// BodyStorageCleanup 请求体存储清理中间件
|
|
// 在请求处理完成后自动清理磁盘/内存缓存
|
|
func BodyStorageCleanup() gin.HandlerFunc {
|
|
return func(c *gin.Context) {
|
|
defer func() {
|
|
// 请求结束后清理存储
|
|
common.CleanupBodyStorage(c)
|
|
|
|
// 清理文件缓存(URL 下载的文件等)
|
|
service.CleanupFileSources(c)
|
|
}()
|
|
c.Next()
|
|
}
|
|
}
|