feat: 新增设备登录开关配置,优化 CI Go 模块缓存机制,并添加解密中间件调试日志。
Build docker and publish / prepare (20.15.1) (push) Successful in 10s
Build docker and publish / build (map[dockerfile:deploy/Dockerfile.admin image_name:ppanel-admin name:admin]) (push) Successful in 1m16s
Build docker and publish / deploy (push) Has been cancelled
Build docker and publish / notify (push) Has been cancelled
Build docker and publish / build (map[dockerfile:deploy/Dockerfile.rpc-core image_name:ppanel-rpc-core name:rpc-core]) (push) Has been cancelled
Build docker and publish / build (map[dockerfile:deploy/Dockerfile.scheduler image_name:ppanel-scheduler name:scheduler]) (push) Has been cancelled
Build docker and publish / build (map[dockerfile:deploy/Dockerfile.node image_name:ppanel-node name:node]) (push) Has been cancelled
Build docker and publish / build (map[dockerfile:deploy/Dockerfile.queue image_name:ppanel-queue name:queue]) (push) Has been cancelled
Build docker and publish / build (map[dockerfile:deploy/Dockerfile.api image_name:ppanel-api name:api]) (push) Has been cancelled

This commit is contained in:
2026-03-01 20:21:02 -08:00
parent d3da56891b
commit b8dab70de5
7 changed files with 171 additions and 10 deletions
@@ -8,6 +8,7 @@ import (
"io"
"net"
"net/http"
"net/url"
"strings"
"github.com/zero-ppanel/zero-ppanel/apps/api/internal/config"
@@ -26,6 +27,8 @@ 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
@@ -86,7 +89,12 @@ 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。
r.PostForm = url.Values{}
r.ContentLength = int64(len(plain))
}
next(rw, r)