mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[PR #5838] [MERGED] fix(mtproto): stop dropping connections on client/inbound edits; add live updates + ad-tag #6003
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#6003
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/MHSanaei/3x-ui/pull/5838
Author: @MHSanaei
Created: 7/6/2026
Status: ✅ Merged
Merged: 7/6/2026
Merged by: @MHSanaei
Base:
main← Head:feat/mtproto-live-updates📝 Commits (10+)
2ea824afix(mtproto): split the mtg fingerprint into structural and secrets partsbdabba7fix(mtproto): stop restarting mtg on every inbound editfb8f7adfix(mtproto): exclude depleted clients from the reconcile job to match the sync push55845c6feat(mtproto): hot-reload mtg secrets in place instead of restarting1e6091afeat(mtproto): apply single-client edits to the sidecar immediatelye4b8c75chore(mtproto): pin mtg-multi to the mhsanaei fork v1.13.3ca6ebf0feat(mtproto): apply live secret updates via the management API and add ad-tag7bf5d5ffeat(inbounds): expose the mtproto ad-tag and public IP in the inbound form534deacci(mtproto): install mtg-multi from prebuilt release binariesdd4b100i18n(mtproto): localize the ad-tag and public IP strings📊 Changes
40 files changed (+1163 additions, -94 deletions)
View changed files
📝
.github/workflows/release.yml(+17 -20)📝
CLAUDE.md(+4 -2)📝
DockerInit.sh(+13 -5)📝
README.ar_EG.md(+0 -1)📝
README.es_ES.md(+0 -1)📝
README.fa_IR.md(+0 -1)📝
README.md(+0 -1)📝
README.ru_RU.md(+0 -1)📝
README.tr_TR.md(+0 -1)📝
README.zh_CN.md(+0 -1)📝
docs/architecture.md(+4 -2)📝
frontend/src/pages/inbounds/form/protocols/mtproto.tsx(+24 -0)📝
frontend/src/schemas/protocols/inbound/mtproto.ts(+11 -0)📝
internal/mtproto/manager.go(+146 -20)➕
internal/mtproto/manager_reload_test.go(+252 -0)📝
internal/mtproto/manager_test.go(+51 -9)📝
internal/mtproto/process.go(+3 -1)📝
internal/web/job/mtproto_job.go(+7 -15)📝
internal/web/runtime/local.go(+32 -0)📝
internal/web/service/client_inbound_apply.go(+12 -3)...and 20 more files
📄 Description
Problem
MTProto connections dropped whenever a client or inbound was edited. Three causes:
DelInbound+AddInbound, andRemovedeleted the manager's tracking entry, so the existing "config unchanged → no-op" fingerprint gate could never fire.Changes
Panel-side (fixes the drops on their own):
Ensureinstead ofRemove+Ensure, so an edit that doesn't change the generated config keeps the process and its connections. The fingerprint is split into structural (restart-on-change) vs reloadable (secrets + ad-tag) parts.DesiredMtprotoInstances) and the interactive push, so depleted clients are actually cut off and the two paths never flap.Live updates via the fork's management API:
PUT /secrets(mhsanaei/mtg-multi ≥ v1.13.3): one atomic JSON call that keeps unchanged connections and closes only removed or re-keyed ones. The config file is still written first for restart/crash recovery, and any non-200 falls back to a full restart, so older binaries keep working unchanged.Per-inbound ad-tag (sponsored channel):
CI:
DockerInit.sh+release.yml, instead of building from source. Producedmtg-<os>-<arch>filenames are unchanged.Verification
/adtagreturned the tag.go build/go vet/go test -shuffle=on, frontend typecheck + 702 tests + production build, and the release download flow all pass.ensureActionFor, thePUT /secretsclient, hot-reload-keeps-process / fallback-restarts / no-op-keeps-process (fake mtg via test-binary re-exec), job depletion parity, and an "unchanged save doesn't restart" regression.Notes
mtg-multifork lives in a separate repo (mhsanaei/mtg-multi, released v1.13.3) — this PR is self-contained for the panel and only requires that release.mtgAdTag*,mtgPublicIp*) carry English text in the non-English locales until translated — present in all 13 files per the repo convention, so they fall back to English meanwhile.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.