Commit Graph
3081 Commits
  • feat(mtproto): per-client ad-tags, management-API auth, and record secret sync
    Catch the panel up to the mtg-multi README (v1.14.0):
    
    - Each client can now carry its own 32-hex advertising tag overriding the
      inbound-level one. The tag lives on the client (settings JSON is the
      source of truth, clients.ad_tag is the UI projection), is rendered into
      the fork's [secret-ad-tags] section for active secrets only (mtg rejects
      a config whose override names an unknown secret), is pushed per entry
      through PUT /secrets, and is part of the reload fingerprint so a tag
      edit hot-applies without dropping connections.
    - The loopback management API can replace the whole secret set, so every
      mtg process now gets a random per-process api-token; the manager sends
      it as a bearer token on PUT /secrets and GET /stats and reuses it across
      config rewrites, because mtg reads the token only at startup.
    - Malformed tags are rejected at every save path and additionally dropped
      in InstanceFromInbound: one bad tag would otherwise fail the whole
      generated config and take every client of the inbound down with it.
    - SyncInbound never copied a re-keyed mtproto secret into the canonical
      clients table, so the clients page and subscription links kept serving
      the old secret, which mtg then rejects. It is now guarded-copied like
      the other credentials.
  • fix(ci): stop executing tag-checkout code in the release smoke test
    CodeQL alert 99 (actions/cache-poisoning/poisonable-step): the workflow_run
    job runs in the default branch's cache scope, so checking out
    workflow_run.head_sha and executing a script from it is a cache-poisoning
    surface. The if-guard (event == 'push') already kept fork PRs out, but the
    checkout pin was never the load-bearing part of the release verification —
    the version argument is, since install.sh downloads that exact release
    binary. Run the smoke script from the default branch instead, which also
    matches what real users execute.
  • fix(mtproto): stop dropping connections on client/inbound edits; add live updates + ad-tag (#5838)
    * fix(mtproto): split the mtg fingerprint into structural and secrets parts
    
    A reordered clients array in the stored settings used to read as a config
    change because the fingerprint concatenated secrets in array order, and one
    opaque fingerprint could not tell a restart-worthy change (bind address,
    fronting, throttle) from a secret-set change a reload-capable mtg can absorb
    in place. Sort the secret pairs so order stops mattering, and split the value
    so the upcoming hot-reload path can decide between keeping, reloading, and
    restarting the process.
    
    * fix(mtproto): stop restarting mtg on every inbound edit
    
    Saving an mtproto inbound tore down and respawned its mtg sidecar even when
    nothing material changed, dropping every live Telegram connection: the update
    path pushed DelInbound+AddInbound, and Remove deletes the manager's map entry,
    so Ensure's fingerprint no-op gate could never fire. Route mtproto updates
    through a single Ensure call so an edit that leaves the generated TOML alone
    keeps the process, and only real config changes restart it.
    
    Capturing the pre-edit protocol also fixes a latent leak: changing an
    inbound's protocol away from mtproto never stopped the sidecar, because the
    snapshot handed to the runtime already carried the new protocol and the
    removal took the xray branch, leaving an orphaned mtg holding the port.
    
    An mtproto push failure no longer requests an xray restart - xray cannot fix
    the sidecar, and the 10s reconcile job self-heals it.
    
    The regression test fakes mtg by re-executing the test binary, counting
    spawns through a pid file: an unchanged save and a remark-only edit must keep
    the process, a re-keyed secret must restart it.
    
    * fix(mtproto): exclude depleted clients from the reconcile job to match the sync push
    
    The 10s reconcile job derived mtg secret sets from raw inbound settings while
    the interactive push filtered clients through buildRuntimeInboundForAPI, which
    drops client_traffics-disabled (depleted or expired) clients. The two paths
    therefore disagreed on the fingerprint - each disagreement one needless mtg
    restart dropping live connections - and worse, the job kept serving depleted
    clients' secrets indefinitely, so running out of traffic never actually cut an
    mtproto client's access.
    
    DesiredMtprotoInstances now builds the job's desired state with the same
    depletion overlay the push uses (one bulk client_traffics query), drops
    inbounds whose every secret is filtered away so their sidecar stops, and
    AddInbound pushes the filtered payload too so an imported inbound carrying
    disabled stats does not seed a fingerprint the next reconcile disagrees with.
    
    * feat(mtproto): hot-reload mtg secrets in place instead of restarting
    
    A client add, removal, re-key, or enable-toggle changes only the [secrets]
    section of the generated config, yet the panel could apply it only by killing
    and respawning the mtg sidecar, dropping every Telegram connection on that
    inbound. Split the ensure decision three ways: an identical config is a no-op,
    a secrets-only change rewrites the TOML on the same api port and asks mtg to
    hot-swap it via POST /reload, and a structural change (or a failed reload)
    falls back to the full stop-and-start.
    
    The reload endpoint is served by the mhsanaei/mtg-multi fork; against an older
    binary the POST 404s and the manager restarts exactly as before, so panel and
    binary upgrades stay order-independent.
    
    * feat(mtproto): apply single-client edits to the sidecar immediately
    
    Client CRUD on an mtproto inbound was a runtime no-op, so an add, delete,
    re-key, or enable-toggle only reached mtg on the next 10s reconcile. With the
    sidecar now able to hot-reload, push the change straight after the edit commits:
    applyLocalMtproto rebuilds the inbound's filtered client set and re-applies it,
    so a new client works within a moment (and, on a reload-capable binary, without
    disturbing the others) and deleting the last client stops the process.
    
    The three interactive single-client paths (add, update, delete) call it; bulk
    operations still ride the reconcile job, which converges to the same state.
    
    * chore(mtproto): pin mtg-multi to the mhsanaei fork v1.13.3
    
    The reload endpoint the panel now uses lives in the mhsanaei/mtg-multi fork, so
    point the source-build pin (DockerInit.sh + both release.yml matrices) at it and
    bump to v1.13.3. The install still produces the same mtg-multi binary name, so
    the mtg-<os>-<arch> rename and everything downstream are unchanged. Docs and the
    package comment note the hot-reload path and its restart fallback.
    
    * feat(mtproto): apply live secret updates via the management API and add ad-tag
    
    Two capabilities the mhsanaei/mtg-multi v1.13.3 fork exposes are now surfaced by
    the sidecar manager.
    
    Live updates go through PUT /secrets on the fork's management API instead of
    POST /reload: the panel already holds the whole desired set per inbound, so it
    sends secrets and the advertising tag as one JSON call that mtg applies
    atomically, keeping every unchanged connection and closing only removed or
    re-keyed ones. The config file is still written first so a restart or crash
    recovery reproduces the state, and any non-200 (an older binary, a refused
    connection) still falls back to a full restart.
    
    Per-inbound ad-tag adds an optional 32-hex Telegram advertising tag plus
    public-ipv4/public-ipv6 overrides. The ad-tag rides the reloadable secrets
    fingerprint, so changing it hot-applies without dropping connections; the public
    IPs are proxy-construction parameters and sit in the structural fingerprint, so a
    change there restarts the process. Empty public IPs are omitted so mtg
    auto-detects the reachable address.
    
    * feat(inbounds): expose the mtproto ad-tag and public IP in the inbound form
    
    Adds an Ad-tag field (validated as 32 hex characters) plus optional Public IPv4
    and Public IPv6 overrides to the MTProto inbound form, backed by the same-named
    settings the sidecar writes into the mtg config. The public IPs are optional —
    left blank, mtg auto-detects the reachable address the ad-tag middle proxy needs.
    English strings are added to every locale; the non-English ones carry the
    English text until translated and fall back to it meanwhile.
    
    * ci(mtproto): install mtg-multi from prebuilt release binaries
    
    The fork now publishes release archives for every platform we package, so
    download and unpack the matching mtg-multi-<ver>-<os>-<arch> binary instead of
    compiling it from source with go install. Faster builds and no toolchain step,
    and the archive's platform labels line up with our matrix; the produced
    mtg-<os>-<arch> filenames are unchanged.
    
    * i18n(mtproto): localize the ad-tag and public IP strings
    
    The six mtgAdTag*/mtgPublicIp* keys shipped with English text in every locale as
    a placeholder. Translate them into the twelve non-English locales (Arabic,
    Spanish, Persian, Indonesian, Japanese, Portuguese-BR, Russian, Turkish,
    Ukrainian, Vietnamese, and Simplified/Traditional Chinese); en-US is unchanged.
    
    * retired goreportcard.com
  • fix(mtproto): stop persisting a vestigial inbound-level secret
    MTProto is multi-client: mtg's [secrets] config and every share link read only the per-client secrets. The old HealMtprotoSecret regenerated an inbound-level secret on every save, and seedMtprotoSecretsToClients only dropped it for legacy single-secret inbounds, so multi-client inbounds kept a dead secret. That value once leaked into stale links imported into Telegram, which mtg then rejected as "incorrect client random".
    
    Replace HealMtprotoSecret with StripMtprotoInboundSecret (removes the key), strip on save in normalizeMtprotoSecret, and add a one-time stripMtprotoInboundSecrets migration that runs after the seeder so a legacy secret is first preserved onto a client before the inbound-level copy is dropped.
  • fix(mtproto): drop the remark fragment from tg proxy deep links
    genMtprotoLink appended the panel remark as a URL fragment (tg://proxy?...&secret=...#remark). Because secret/server is the last query value, lenient Telegram parsers fold the "#remark" into it and the imported proxy breaks with "incorrect client random". Telegram proxy deep links have no name field, so emit a clean link on both the backend (internal/sub) and frontend (inbound-link.ts). The remark still shows as a separate tag in the inbound info modal, which reads it from genAllLinks, not the URL.
    
    Guards: Go TestGenMtprotoLinkFields asserts no fragment; the frontend mtproto link test asserts no '#'.
  • chore(gen): refresh generated schemas after Client.Secret comment drop
    Commit d8b9f535 dropped the trailing comment on model.Client.Secret but did not regenerate the openapigen output, leaving a stale "MTProto FakeTLS secret" description in schemas.ts and openapi.json. Rerun make gen to bring the generated files back in sync with the source.
  • fix(ci): install mtg-multi without GOBIN for cross-compiled release builds
    go install refuses to run with GOBIN set when GOOS/GOARCH differ from the host, which failed the linux release build for every non-amd64 platform (386, arm64, armv7, armv6). Let it install into GOPATH/bin instead, where cross-compiled binaries land in a GOOS_GOARCH subdirectory, and locate the binary there. DockerInit.sh keeps GOBIN because buildx runs it under emulation for the target platform, making the install native.
  • style(model): drop trailing comment on Client.Secret to satisfy gofumpt
    The long example tag on Secret pulled the struct's trailing-comment block into a new alignment section, so gofumpt demanded every following comment be re-aligned to that tag's column. Removing the comment restores the previously accepted layout and follows the repo rule against line comments.
  • feat(mtproto): adopt dolonet/mtg-multi and make MTProto inbounds multi-client
    Replace the upstream 9seconds/mtg sidecar with the dolonet/mtg-multi fork so a single MTProto inbound can serve many per-user secrets. Each panel client is now one named FakeTLS secret in the fork's [secrets] section: clients are first-class (attach/detach, limits, expiry, per-client tg:// links) exactly like every other protocol, mirroring the WireGuard multi-client model. Per-client traffic and online status come from the fork's /stats JSON API (its Prometheus output has no per-user label), fed into the existing email-keyed client_traffics accumulator; an optional throttle caps concurrent connections. A one-time seeder converts each legacy single-secret inbound into a one-client inbound.
    
    The fork ships only linux/darwin amd64/arm64 binaries but is pure Go, so provisioning builds it from source for every supported platform (release.yml, DockerInit.sh) while keeping the panel-expected mtg-<os>-<arch> filename and the 'run' verb, so process.go is untouched. Also fixes a pre-existing update.sh gap that never renamed the mtg binary for armv6/armv7 updates.
  • fix(script): stop logging an error when Enter accepts the default ACME port
    Pressing Enter at the 'Please choose which port to use (default is 80)' prompt left WebPort empty, and bash arithmetic treats an empty string as 0, so the out-of-range branch fired and printed 'Your input is invalid' even though the default was correctly applied. Handle empty input as accepting the default silently, and validate real input with a digits-only regex so non-numeric entries like '8x' get the invalid-input message instead of a bash arithmetic error. Applied to the identical prompt in x-ui.sh, install.sh, and update.sh.
    
    Fixes #5829
  • feat(db): add pgclient command to install or upgrade PostgreSQL client tools
    Restoring a panel backup made by a newer pg_dump fails when the host's
    pg_restore is older, and the existing pg_ensure_client only installs the
    distribution package when the tools are missing - it can never upgrade,
    and distribution repositories often cap below the required major.
    
    Add pg_upgrade_client to x-ui.sh, exposed as 'x-ui pgclient [major]' and
    as a PostgreSQL menu entry: it checks the installed pg_restore major,
    tries the distribution package for the exact requested major first, and
    falls back to the official PostgreSQL repository (apt on Debian/Ubuntu,
    yum/dnf on Enterprise Linux, with a /usr/pgsql PATH symlink fallback);
    Arch, Alpine and openSUSE install their current package. The panel's
    dump-version mismatch error now names the ready-to-copy command with
    the exact major parsed from the dump header.
  • fix(db): probe dump readability before PostgreSQL import
    pg_restore cannot read archives newer than itself, so importing a dump
    made by pg_dump from PostgreSQL 17+ into a panel with an older
    postgresql-client failed with a raw 'unsupported version (1.16) in file
    header' - and only after Xray had already been stopped for the restore.
    
    Probe the uploaded file with pg_restore --list first, which reads only
    the archive TOC without touching the database, so an unreadable dump is
    rejected before Xray is interrupted. When the failure is a dump-format
    version mismatch, translate it into a message naming the PostgreSQL
    version that produced the dump and the client version to install.
  • feat(outbound): add real-delay connection test mode
    The HTTP probe reports the warm per-request round-trip, which reads
    lower than the delay figure client apps show for the same server. Add a
    third "real" test mode that reuses the temp-instance HTTP probe but
    reports the cold request's full elapsed time - tunnel establishment
    included - and skips the warm request. UDP-transport outbounds forced
    out of the TCP lane still report "http"; in real mode they report
    "real". The mode joins the TCP/HTTP toggle on the outbounds tab, with
    the label translated in all 13 locales.
  • fix(client): stop duplicate client entries accumulating in inbound settings
    Adding a user to multi-node inbounds could leave 3-6 identical entries
    in one inbound's settings.clients array: addInboundClient appended
    incoming clients unconditionally, and the duplicate-email precheck
    exempts a matching subId (so one identity can span several inbounds),
    so a retried or raced add of the same client re-appended it to an
    inbound that already carried it - on the master and, since nodes run
    the same code, on every node, whose snapshot adoption then copied the
    duplicates back verbatim. The normalized clients/client_inbounds tables
    stayed clean (unique constraints), which is why the phantom rows only
    showed in settings-driven views like the Detach clients modal, where
    duplicate React keys also broke the selection counter.
    
    Three layers: addInboundClient now skips incoming clients whose email
    is already on the target inbound (idempotent re-adds instead of
    duplication), node snapshot adoption collapses duplicate emails before
    writing the central row, and an idempotent startup repair rewrites any
    inbound whose settings still carry duplicates from older builds.
    
    Closes #5770
  • fix(ui): keep an explicit zero happy-eyeballs delay across the round trip
    Follow-up found in review: the wire normalizer still stripped
    tryDelayMs when it equaled 0, but with the schema default now 250 a
    reload rehydrates the missing field as 250 - a user who explicitly set
    0 ("disabled", per the field's own placeholder) would see 250 and any
    subsequent save would silently enable a delay they turned off. Keep
    tryDelayMs on the wire unconditionally; it is the one happy-eyeballs
    field whose presence changes xray's behavior.
    
    Refs #5780
  • fix(link): reject non-finite and clamp out-of-range quicParams from fm=
    Follow-up hardening of the fm= sanitizer found in review. ParseFloat
    accepts "inf"/"NaN", and a non-finite float64 makes json.Marshal fail
    later - the subscription refresh discards that error and blanks the
    stored outbound set, so one poisoned link could wipe a subscription's
    outbounds. Values that coerce fine but sit outside xray-core's accepted
    ranges (keepAlivePeriod 0 or 2-60, maxIdleTimeout 0 or 4-120,
    maxIncomingStreams 0 or >= 8) still killed the config load, and huge
    magnitudes serialize in exponent notation that xray's integer fields
    reject. Coerced values are now stored as integers, clamped into the
    accepted ranges, and dropped when negative, non-finite, or absurdly
    large; the TS import parser mirrors the same rules.
    
    Refs #5783
  • fix(db): clamp traffic counters below int64 max and repair overflowed rows
    A counter pushed past int64 (multi-node setups hit this via historic
    delta-compounding bugs) makes SQLite silently promote the INTEGER cell
    to REAL. From then on the column no longer scans into the Go int64
    field and every reader of client_traffics fails at once: the inbounds
    page, xray restarts, and node traffic sync all return "converting
    driver.Value type float64 to int64".
    
    Two-part fix: every unbounded "up = up + ?" add (local traffic, node
    delta merge, inbound counters, plus the Go-side outbound accumulation)
    now saturates at TrafficMax, a cap safely below math.MaxInt64 so one
    more delta cannot overflow; and a startup repair casts REAL-promoted
    cells back to INTEGER and clamps all traffic counters into
    [0, TrafficMax] across client_traffics, inbounds, outbound_traffics
    and node_client_traffics, restoring access to already-corrupted panels
    without manual sqlite surgery.
    
    Closes #5762
  • fix(node): fully delete clients on nodes instead of only detaching them
    Deleting a client on the master propagated to nodes via the detach
    endpoint, which removes the client from that one inbound's settings but
    deliberately keeps the client record. The node ended up with an
    orphaned record that kept showing in its Clients view; the master and
    node could never converge on a delete.
    
    Full-delete and detach intent now travel separately: the Runtime
    interface gains DeleteClient, which on Remote hits the node's
    panel/api/clients/del endpoint (record, attachments, traffic; repeat
    calls for a client on several inbounds of the same node are swallowed
    as idempotent "not found"). Delete/DeleteByEmail/BulkDelete use it for
    node inbounds, while Detach/BulkDetach keep the inbound-scoped detach
    RPC so removing a client from one inbound never wipes it node-wide
    (the #5543 guarantee is preserved and covered by tests). Bulk deletes
    above the fold threshold still converge membership via reconcile; their
    leftover node records can be cleaned with the node's delete-orphans
    action.
    
    Closes #5797
  • fix(outbound): measure HTTP test delay on a warm connection
    Since the batched prober replaced the single tester, the reported delay
    came from one cold request with keep-alives disabled, so it stacked the
    SOCKS handshake, proxy dial, proxy TLS, target TCP and target TLS on top
    of the round-trip. Users upgrading from v2.9.4 - whose tester warmed the
    connection first and timed a second request - saw several times the real
    connection time.
    
    The cold request still proves reachability and supplies the HTTP status
    plus the connect/TLS/TTFB breakdown; the delay is now re-measured on a
    second request over the kept-alive connection, falling back to the cold
    total when the warm request fails. Bodies are drained (bounded) so the
    connection returns to the pool, and the batch test asserts both requests
    of a probe share one connection.
  • fix(tgbot): find clients by tgId regardless of settings JSON formatting
    The Telegram-bot usage lookup prefiltered inbounds with
    settings LIKE '%"tgId": N%', which requires the exact space the panel's
    MarshalIndent happens to emit. Inbounds whose settings were serialized
    compactly (node sync, imports, external edits) never matched, so the
    bot reported no configuration even though the client and traffic rows
    exist. Replace the string match with the driver-portable JSON helpers
    already used by GetAllEmails, which read the actual clients array on
    SQLite and Postgres alike.
    
    Closes #5805
  • fix(link): sanitize numeric quicParams taken from a share link's fm= param
    The fm= finalmask blob was JSON-decoded and attached to streamSettings
    verbatim, both by the Go parser (outbound subscriptions) and the
    frontend import. Some providers emit duration strings for the strictly
    integer quicParams fields (e.g. keepAlivePeriod "10s"), and xray-core
    then refuses to load the whole config at startup - one bad subscription
    entry took the panel's Xray down on the next refresh. Coerce numeric
    strings, convert duration strings to whole seconds, and drop values
    that cannot be represented as integers; genuinely string-typed fields
    (congestion, bbrProfile, brutalUp/Down, udpHop) pass through untouched.
    
    Closes #5783
  • fix(ui): make the Happy Eyeballs toggle produce a config xray actually enables
    Toggling Happy Eyeballs on filled the object with schema defaults, and
    tryDelayMs defaulted to 0. That broke the feature twice over: xray-core
    treats tryDelayMs=0 as happy-eyeballs-off, and the wire normalizer
    strips every field that equals its default, leaving an empty object it
    then deletes - so the switch silently flipped back off on reopen (the
    "disabled when Prefer IPv6 is off" symptom; prioritizeIPv6=true was the
    one non-default that let the object survive). Default tryDelayMs to the
    recommended 250ms so an enabled config survives serialization and is
    functional in the core.
    
    Closes #5780
  • fix(ui): align the subUpdates limit with the backend and show the range
    The hand-written settings schema capped subUpdates at 168 while the
    backend (and the generated schema mirrored from it) accepts 0-525600.
    Anyone upgrading from 2.x with a stored value above 168 could no longer
    save any settings tab: the whole settings object is validated on every
    save, so the stale field blocked everything with an unexplained
    "Invalid input". Match the backend bounds and put them on the input so
    the limit is discoverable.
    
    Closes #5821
  • fix(script): rename the Xray binary to xray-linux-arm32 on 32-bit ARM
    The panel maps GOARCH=arm to "arm32" and launches bin/xray-linux-arm32,
    but install.sh/update.sh renamed the release tarball's binary
    (xray-linux-armv5/v6/v7) to xray-linux-arm. On armv7 boxes every update
    downloaded a fresh Xray core into a name the panel never executes, so an
    old correctly-named binary kept running forever, and a brand-new install
    had no launchable Xray binary at all. Rename to arm32 to match the panel
    (mtg stays plain "arm", matching internal/mtproto), and drop the stale
    misnamed xray-linux-arm during updates like the existing amd64 cleanup.
    
    Closes #5788
  • fix(script): make local PostgreSQL and fail2ban setup work on RHEL-family distros
    Fresh installs on Rocky/Alma/RHEL/Oracle failed twice (#5806):
    
    - postgresql-setup --initdb ships a pg_hba.conf whose TCP rules use ident
      auth, which matches the OS username against the Postgres role and always
      rejects the randomly generated panel role, so the panel could never
      connect ("Ident authentication failed"). Prepend password-auth rules
      scoped to the panel database (first match wins; md5 also accepts
      scram-stored verifiers) and reload, in both install.sh and the x-ui.sh
      mirror.
    
    - fail2ban only exists in EPEL on the RHEL family, but only the CentOS 7
      branch enabled EPEL, so IP Limit setup failed with "No match for
      argument: fail2ban". Enable epel-release (with the dl.fedoraproject.org
      package as fallback for RHEL proper) before installing; Fedora ships
      fail2ban in its own repos and is skipped.
    
    Closes #5806
  • fix(script): stop running full system upgrades via pacman -Syu on Arch
    Installing or updating the panel on Arch/Manjaro/Parch performed a full
    system upgrade (pacman -Syu) instead of only refreshing the package
    database and installing the needed packages, unlike every other distro
    branch (apt-get update, dnf makecache, zypper refresh, apk update).
    Unrequested full upgrades can pull in kernel and system updates the
    user never asked for. Align all pacman calls on the -Sy --noconfirm
    form already used elsewhere in these scripts.
    
    Closes #5810
  • fix(node): stop client edits from tearing down node inbounds and harden reconcile fingerprints
    A client save on the master always stamped a fresh updated_at, marked
    the node dirty, and let the 5s sync push a full inbounds/update to the
    node, where applying it removes and re-adds the Xray handler - killing
    live traffic on every edit, including no-op saves (open the editor,
    click Save). Nodes stayed online with Xray running while forwarding
    nothing until a manual Xray restart.
    
    - No-op client saves preserve the client's updated_at and return before
      any DB write, runtime RPC, or node dirty mark when the effective
      settings did not change.
    - Successful per-client add/update/delete pushes advance the node's
      reconcile-skip fingerprint only when the recorded fingerprint proves
      the node held the exact pre-edit payload and every push in the edit
      succeeded (Remote.AdvancePushedInbound). Anything unproven keeps the
      stale fingerprint so the dirty reconcile still sends the full inbound.
      Unconditional stamping would certify folded bulk changes (threshold,
      flow change, offline edit) or partially failed batches as delivered:
      a folded 41->6 bulk delete followed by one live edit left the node
      permanently serving all 41 clients in end-to-end testing, with the
      snapshot adoption then resurrecting the deleted clients on the master.
    - DeleteUser treats only an envelope-level not-found as already deleted;
      an HTTP 404 from an old node build without the detach endpoint
      surfaces as an error instead of certifying an undelivered delete.
      cacheDel drops the fingerprint alongside the id cache so DelInbound
      and tag renames leave no stale skip entry.
    - Adopting the node's own settings serialization into the master row now
      also stamps the fingerprint (RecordAdoptedInbound). Without it the
      serialization round-trip invalidated the fingerprint one sync tick
      after every push, so each edit degraded back to a full teardown push.
    - UpdateInboundClient applies the Shadowsocks method normalization
      before the no-op comparison (real method changes bump updated_at, SS
      no-op edits are detected) and syncs the generated subId into the
      pushed client so the node cannot mint a different one.
    
    Verified with a two-panel docker deployment: no-op saves produce zero
    node requests, real edits send one lightweight clients/update RPC with
    zero full inbound updates and zero handler teardowns, and folded bulk
    deletes still converge.
    
    Based on PR #5778 by @rqzbeh.
    
    Closes #5764
    Closes #5771
  • feat(ui): client-realtime-speed (#5687)
    * refactor(inbounds): extract TRAFFIC_POLL_INTERVAL_S to shared util
    
    * feat(clients): derive per-client live speed from traffic WebSocket deltas
    
    * feat(clients): render speed column and mobile card line
    
    * i18n(clients): add pages.clients.speed key to all 13 locales
  • fix(script): correct hardcoded menu option numbers in x-ui.sh (#5787)
    * fix(script): correct hardcoded menu option numbers in x-ui.sh
    
    The error messages referenced option 19 for SSL Certificate Management
    and option 16 for Logs Management, but the actual positions in show_menu
    are 20 and 17 respectively.
    
    * Update x-ui.sh
  • fix(ci): pin the tag smoke test to the release under test
    The v3.4.2 tag push triggered the smoke workflow immediately, but
    install.sh with no arguments resolves releases/latest, which still pointed
    at v3.4.1 while release.yml was uploading the new assets. The green smoke
    run therefore validated the previous release (#5756). A paths filter alone
    cannot exclude tag pushes because a brand-new tag ref has no diff base.
    
    Restrict the push trigger to branches so tag pushes no longer start the
    unpinned job, and add a workflow_run job that fires after the release
    workflow completes for a v* tag: it checks out the tagged commit, passes
    the tag through smoke-noninteractive.sh into install.sh's explicit-version
    path, and asserts the installed binary reports exactly that version.
    
    Closes #5756
  • fix(node): stop one rejected inbound from starving a node's traffic sync
    A legacy socks inbound (predating the socks-to-mixed protocol rename) fails the node's request validation when pushed. ReconcileNode aborted on the first failed inbound and syncOne then skipped the traffic snapshot entirely and never cleared ConfigDirty, so the whole node re-failed every tick and the master stopped deducting traffic for every client on that node, exactly as reported in #5685.
    
    Three-part fix: ReconcileNode now pushes every inbound and runs the delete sweep even past individual failures, returning the failures joined; syncOne logs a failed reconcile but continues with the traffic pull (dirty stays set, so reconcile retries and the merge stays in its conservative mode); and a migration renames legacy socks inbounds to mixed, which has an identical settings shape, removing the known trigger.
    
    Closes #5685
  • feat(frontend): add text search to the inbound list
    The v2.x panel could filter inbounds but the list page only had the node dropdown. Add a search box next to it matching on remark, port, and protocol, composed with the node filter; the dataset is already client-side, so no API change.
    
    Closes #5267
  • feat(sub): show the announcement on the subscription info page
    The subAnnounce setting was only emitted as a base64 Announce response header, which most client apps ignore and browsers never see. Pass it into the sub page view-model and render it as an info alert at the top of the card; custom themes get the announce key for free.
    
    Closes #5276
  • feat(tgbot): register usage, inbound, restart and clearall in the bot command menu
    The Telegram command menu listed only start/help/status/id although usage, inbound and restart were already handled, and resetting all traffic was reachable only through inline keyboards. Register all handled commands with localized descriptions and add an admin-gated /clearall command that reuses the existing reset-all confirmation keyboard, so nothing destructive runs without an explicit confirm.
    
    Closes #5307
  • feat(tgbot): show inbound remark alongside email in the online clients list
    Online-client buttons showed only the email, which is ambiguous when the same usernames exist across inbounds. Label each button email - remark via the canonical GetClientInboundByEmail lookup (first matching inbound for multi-inbound clients); the callback payload stays the bare email.
    
    Closes #5318
  • fix(docker): start crond and persist acme.sh state so cert renewal works
    The image shipped busybox crond but the entrypoint never started it, and the acme.sh crontab entry vanished on every container recreation, so certificates issued via the panel's SSL menu silently expired after 90 days. The entrypoint now re-registers the acme.sh cron job and starts crond when acme.sh is installed, and docker-compose gains an acme volume so renewal state survives recreation.
    
    Closes #5116
  • feat(sub): serve the HTML info page for browser requests on JSON and Clash URLs
    Opening the /json or /clash subscription URL in a browser dumped raw JSON/YAML while the base64 URL rendered the info page. Extract the browser-detection and page-rendering branch from subs into maybeServeSubPage and run it first in all three handlers, so every subscription URL shows the same info page in a browser while client apps keep receiving the raw body.
    
    Closes #5348
  • feat(clients): hide disabled inbounds in the client form selector
    The attach-inbounds select in the client add/edit modal listed every inbound, so panels with many disabled inbounds had to scroll past dead entries. InboundOption now carries the inbound's enable flag and the form drops disabled inbounds from the options, keeping ones the client is already attached to so edit mode still renders existing assignments.
    
    Closes #5645
  • feat(tgbot): include hostname in backup and ban-log messages
    Backup and ban-log pushes carried no server identity, so admins running the bot against several panels could not tell which server a backup came from. Prepend the same hostname line the periodic report and event notifications already use; the tgbot.messages.hostname key exists in all locales, so no new i18n keys are needed.
    
    Closes #5387
  • feat(frontend): add text search to node select components
    Typing in the Deploy To select of the inbound form and the node filter select on the inbound list now filters nodes by label, matching the showSearch convention used elsewhere (NodeFormModal, HostFormModal). With 20+ nodes, scrolling was the only way to find one.
    
    Closes #5743
  • fix(panel): use the hosting node address for WireGuard client configs (#5679)
    * fix(panel): use the hosting node address for WireGuard client configs
    
    The clients page rendered a node-managed WireGuard inbound's config with the
    master panel's host in Endpoint instead of the hosting node's address, so the
    copied/QR config pointed at the wrong server. The subscription path already
    resolves this via resolveInboundAddress; the UI generator did not.
    
    Expose the share-host resolution inputs (node address, listen, share-address
    strategy/address) on InboundOption and route buildWireguardClientConfig through
    the same canonical resolver the inbounds-page share links use, extracted as
    resolveShareHost. This also brings local inbounds with a shareable listen or a
    listen/custom share strategy into parity with the subscription Endpoint; the
    common listen=0.0.0.0 case still falls back to the panel host.
    
    * fix(frontend): keep a raw fallback host and refresh node-fed inbound options
    
    Code review of the WireGuard node-endpoint change surfaced two gaps.
    resolveShareHost normalized its last-resort fallbackHostname, so a panel
    reached via a hostname the share-host grammar rejects (underscore label,
    trailing-dot FQDN) emitted a broken 'Endpoint = :51820'; the fallback now
    stays verbatim when normalization empties it. Node mutations only
    invalidated the nodes query, leaving the staleTime-Infinity inbound
    options cache serving an edited node address until the sync job
    broadcast (never, for disabled/offline nodes); they now invalidate the
    options key too.
    
    Also folds the ShareHostFields projections into direct structural passes,
    elides the default node shareAddrStrategy so omitempty drops it, and
    replaces the nullable node-address scan with COALESCE.
    
    ---------
    
    Co-authored-by: STRENCH0 <17428017+STRENCH0@users.noreply.github.com>
    Co-authored-by: Sanaei <ho3ein.sanaei@gmail.com>
  • Env vars example file update (#5678)
    * Update .env.example
    
    * Update .env.example
    
    * Update .env.example
    
    * Update .env.example
  • docs(settings): clarify Sub Port/Sub Domain double as subscription-link fallback (#5721)
    * docs(settings): clarify Sub Port/Sub Domain double as subscription-link fallback
    
    subPort/subDomain are documented purely as the subscription service's own
    listen address, but when "Reverse Proxy URI" is empty, GetDefaultSettings
    silently reuses them (with the admin API request's own Host header as the
    domain fallback) to build the subscription link/QR shown in the panel.
    Behind a reverse proxy where the sub service listens on an internal port
    and is exposed externally on a different port/domain, this produces a
    broken link even though "Reverse Proxy URI" already solves it - nothing
    in the UI text pointed to it. Clarify all locales.
    
    * docs(settings): fix wording nits from review (punctuation, CJK parens, es-ES field name)
    
    - en-US/id-ID/pt-BR/tr-TR/uk-UA/ar-EG: add terminating punctuation before
      the appended sentence so it doesn't run on directly after the closing
      parenthesis.
    - zh-CN/zh-TW/ja-JP: restore full-width CJK parentheses around the
      pre-existing parenthetical, matching the rest of each file.
    - es-ES: subURIDesc referenced "Dominio/Puerto de escucha", but the
      actual field labels in this locale are "Dominio de Escucha" and
      "Puerto de Suscripción".
    
    ---------
    
    Co-authored-by: Volov <volovdata@google.com>
  • feat(frontend): show client group in the client info modal
    The group label was already on ClientRecord but the info modal never
    displayed it. Add a conditional row next to the comment, rendered as a
    geekblue tag to match the group column in the clients table.
  • feat(frontend): add targetStrategy field to the outbound editor
    Xray-core added a top-level targetStrategy to OutboundObject that
    controls how the destination domain is resolved before dialing
    (AsIs/UseIP*/ForceIP*, any protocol). The panel neither offered a
    control for it nor preserved the key across the modal's JSON round
    trip, so hand-written values were silently dropped on save.
    
    The form now carries targetStrategy next to sendThrough as a select
    of the 11 canonical values; the adapter normalizes wire values to
    canonical case (the core matches case-insensitively) and omits the
    key when unset. Freedom settings additionally read the new
    settings-level targetStrategy with domainStrategy as fallback,
    mirroring the core, while still emitting the legacy domainStrategy
    key so configs keep working on older cores.
  • fix(frontend): stop group modals clearing selection on background refetch
    The reset effect in GroupAddClientsModal and GroupRemoveClientsModal
    depended on the memoized rows, which are rebuilt whenever GroupsPage
    re-renders because candidates/members are inline-filtered arrays. The
    5s client-list poll re-renders the page, so any selection made in the
    modal was wiped a few seconds later. Reset only when the modal opens.
  • refactor(sub): drop unused subReq parameter from genHy
    genHy reads inbound settings directly via json.Unmarshal and never
    touched subReq; the parameter was only added for signature uniformity
    with genVless/genServer in 7c12700c.
  • chore(deps): bump github.com/klauspost/compress from 1.18.6 to 1.19.0 (#5731)
    Bumps [github.com/klauspost/compress](https://github.com/klauspost/compress) from 1.18.6 to 1.19.0.
    - [Release notes](https://github.com/klauspost/compress/releases)
    - [Commits](https://github.com/klauspost/compress/compare/v1.18.6...v1.19.0)
    
    ---
    updated-dependencies:
    - dependency-name: github.com/klauspost/compress
      dependency-version: 1.19.0
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>