mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-07-17 10:06:08 +00:00
refactor(mtproto): manage ad-tags per client only
The inbound-level ad-tag duplicated the per-client override for no gain: the fork's global tag applied to every secret anyway, so one value had two homes and they could drift. The inbound form field, the settings key, and the global ad-tag in the generated config and in the PUT /secrets body are gone; the tag is set on each client instead. Existing inbound-level values are intentionally not migrated; a leftover settings key is stripped on the next save.
This commit is contained in:
@@ -493,6 +493,26 @@ func StripMtprotoInboundSecret(settings string) (string, bool) {
|
||||
return string(out), true
|
||||
}
|
||||
|
||||
// StripMtprotoInboundAdTag drops the dead inbound-level `adTag` — tags live on clients.
|
||||
func StripMtprotoInboundAdTag(settings string) (string, bool) {
|
||||
if settings == "" {
|
||||
return settings, false
|
||||
}
|
||||
var parsed map[string]any
|
||||
if err := json.Unmarshal([]byte(settings), &parsed); err != nil {
|
||||
return settings, false
|
||||
}
|
||||
if _, ok := parsed["adTag"]; !ok {
|
||||
return settings, false
|
||||
}
|
||||
delete(parsed, "adTag")
|
||||
out, err := json.MarshalIndent(parsed, "", " ")
|
||||
if err != nil {
|
||||
return settings, false
|
||||
}
|
||||
return string(out), true
|
||||
}
|
||||
|
||||
// mtprotoSecretDomain extracts the FakeTLS domain embedded in the tail of a
|
||||
// secret, returning an empty string when the secret is malformed. Each mtproto
|
||||
// client carries its own domain inside its secret, so healing preserves it
|
||||
|
||||
Reference in New Issue
Block a user