build: 优化 Dockerfile 构建缓存并移除 API 解密中间件调试日志
Build docker and publish / prepare (20.15.1) (push) Successful in 12s
Build docker and publish / build (map[dockerfile:deploy/Dockerfile.node image_name:ppanel-node name:node]) (push) Successful in 1m30s
Build docker and publish / build (map[dockerfile:deploy/Dockerfile.rpc-core image_name:ppanel-rpc-core name:rpc-core]) (push) Successful in 1m55s
Build docker and publish / notify (push) Successful in 2s
Build docker and publish / build (map[dockerfile:deploy/Dockerfile.admin image_name:ppanel-admin name:admin]) (push) Successful in 4m13s
Build docker and publish / build (map[dockerfile:deploy/Dockerfile.api image_name:ppanel-api name:api]) (push) Successful in 5m30s
Build docker and publish / build (map[dockerfile:deploy/Dockerfile.scheduler image_name:ppanel-scheduler name:scheduler]) (push) Successful in 1m36s
Build docker and publish / deploy (push) Successful in 44s
Build docker and publish / build (map[dockerfile:deploy/Dockerfile.queue image_name:ppanel-queue name:queue]) (push) Successful in 1m32s

This commit is contained in:
2026-03-01 20:30:28 -08:00
parent b8dab70de5
commit e22a34ef3e
7 changed files with 45 additions and 17 deletions
@@ -27,8 +27,6 @@ func NewDecryptMiddleware(c config.Config) *DecryptMiddleware {
func (m *DecryptMiddleware) Handle(next http.HandlerFunc) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
fmt.Printf("[DEBUG] DecryptMiddleware entered, Security.Enable=%v, Login-Type=%q\n",
m.conf.Security.Enable, r.Header.Get("Login-Type"))
if !m.conf.Security.Enable {
next(w, r)
return
@@ -89,10 +87,9 @@ func (m *DecryptMiddleware) Handle(next http.HandlerFunc) http.HandlerFunc {
httpx.Error(w, xerr.NewErrCode(xerr.DecryptFailed))
return
}
fmt.Printf("[DEBUG] decrypted body: %s\n", string(plain))
r.Body = io.NopCloser(bytes.NewBuffer(plain))
// 防止 httpx.Parse 内部 r.ParseForm() 消费已替换的 body
// ParseForm 首行检查 r.PostForm == nil,置空后它不会再读 body
// 防止 httpx.Parse 内部 r.ParseForm() 消费已替换的 body
// Go 标准库 ParseForm 首行检查 r.PostForm==nil 才读 body,提前置空即可跳过
r.PostForm = url.Values{}
r.ContentLength = int64(len(plain))
}