fix(api): preserve omitted client fields in partial updates (#7042)

Keep omitted client fields and per-inbound flows unchanged while honoring explicit clears. Support the query aliases used to recover legacy dot-name clients and regenerate the API reference. Add an HTTP regression covering partial updates through those aliases.
This commit is contained in:
Aleksey Fedorov
2026-11-06 03:06:16 +10:00
committed by GitHub
parent cd176faf4e
commit e4935be861
14 changed files with 525 additions and 71 deletions
+3 -6
View File
@@ -267,16 +267,13 @@ func (a *ClientController) update(c *gin.Context) {
if !ok {
return
}
var req struct {
model.Client
LimitHwid int `json:"limitHwid"`
}
if err := c.ShouldBindJSON(&req); err != nil {
body, err := c.GetRawData()
if err != nil {
jsonMsg(c, I18nWeb(c, "somethingWentWrong"), err)
return
}
inboundFilter := parseInboundIdsQuery(c.Query("inboundIds"))
needRestart, err := a.clientService.UpdateByEmail(&a.inboundService, email, req.Client, req.LimitHwid, inboundFilter...)
needRestart, err := a.clientService.UpdateByEmailJSON(&a.inboundService, email, body, inboundFilter...)
// Flagged before the error check: a partly-applied edit leaves the change
// committed on the inbounds that succeeded, and those still need the restart.
if needRestart {