147 Commits
  • fix(node): stop the offline-sync toast firing on saves to online nodes
    IsNodePending fed the user-facing "saved locally, node offline, will
    sync on reconnect" toast off three conditions, one of which was the
    node's config_dirty flag. But every node-backed client/inbound edit
    marks the node dirty unconditionally inside its write transaction — it
    is the reconcile self-heal marker, set even for edits pushed live to a
    healthy online node. The controller reads that freshly-set flag right
    after the save, so the warning fired on every save to a node-backed
    inbound regardless of the node actually being online.
    
    Drop the dirty term so the predicate reflects only what the message
    claims: the node being unreachable (offline or disabled). Offline and
    disabled nodes still mark dirty and still surface the toast.
    
    Add regression tests: online+dirty must not be pending; offline and
    disabled must be.
  • fix(sub): bake Host VLESS Route into subscription UUIDs
    The Host VLESS Route field was stored and shown in the panel but never applied to any generated subscription (raw, JSON, Clash), so the UUID was emitted unmodified (#5655).
    
    Xray reads the route from the UUID's 3rd group (bytes 6-7, net.PortFromBytes) and masks those bytes to zero before authenticating, so a value can be baked into the share/JSON/Clash UUIDs without breaking the user match. A shared applyVlessRoute helper encodes a single 0-65535 value as the 3rd group; empty/invalid/non-UUID input is left unchanged, so legacy data never yields a broken link and no DB migration is needed.
    
    The field was wrongly validated as a multi-segment port spec (that form belongs to the separate server-side routing rule). It is now a single value 0-65535, with frontend validation, link-preview parity (genVlessLink/hostToExternalProxyEntry), hint + error translations across all 13 locales, and tests on every path.
    
    Closes #5655
  • fix(clients): re-enable depleted clients on API renewal (#5619)
    Renewing a subscription via POST /panel/api/clients/bulkAdjust extended a client's expiry/quota but left it disabled. The enforcement loop disables a depleted client across client_traffics, client_records and the inbound settings JSON (and pushes that to the node), while BulkAdjust only updated expiry/total and never cleared enable. On a node its UpdateUser push was built from the stale ClientRecord (Enable=false), which the next traffic poll merged back onto the master, so the client never recovered.
    
    BulkAdjust now re-enables a client only when it was disabled because it was depleted and the adjustment lifts it back within limits, computed as a set-difference of the production depletedCond predicate and applied through the canonical BulkSetEnable (run after the per-inbound loop, since lockInbound is non-reentrant). Manually-disabled or still-depleted clients stay disabled.
    
    Update now writes the clients.enable column explicitly so re-enabling sticks for inbound-less clients and stops feeding a stale record into node pushes.
  • fix(xray): clean stale routing references when a balancer or outbound is deleted (#5648)
    * feat(xray): reference-cleanup helpers for entity deletion
    
    When an outbound or balancer is deleted on the Xray page, routing rules and
    balancers that reference it must be repaired in the same edit, or the saved
    config breaks the core: a dangling balancerTag stops Router.Init (whole core
    down), a dangling outboundTag black-holes matched traffic at the dispatcher.
    
    Add pure plan*/apply* helpers that compute and apply the cleanup. A rule is
    kept when a destination (outboundTag or balancerTag) remains and dropped when
    none does. Deleting an outbound cascades: emptying a balancer selector removes
    that balancer too, then repairs its rules in one pass against the full removed
    set; fallbackTag and dialerProxy references are cleared and observatories
    re-synced.
    
    * fix(balancers): clean routing rules referencing a deleted balancer
    
    Deleting a balancer left routing rules pointing at its balancerTag. xray-core's
    Router.Init then fails ("balancer <tag> not found"), the core won't restart and
    every inbound drops — the saved config passes CheckXrayConfig (JSON shape only),
    so it breaks only on the next restart.
    
    The delete confirm now lists the affected rules (modified vs removed) next to
    the existing observatory warning and applies planBalancerDeletion's cleanup: a
    rule keeps its outboundTag when present, otherwise the whole rule is dropped.
    Adds the shared DeletionImpactList and refCleanup strings across all 13 locales.
    
    * fix(outbounds): clean rules, balancer selectors and dialerProxy on outbound delete
    
    Deleting an outbound left routing rules pointing at its outboundTag (matched
    traffic black-holed at the dispatcher), plus stale references in balancer
    selectors / fallbackTag and other outbounds' dialerProxy.
    
    The delete confirm now shows planOutboundDeletion's impact and applies the
    cascade: rules keep a remaining balancerTag (else are dropped), the tag is
    pulled from balancer selectors and fallbacks, dialerProxy references are
    cleared, and a balancer whose selector is emptied is removed along with its
    own now-targetless rules.
    
    * refactor(xray): share one rule classifier across preview and apply
    
    Code review flagged that the keep/drop predicate was transcribed twice — in
    ruleImpacts (the delete-modal preview) and in applyCleanup (the mutation) — kept
    in sync only by a parity test. Extract a single classifyRule() that both call,
    so the preview can never disagree with what apply actually does.
    
    Also harden balancersEmptiedBy to skip tagless balancers: an empty/missing tag
    would otherwise enter the removed set as "" and silently drop every other
    tagless balancer (only reachable via a hand-edited config, but a silent data
    loss). And remove observersRemovedByDeletingBalancer, orphaned once BalancersTab
    switched to planBalancerDeletion.
    
    * fix(xray): null-guard reference cleanup against unvalidated configs
    
    The PR review noted that classifyRule and applyCleanup dereferenced rule /
    balancer entries directly, while the sibling propagateOutboundTagRename uses
    optional chaining — because fetchXrayConfig falls back to the unvalidated parsed
    object when Zod validation fails, a stray null in rules / balancers can survive
    into the editor and would throw during the delete preview/apply.
    
    Match that defensive style: classifyRule and balancersEmptiedBy read through
    optional chaining, the balancer loop skips nullish entries, and the dialerProxy
    walk guards the outbound. A delete on a hand-edited config with null entries now
    degrades gracefully instead of throwing.
  • feat(a11y): screen-reader & keyboard accessibility across the panel (#5486) (#5652)
    * feat(a11y): label list, toolbar & dashboard actions for screen readers
    
    Phase 1 of #5486 (Android TalkBack support). Icon-only controls across
    the management surfaces previously announced only their untranslated
    icon name (e.g. "edit", "ellipsis") or nothing at all.
    
    - Add aria-label to icon-only row-action and toolbar buttons across
      inbounds, clients, groups, hosts, nodes and xray
      (outbounds/routing/dns/balancers) lists, plus the dashboard cards.
    - Make clickable bare icons and AntD Card actions keyboard-operable via
      role/tabIndex + Enter/Space (new activateOnKey helper); convert mobile
      dropdown triggers to buttons so they open from the keyboard.
    - Fix the sidebar hamburger's mislabeled aria-label (was the dashboard
      label) and translate previously-hardcoded outbound menu labels.
    
    New i18n keys in all 13 locales: sort, menu.openMenu,
    pages.xray.outbound.moveToTop.
    
    * feat(a11y): label modal, QR and copy/download controls for screen readers
    
    Phase 2 of #5486. Modal and overlay controls relied on tooltips (not a
    reliable accessible name) or were bare clickable icons with no keyboard
    or screen-reader support.
    
    - Add aria-label to copy/QR/download/info icon buttons in the inbound and
      client info modals, sub-links modal, QR panel, backup/log modals, and
      to the bare search/select inputs of the attach/detach client modals.
    - Make click-to-copy QR codes and the IP-log refresh/clear, geofile
      reload and log refresh icons keyboard-operable (role/tabIndex +
      Enter/Space) with translated labels.
    - Label the 2FA code input; drop the QrPanel download-image string
      fallback now that the key exists.
    
    New i18n key in all 13 locales: downloadImage.
    
    * feat(a11y): label form fields and shared form components for screen readers
    
    Phase 3 of #5486. Form controls and shared form widgets were largely
    unlabelled, and several remove controls were not keyboard-operable.
    
    - SettingListItem now ties its title to the control via aria-labelledby,
      giving accessible names to the ~90 settings-tab inputs at once.
    - InputAddon gains button semantics (role/tabIndex/Enter+Space) and an
      ariaLabel prop when used as an interactive remove control.
    - Sparkline charts expose a role="img" summary of their latest values.
    - Add aria-label to add/remove/regenerate icon buttons and bare
      inputs/selects across inbound, client and xray (dns/routing/balancer/
      outbound) forms; make clickable remove icons keyboard-operable; mark
      decorative help/target icons aria-hidden; label the JSON editor,
      date-time clear button, header-map remove, notification select-all and
      remark token chips.
    
    New i18n keys in all 13 locales: regenerate, jsonEditor,
    pages.xray.balancer.{costMatch,costValue,costRegexp}.
    
    * chore(a11y): add eslint-plugin-jsx-a11y harness and fix flagged interactions
    
    Phase 4 of #5486. Adds eslint-plugin-jsx-a11y (recommended ruleset,
    scoped to .tsx) so screen-reader/keyboard regressions fail lint.
    
    - Make the mobile node-card header a proper keyboard disclosure
      (role=button, aria-expanded, Enter/Space activation that ignores
      clicks on the nested action buttons) and drop the now-redundant
      stop-propagation click handlers the linter flagged on card-action
      wrappers in the node, client and inbound mobile cards.
    - Disable jsx-a11y/no-autofocus: the autofocus on the login field and
      modal primary inputs is intentional focus management that helps
      screen-reader and keyboard users land on the right control.
    
    make lint passes with the a11y ruleset enforced.
    
    * feat(a11y): cover remaining deferred spots (settings tabs, sockopt, API docs)
    
    Completes the panel sweep for #5486 by labelling the spots previously
    left out of phases 1-4:
    
    - NotifyTimeField (Telegram notifications): the mode, interval, unit and
      custom-cron inputs now carry aria-labels.
    - The Sockopt toggle in transport options.
    - Settings category tabs in icons-only (mobile) mode now expose the tab
      name as the icon's aria-label instead of the raw icon name.
    - The Swagger API-docs view is wrapped in a labelled region landmark.
    
    New i18n keys in all 13 locales: pages.settings.notifyTime.{interval,unit}.
    
    * feat(a11y): label shared xray form components and remark field
    
    Code review surfaced frontend/src/lib/xray/forms/ — shared form components
    used by the host and inbound JSON forms — which the initial audit missed.
    
    - FinalMaskForm (TCP/UDP final-mask editor): label the icon-only add and
      regenerate buttons and make all six remove icons keyboard-operable
      (role/tabIndex/Enter+Space); adds useTranslation to its sub-components.
    - CustomSockoptList: the remove icon is now keyboard-operable.
    - SniffingFields: aria-label on the otherwise label-less destOverride select.
    - RemarkTemplateField: aria-label on the remark-variable picker button.
    
    New i18n key in all 13 locales: pages.inbounds.sniffingDestOverride.
    
    * feat(a11y): label client info modal and WireGuard config block
    
    After rebasing onto the WireGuard client-config feature, re-apply the
    ClientInfoModal copy/QR/IP-log aria-labels (the modal was restructured
    upstream, so the original labels did not carry over) and label the new
    ConfigBlock component's copy/download/QR actions. ConfigBlock's action
    wrapper keeps its stop-propagation handler (a non-interactive guard for
    the Collapse header) under a scoped jsx-a11y exception.
    
    * fix(frontend): let npm install jsx-a11y under ESLint 10
    
    eslint-plugin-jsx-a11y@6.10.2 declares a peer range that stops at ESLint 9,
    but the panel is on ESLint 10, so `npm ci` aborts with ERESOLVE even though
    the plugin runs fine on ESLint 10 with flat config. Add an npm override so
    jsx-a11y accepts the project's ESLint version. This keeps normal peer
    resolution (recharts' react-is peer still auto-installs) — no global
    legacy-peer-deps and no manual react-is pin needed.
    
    * fix(a11y): size mobile row triggers and move node expand role to chevron
    
    Address automated review on #5652:
    - add size="small" to the inbound/client/node mobile-card "more" dropdown
      triggers so they match the adjacent small Switch and the established
      desktop RowActions pattern.
    - move the node card-head disclosure semantics (role/tabIndex/aria-expanded/
      keyboard) onto the chevron affordance so the expand control is no longer a
      role="button" wrapping the Switch, info button and dropdown. Mouse
      click-anywhere-to-expand is preserved on the header div.
  • fix(clients): hide WireGuard config after detaching the WG inbound
    The client info and QR modals rendered a WireGuard config whenever the
    client still carried leftover WG key material (privateKey / publicKey /
    allowedIPs / preSharedKey / keepAlive), regardless of whether a WireGuard
    inbound was actually attached. After detaching the WG inbound the config
    kept showing, built with an empty endpoint port and public key.
    
    Gate wgConfigText on an attached WireGuard inbound (wgInbound) being
    present, not just isWireguardClient(client), in both ClientInfoModal and
    ClientQrModal.
    
    Also rename the i18n key pages.clients.conf -> config and add the missing
    pages.clients keys (wireguardConfig, config, bulkFlow, bulkFlowNoChange,
    bulkFlowDisable) to all 12 non-English locales so each one matches en-US.
  • feat(wireguard): client config UX, collapsible config card, configurable DNS
    Land the WireGuard client-config UX work on main (the upstream PR #5642
    branch could not be pushed to).
    
    - Reusable collapsible ConfigBlock (copy/download/QR, actions aligned right)
      for the client .conf, used by client info and the public sub page.
    - Correct .conf: canonical PresharedKey casing and DNS sourced from the inbound
      (configurable per-inbound, default 1.1.1.1, 1.0.0.1).
    - Configurable per-inbound DNS for WireGuard (schema + form + backend hint via
      InboundOption.WgDns); inert at the Xray layer.
    - Public sub page now shows the WireGuard config, rebuilt from the share link;
      the Go wireguard:// link carries dns/presharedkey/keepalive for completeness.
    - QR enabled for the wireguard:// link; link rows are compact like other protocols.
    - Client information order is subscription, copy URL, WireGuard config; the
      redundant config tab is removed from the add/edit client modal.
    - Drop the Inbound Information and QR Code row actions for WireGuard inbounds.
  • feat: ldap skip tls verify (#5637)
    * feat(ldap): add InsecureSkipVerify field and tlsConfig helper
    
    Extract the inline TLS config at both LDAPS dial sites (FetchVlessFlags,
    AuthenticateUser) into a tlsConfig(cfg) helper, and add a new
    Config.InsecureSkipVerify bool that flows through to
    tls.Config.InsecureSkipVerify. This unblocks enterprise environments
    (e.g. Microsoft AD CS with internal CAs) where the server certificate
    chain cannot be imported into the system trust store.
    
    Behavior is identical when InsecureSkipVerify is false (the default) -
    pure refactor + plumbing. The helper is unit-testable without a live
    server, which is why it is extracted.
    
    Closes https://github.com/MHSanaei/3x-ui/issues/5538
    
    * feat(settings): add LdapInsecureSkipVerify setting
    
    Plumb the new LDAP skip-TLS-verify toggle through the settings stack:
    - AllSetting struct field (json/form tag: ldapInsecureSkipVerify)
    - defaultValueMap default ("false")
    - GetLdapInsecureSkipVerify() getter
    - ldap_sync_job wiring into ldaputil.Config (FetchVlessFlags path)
    - panel/user.go wiring into ldaputil.Config (AuthenticateUser path;
      the original issue's file list missed this)
    
    Persistence is handled by UpdateAllSetting's reflect loop, matching
    the existing pattern used by ldapUseTLS (no explicit setter).
    
    Closes https://github.com/MHSanaei/3x-ui/issues/5538
    
    * feat(ui): add Skip TLS verification switch in LDAP settings
    
    Wire the new ldapInsecureSkipVerify setting into the hand-written
    frontend model and Zod schema, and render it as a new Switch in
    GeneralTab right under "Use TLS (LDAPS)". The switch is disabled
    when TLS is off (the setting is meaningless without LDAPS) and shows
    an insecure-warning description to make the security implication
    visible to operators.
    
    Also adds a Vitest round-trip test pinning schema acceptance and
    model default-to-false behavior.
    
    Closes https://github.com/MHSanaei/3x-ui/issues/5538
    
    * chore(i18n): add Skip TLS verification strings to all locales
    
    Add pages.settings.ldap.skipTlsVerify and skipTlsVerifyDesc to all 13
    backend-served translation files, matching the existing repo
    convention of keeping LDAP keys present in every locale (en-US, fa-IR,
    ru-RU, zh-CN, zh-TW, pt-BR, ar-EG, uk-UA, id-ID, tr-TR, vi-VN, ja-JP,
    es-ES). No translation-parity test exists in CI, but every other
    LDAP key is replicated across all files, so this keeps the
    invariant intact.
    
    Closes https://github.com/MHSanaei/3x-ui/issues/5538
    
    * chore(codegen): regenerate frontend artifacts
    
    Regenerate frontend/src/generated/{zod,types,schemas,examples}.ts
    and frontend/public/openapi.json via `npm run gen` to reflect the
    new ldapInsecureSkipVerify field. The codegen CI job runs
    `git diff --exit-code` on these files; failing to commit them would
    break the build.
    
    Closes https://github.com/MHSanaei/3x-ui/issues/5538
  • fix(sync): mark node dirty inside the mutation transaction (atomic ConfigDirty) (#5611)
    * fix(sync): mark node dirty inside the mutation transaction
    
    ConfigDirty is currently set by MarkNodeDirty AFTER the mutation, on a
    separate DB handle outside the mutation's transaction. A crash or error
    between the committed change and the mark leaves a committed config
    change that never reconciles to the node (silent drift). Add
    MarkNodeDirtyTx(tx, id) and call it inside each mutation's transaction so
    the dirty mark commits atomically with the change.
    
    * fix(test): initialize DB in TestResolveInboundAddress and group gorm import
    
    Two CI failures on this branch:
    
    - race (-shuffle=on): TestResolveInboundAddress reaches resolveInboundAddress -> configuredPublicHost -> GetSubDomain, which reads the global DB. The test never initialized one, relying on another sub-package test to do so first; under shuffle it ran first and nil-dereferenced gorm. Call initSubDB(t) so it is self-sufficient (empty DB yields an empty subDomain, so the subscriber-host fallback still holds).
    
    - golangci goimports: gorm.io/gorm was grouped with the github.com/mhsanaei/3x-ui local imports in node_dirty_test.go. Move it into the third-party group.
  • fix(settings): require re-2FA confirmation for sensitive setting changes (#5610)
    * fix(settings): require server-side 2fa for sensitive changes
    
    * fix(lint): group third-party imports separately from local (goimports)
    
    golangci-lint goimports flagged setting.go and setting_security_test.go because xlzd/gotp and gorm.io/gorm were mixed into the github.com/mhsanaei/3x-ui local-prefix group. Move them into the third-party group so the local imports stand alone.
  • feat(balancers): tabbed Observatory/Burst Observatory form (#5627)
    * feat(balancers): tabbed Observatory/Burst form replacing raw JSON
    
    Replace the raw JSON editor for the Observatory / Burst Observatory sections
    with a proper Ant Design form, and split the Balancers page into two sub-tabs:
    "Balancer Settings" (the existing table) and "Observatory".
    
    Observers stay fully auto-managed by balancer strategy through the existing
    syncObservatories logic: users edit only the tunable probe fields, the
    subjectSelector is shown read-only since it is derived from the balancers, and
    deleting the last balancer that needs an observer now warns in the confirm
    dialog that the observer will be removed too. Overlapping selectors keep an
    observer alive while any balancer still references it.
    
    Also add the previously missing pingConfig.httpMethod field (HEAD/GET) and
    translations for the new strings across all 13 locales.
    
    * refactor(balancers): tighten httpMethod typing and align connectivity default
    
    Address automated review feedback on the Observatory form:
    - Use the ObservatoryHttpMethodSchema enum for pingConfig.httpMethod instead of
      a free-form z.string(), and drive the HTTP method Select from its options.
      Removes the previously dead enum export and the duplicate local list, and
      types the field as 'HEAD' | 'GET'.
    - Align the schema's connectivity default with DEFAULT_BURST_OBSERVATORY (the
      hicloud URL) so it matches what burst observers are actually created with.
    
    No behavior change.
  • Bump minimum eligible Xray version
    Update Xray release filtering to only include versions at or above v26.6.27 (previously v26.4.25). Also mark `google.golang.org/protobuf` as a direct dependency in `go.mod` by removing the `// indirect` annotation.
  • fix(wireguard): allocate client IPs in the existing peer subnet
    defaultWireguardClients always allocated new tunnel addresses from the
    hardcoded 10.0.0.0/24 base, so a legacy or migrated inbound whose peers
    live in a different subnet (e.g. 172.16.0.0/24) got new clients in an
    unrelated, unroutable range. Derive the allocation base from the existing
    peers' /24 and fall back to 10.0.0.0/24 only when there are none.
  • feat(wireguard): multi-client support
    WireGuard inbounds now manage per-client peers using xray-core's native WireGuard users (AddUser/RemoveUser). Each client lives in settings.clients (canonical, like every other protocol) and is projected to peers[] only when emitting the xray config, at level 0 so the dispatcher's per-user traffic/online counters work with no extra plumbing.
    
    Backend: internal/util/wireguard gains KeyToHex (base64 to hex for the gRPC path), PublicKeyFromPrivate and GenerateWireguardPSK; xray/api.go builds a wireguard account in AddUser with hex keys (RemoveUser already worked); client CRUD generates a keypair and allocates a unique tunnel address per client and never rotates keys on edit; an idempotent migration converts legacy settings.peers into managed clients; WireGuard is included in the raw subscription.
    
    Frontend: WireGuard in the add-client modal with keys on the credential tab, client schema, per-client QR/link/.conf, inbound form reduced to server settings; i18n added across 13 locales.
    
    Fix: guard the settings[clients] assertion in add/update so a legacy WireGuard inbound stored without a clients key no longer panics.
  • feat(groups): reset group traffic without touching client counters
    The group page shows traffic counting per group, but the only reset
    available zeroed every member client's up/down counters (and their
    quotas) via bulkResetTraffic. Group traffic is a derived sum of client
    traffic, so zeroing the group display previously required mutating the
    clients themselves.
    
    Add a display-only baseline: ClientGroup gains reset_up/reset_down
    columns (additive, handled by AutoMigrate). ResetGroupTraffic snapshots
    the group's current up/down sum into the baseline, and ListGroups now
    reports max(0, sum - baseline). Client counters are left untouched and
    no Xray restart is triggered. A new POST /panel/api/clients/groups/
    resetTraffic endpoint drives it, creating the client_groups row when the
    group exists only as a derived label.
    
    The groups page action now calls the new endpoint; confirm/success
    strings updated across all 13 locales to reflect group-only semantics.
  • style: adopt golangci-lint v2 and resolve all findings
    Add .golangci.yml (v2): the standard linters plus bodyclose, errorlint, noctx, misspell, rowserrcheck, sqlclosecheck, unconvert, usestdlibvars, with gofumpt + goimports formatters. Enable the std-error-handling exclusion preset for idiomatic Close/Remove/Setenv ignores; scope-exclude SA1019 (parser.ParseDir in tools/openapigen) and ST1005 (intentional capitalized user-facing error copy that tests assert verbatim). No inline nolint directives were introduced.
    
    Resolve all 217 findings behavior-preserving: gofumpt/goimports formatting, explicit blank assignment on intentionally ignored errors, errors.Is/errors.As and %w wrapping, context-aware stdlib calls (CommandContext/QueryContext/NewRequestWithContext/Dialer), staticcheck simplifications, removed redundant conversions, http.StatusOK and http.MethodGet, inlined the go:fix intPtr helper, and deferred sql rows Close. Add a golangci CI job mirroring the existing Go jobs.
  • fix(inbound): convert legacy externalProxy to hosts on import
    An inbound exported from a build that predated the hosts table carries
    its external proxies inline in streamSettings.externalProxy. The startup
    migration that converts those to host rows runs once and is gated off
    afterwards, so it never sees a freshly imported inbound, leaving its
    external proxies stranded in streamSettings (never surfaced as Hosts).
    
    Extract the migration's per-inbound conversion into a shared
    database.CreateHostsFromExternalProxy and run it inside the AddInbound
    transaction. No-op for inbounds without externalProxy (everything the
    current UI builds), so it only fires on such imports.
  • feat(backup): prefix backup filenames with date and time (#5606)
    * feat(backup): add YYYY-MM-DD_ date prefix to backup filenames
    
    Refs #5584
    
    * feat(backup): prefix backup filenames with date and time
    
    * fix(backup): put host before date in backup filename
    
    Backup filenames now read {host}_{date}{ext} (e.g. panel.example.com_2026-06-27_000000.db) instead of {date}_{host}{ext}, so files group by server first then sort chronologically within each server.
  • feat(inbounds): apply remark template to Export all inbound links
    Export-all now renders links through the subscription engine via a new GET /panel/api/inbounds/allLinks endpoint, so the configured remark template (name-only display part) is applied per client -- matching the client info/QR pages. Previously it generated links client-side with a hardcoded inbound-email remark.
    
    Host-aware: managed Host endpoints win over the plain link, so HOST and per-host variants render; duplicate client JSON entries are deduped by email and the list is scoped to the logged-in user.
  • fix(settings): normalize API token timestamps (#5599)
    * fix(settings): normalize API token timestamps
    
    * refactor(api-token): share timestamp threshold
    
    ---------
    
    Co-authored-by: Tomilla <5007859+Tomilla@users.noreply.github.com>
  • feat(reality): add live REALITY target scanner with IP/CIDR discovery
    Replace the static reality-targets list with a server-side TLS 1.3 probe that checks TLS 1.3 + HTTP/2 + X25519 + a trusted certificate.
    
    - Single-domain validate auto-fills target and serverNames from the cert SAN
    - Discovery scans an IP/CIDR without SNI to find new targets from their certificates, deduped and ranked by feasibility then latency, private-IP guarded via netsafe
    - New endpoints scanRealityTarget and scanRealityTargets with RealityScanResult, plus openapigen and api-docs entries
    - Add scanner strings to all 13 locales
    - Replace deprecated AntD Alert message prop with title across the panel
  • feat(sidebar): add documentation link button
    Add a Docs button next to the donate button in the sidebar and mobile drawer linking to https://docs.sanaei.dev/, with menu.docs translations across all 13 languages.
  • feat(update): allow opting into the dev channel from a stable build
    The panel version button opened the GitHub releases page on a stable, up-to-date build, and the dev-channel toggle only rendered on dev builds, so there was no in-panel path from stable to dev. Drop the IsDevBuild() guard in devChannelActive (the toggle alone drives the channel now), always open the update modal instead of releases, and always render the Dev channel switch.
  • feat(logs): add auto-update toggle to Access Logs and Logs viewers
    A checkbox in both the Xray Access Logs and panel Logs modals polls the
    existing refresh every 5s while enabled, respecting the current row count,
    level/filter, and Direct/Blocked/Proxy selections. The poller tears down on
    close or untoggle. Adds a localized pages.index.autoUpdate key to all 13 locales.
  • chore: bump deps and modernize test loops
    - release.yml: download-artifact v7 -> v8
    - frontend: i18next 26.3.1 -> 26.3.2, qs 6.15.2 -> 6.15.3
    - go.mod: consolidate indirect requires (go mod tidy)
    - tests: adopt Go 1.22 range-over-int loops
  • feat(logs): label the Xray access-log viewer 'Access Logs' across all languages
    Distinguishes the access-log modal from the panel 'Logs' viewer it shares a
    title with. Adds the accessLogs key to all 13 translation files.
  • perf(metrics): tiered rollup history (7d at ~1.5MB) and cleaner ranges
    Replace the flat 48h@2s ring buffer with a 3-tier rollup ladder (2s/1h, 1m/48h, 10m/7d). A sample feeds every tier and rolls up into progressively coarser averages, so per-metric footprint drops from ~21MB to ~1.5MB (measured, 16 system metrics) while extending the range from 48h to 7 days. aggregate() picks the finest tier covering the requested span; a pre-tier flat gob is migrated by replaying its samples through the rollup.
    
    Tidy the dashboard ranges to a professional ladder: 2m, 1h, 3h, 6h, 12h, 24h, 2d, 7d (drop the irregular 2h/5h, the redundant 30m, and the excessive 30d). The allow-list keeps bucket 30 because the node history panel uses it.
    
    Add an initial FreeOSMemory about 60s after boot to reclaim the startup and metric-restore peak instead of waiting for the periodic release. Cover the rollup, tier selection, round-trip, and footprint with tests.
  • perf(memory): report real RSS and cut footprint via GOGC + periodic release
    The Usage card showed runtime.MemStats.Sys, a never-shrinking high-water mark of reserved address space that also counts memory already returned to the OS, so it overstated real usage (e.g. ~300 MB on an idle 1-client server). Report process RSS instead so the number matches the OS and drops as memory is freed.
    
    Replace the auto GOMEMLIMIT that targeted ~90 percent of total system RAM (a near no-op while the heap sits far below the limit, and a GC-thrash risk on small/shared VPS per go.dev/doc/gc-guide) with: a lower default GOGC (XUI_GOGC, default 75), a periodic debug.FreeOSMemory job (XUI_MEMORY_RELEASE_INTERVAL, default 10m, 0 disables), and a soft limit applied only from an explicit budget (GOMEMLIMIT, XUI_MEMORY_LIMIT, or a real cgroup cap at 90 percent).
  • fix(node): import per-client traffic history on first sync of a node-hosted inbound
    On the first sync of a node-hosted inbound, the central inbound adopted the
    node's full lifetime counter but every client_traffics row was seeded at 0 (with
    the delta baseline set to the node's current counter). So adding or migrating a
    node that already had traffic kept the inbound total correct while every
    per-client counter restarted from zero, and the master under-reported per-client
    usage by the entire pre-attach history.
    
    Seed a new client_traffics row from the node counter only when the inbound was
    created during the same sync (a genuine node-add / inbound re-import); a client
    reappearing under a pre-existing inbound still seeds 0, preserving the ghost
    protection in TestGhostData_NoPhantomTraffic. The seed is additionally gated on
    the delete tombstone so a just-deleted client cannot be resurrected if its
    inbound is recreated. Baseline still equals the seeded value, so the next sync
    delta is 0 and no traffic is double counted.
    
    Adds TestNodeAdd_ImportsClientHistoryWithNewInbound and
    TestNodeAdd_TombstonedClientNotResurrected.
  • feat(clients): add bulk enable/disable and move selection actions into More menu
    Add bulkEnable/bulkDisable named endpoints backed by a shared internal impl, and consolidate the per-selection actions (attach, detach, add to group, ungroup, enable, disable, adjust, sub links) into the clients table's More dropdown so the toolbar only shows the selection count and delete. Translate the new enable/disable confirm dialogs and toasts across all 13 locales.
  • feat(panel): surface dev-build version in UI, bot, and CLI
    A dev build now shows its `dev+<commit>` identity instead of a misleading stable-looking version in the sidebar badge, dashboard card, update modal, Telegram status report, startup log, and `x-ui -v`. Adds a shared formatPanelVersion helper (single v prefix; dev labels shown verbatim) and fixes the mobile-tag double-v.
    
    Renames the version getters for clarity: config.GetVersion to GetBaseVersion (raw embedded version), config.GetReportedVersion to GetPanelVersion (advertised/displayed), and the xray process GetVersion to GetXrayVersion.
  • fix(nodes): report dev builds as dev+<commit> so updated nodes aren't flagged stale
    A node's status reported config.GetVersion() (3.4.0) even on a dev build, so the master compared it against its own dev latestVersion (dev+<sha>) and every node showed 'update available'. Nodes on a dev build now report dev+<short commit>, matching the master's format, so a node on the current dev commit compares as up to date.
  • feat(nodes): add Dev channel option to node panel updates
    The node update confirm dialog now offers a 'Dev channel (latest commit)' choice. The dev flag threads master -> nodes/updatePanel -> UpdatePanels -> remote.UpdatePanel -> the node's updatePanel endpoint, which calls StartUpdateChannel(dev) to install the rolling dev-latest build. With no dev flag the node keeps following its own channel setting.
  • fix(web): remove deleted multi-inbound client from runtime regardless of shared email (#5543)
    DelInboundClientByEmail gated the runtime RemoveUser/DeleteUser (and its
    push-plan resolution) on !emailShared. But Xray users are keyed by inbound
    tag + email, so a client attached to two inbounds left its user live in the
    running Xray of every inbound where the email was still shared by a sibling
    inbound, until an Xray restart.
    
    Decouple the per-inbound runtime removal from emailShared; keep emailShared
    only for preserving the shared email-keyed client_traffics/IP rows.
  • feat(web): vless encryption new modes (#5517)
    * feat(web): add vless encryption new modes
    
    * feat(web): add translations for vless encryption modes
    
    * feat(translation): bring "vlessAuthX25519" and "vlessAuthMlkem768" to general form
  • fix(web): serve panel SPA routes from NoRoute (#5536)
    * fix(web): serve panel SPA routes from NoRoute
    
    Return the React shell for authenticated panel document routes that are not explicitly registered in Gin, such as /panel/hosts. Keep API, CSRF, static-file, method, and Accept exclusions so API misses remain 404 and auth semantics stay unchanged.
    
    * fix(web): remove unreachable panel path guard
    
    The panel path is always built by appending /panel, so it can never be empty.
    Remove the redundant fallback branch without changing SPA routing behavior.
    
    Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
    
    * fix(web): allowlist static-asset extensions in SPA fallback
    
    The blanket path.Ext check rejected any panel route whose last segment contained a dot, which would reintroduce the refresh 404 for a future client route carrying a dotted parameter (version, domain, or email-like value). Restrict the static-asset exclusion to a known, case-insensitive extension allowlist and add predicate regression cases.
  • fix(update): read setUpdateChannel body as form field, not JSON
    The panel's axios layer posts application/x-www-form-urlencoded, so the dev-channel toggle sent dev=true and ShouldBindJSON failed with 'invalid character d'. Parse c.PostForm("dev") to match the codebase's form-encoded POST convention.
  • feat(update): add rolling dev update channel for per-commit builds
    Adds an opt-in Dev channel so panels running CI per-commit builds can self-update to the latest commit, mirroring the stable online-update flow.
    
    CI publishes/overwrites a single fixed-tag pre-release (dev-latest), force-moved to the newest main commit and marked --latest=false so releases/latest stays the stable tag. Builds stamp the short commit via -ldflags; the panel compares the running commit to the dev release commit to detect an update, and update.sh honors XUI_UPDATE_TAG to install from that tag. Linux/systemd only.
  • fix(tgbot): reload bot on settings save so a new token takes effect without a panel restart
    The Telegram bot was only started at panel boot, so saving a token or toggling tgBotEnable persisted to the DB but never reached the running bot until a full restart, making it look like the token did not save (issue #5539). The settings/update controller now reconciles the bot the same way panelOutbound reconciles Xray: when tgBotEnable, the token, chat ID, or API server change, it stops/(re)starts the bot and updates the event-bus subscription.
  • fix(sub): drive display remarks from the template and split multi-host subpage links
    Unify remark generation around the Remark Template. Display contexts (Clients-page QR/Info modals and the HTML sub info page) now render the template name-only client/identity part instead of a hardcoded fallback; the subscription body keeps the full template on a client first link and name-only thereafter. The default template gains the email token so the client email shows by default again (#5532).
    
    BuildPageData now splits each multi-link entry (one link per host of an inbound) into a separate row, so the sub page no longer collapses several host links onto a single mangled line. QR captions on the Clients QR modal and the sub page reuse the link fragment remark.
  • fix(backup): name Telegram backups after webDomain/IP instead of x-ui
    The bot's ServerService is a separate instance whose mutex-guarded LastStatus is never populated (only RefreshStatus fills it, which the bot never calls), so backupHost's public-IP fallback never fired and bot backups collapsed to x-ui when no webDomain was set.
    
    Resolve the public IP directly via a new mutex-guarded resolvePublicIPs helper (extracted from GetStatus and shared with it) so the bot path gets a real address. Panel downloads keep using the browser request host; the Telegram bot falls back to webDomain then public IP.
  • fix(flow): restore XTLS Vision when an inbound becomes flow-eligible (#5520)
    * fix(flow): restore XTLS Vision when an inbound becomes flow-eligible
    
    clientWithInboundFlow strips Vision from a VLESS client whenever the target
    inbound is not flow-eligible at client-write time — e.g. an XHTTP inbound
    before its vlessenc (ML-KEM) encryption is set, or a client attached to such
    an inbound. Nothing restored the flow once the inbound later became eligible:
    an inbound edit stores its settings verbatim and never re-gates the clients.
    So enabling encryption on an existing XHTTP inbound left every client without
    flow, and the generated configs, share links and subscriptions silently
    dropped flow=xtls-rprx-vision — most visibly on node inbounds and on any
    inbound where encryption was turned on after the clients existed.
    
    Restore the flow at the two points where an inbound can become eligible:
    
    - UpdateInbound: after the new stream/settings are final, re-add Vision to
      clients that currently carry no flow but whose intended flow (their
      flow_override on a sibling inbound, via EffectiveFlowByEmail) is Vision —
      only when the inbound is now flow-eligible.
    - MigrationRestoreVisionFlow: a one-time, idempotent boot migration that
      applies the same repair to existing installs and refreshes flow_override
      via SyncInbound.
    
    The repair is conservative: it never invents a flow for a client that has
    none anywhere, never overwrites an explicit flow, and is a no-op on healthy
    installs. Adds EffectiveFlowByEmail and a unit test covering keep/skip/no-op
    cases.
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
    
    * style(flow): serialize restored settings with MarshalIndent
    
    Match the indented JSON used by the adjacent timestamp block in UpdateInbound
    and the externalProxy migration, so a restored inbound's settings column keeps
    the same multi-line format as everything else (review nit on #5520).
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
    
    * perf(flow): batch the intended-flow lookup and run it on the active tx
    
    restoreVisionFlowForEligibleInbound resolved each empty-flow client's intended
    flow with EffectiveFlowByEmail, which issued two queries per client
    (GetRecordByEmail + EffectiveFlow). A client that genuinely uses no Vision keeps
    an empty flow forever, so it was re-queried on every UpdateInbound and every
    boot — O(clients) queries per save on a Reality/TCP or XHTTP+vlessenc inbound
    carrying many non-Vision clients, executed inside the serialized writer
    transaction.
    
    Replace it with EffectiveFlowsByEmails: collect every empty-flow email first and
    resolve them in a single batched join over client_inbounds + clients (lowest
    inbound_id wins, same rule as before), chunked for the SQLite bind-var limit.
    
    Also thread the active tx through restoreVisionFlowForEligibleInbound so the
    read runs on the writer's own connection while it holds the lock instead of a
    separate pooled connection (UpdateInbound passes its tx; the boot migration
    passes nil → GetDB() as before).
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
    
    ---------
    
    Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
  • feat(clients): bulk-set XTLS flow from the Adjust dialog (#5524)
    * feat(clients): bulk-set XTLS flow from the Adjust dialog
    
    Add a "Set flow" dropdown to the bulk Adjust dialog so an admin can set or
    clear the XTLS flow on all selected clients at once, alongside the existing
    days/traffic bumps. Empty by default (no effect on save); "Disable" clears
    flow, and the two vision values mirror the per-client credential tab.
    
    Flow rides the existing inbound-JSON -> SyncInbound path (ClientRecord.Flow +
    client_inbounds.flow_override), so no new endpoint, DB column, or migration.
    Setting a vision flow is gated by inboundCanEnableTlsFlow: ineligible inbounds
    are left untouched and reported as skipped; clearing is always allowed. A real
    flow change requests an xray restart (local) or a node reconcile (remote).
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
    
    * fix(clients): keep days/traffic write when bulk flow is ineligible
    
    Address review on the bulk-flow-adjust PR:
    
    - Blocking: a client adjusted with both a days/traffic delta and a flow
      directive on a flow-ineligible inbound had the flow-ineligibility recorded
      into the same skip set that gates the ClientTraffic write, so the inbound
      JSON / ClientRecord advanced but ClientTraffic did not — divergent stores,
      and the client misreported as skipped. Track flow ineligibility in its own
      map (bulkInboundAdjustResult.flowIneligible) so it only feeds the final
      Skipped report and never suppresses the expiry/total persistence.
    - Drop the broad delete(skippedReasons, email): flow reasons no longer enter
      skippedReasons, so honoring a flow can no longer erase an unrelated skip
      reason (unlimited expiry, a real persistence error on another inbound).
    - Drop the inline comment block from ClientBulkAdjustModal.tsx (file had none);
      move the whitelist-sync note next to bulkFlowAllowed, the source of truth.
    - Document the optional flow field in the bulkAdjust API-docs example
      (endpoints.ts) and regenerate openapi.json.
    - Add a regression test covering days+flow on an ineligible inbound.
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
    
    ---------
    
    Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
  • feat(sub): add Incy client integration and routing tab
    Add an Incy quick-import button (incy://add) to the Android and iOS app menus on the subscription page, and a new Incy settings tab with routing enable + rules. Incy routing is delivered by injecting an incy://routing/onadd line into the raw subscription body, avoiding a collision with Happ's Routing header. Includes backend settings, regenerated OpenAPI/zod schemas, and translations for all locales.
  • feat(xhttp): support sessionID* rename + sessionIDTable/Length (xray v26.6.22) (#5506)
    * feat(xhttp): support sessionID* rename + sessionIDTable/Length (xray v26.6.22)
    
    xray-core v26.6.22 (PR #6258) renamed the XHTTP session config keys
    sessionPlacement/sessionKey to sessionIDPlacement/sessionIDKey (no fallback
    kept in core) and added sessionIDTable (predefined charset name or literal
    ASCII) and sessionIDLength (range, e.g. 16-32, lower bound > 0).
    
    Panel changes:
    - Schema (xhttp.ts): rename the two keys, add sessionIDTable/sessionIDLength,
      and a z.preprocess that lifts legacy keys off stored configs so an upgraded
      panel never silently drops a saved session setting.
    - Wire normalize + share-link build/parse: rename keys, emit the two new
      fields, and accept legacy sessionPlacement/sessionKey from old share links.
    - Inbound + outbound XHTTP forms: rename field paths, add a sessionIDTable
      autocomplete (9 predefined tables + free ASCII) and a sessionIDLength range
      input shown only when a table is set, with light client validation (ASCII
      table, length min > 0; xray enforces the room-size minimum server-side).
    - Subscription (service.go) and Clash (clash_service.go) builders: emit the
      renamed + new keys, with a legacy fallback for not-yet-resaved inbounds.
    - Locales: add sessionIDTable/sessionIDLength labels + hints in all 13 files.
    
    Two sibling v26.6.22 XHTTP commits need no panel change and are covered by the
    core bump alone: #6332 (XHTTP/3 closes QUIC/UDP) and #6320 (udpHop honors the
    existing dialerProxy).
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
    
    * test(xhttp): add Session ID Table to inbound form-blocks snapshot
    
    The new sessionIDTable input renders by default in the inbound XHTTP form, so
    its label joins the field-structure snapshot. sessionIDLength stays conditional
    (only shown when a table is set), so it does not appear here.
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
    
    * fix(xhttp): migrate legacy session keys in the running xray config
    
    The Zod preprocess plus the subscription/Clash fallbacks only covered the
    panel UI and share-link output. The config handed to the running xray-core
    process is built from the raw stored streamSettings in GetXrayConfig, which
    did not rewrite the renamed XHTTP session keys — so a pre-upgrade inbound (or
    template outbound) stored with a non-default sessionPlacement was emitted
    unchanged and dropped by xray-core v26.6.22, until the admin re-saved it.
    
    Lift sessionPlacement/sessionKey onto sessionIDPlacement/sessionIDKey at
    config-generation time, in the existing inbound stream-rewrite block (next to
    the tls/reality/externalProxy handling) and across template outbounds. The
    lift is idempotent and leaves unchanged configs byte-identical so the
    hot-reload diff never sees a spurious change.
    
    Also tighten validateSessionIDLength to reject an inverted range (e.g. 32-16)
    in addition to the existing lower-bound > 0 check.
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
    
    * fix(xray): avoid summed-capacity allocation in mergeSubscriptionOutbounds
    
    CodeQL go/allocation-size-overflow flagged the pre-sized make() whose
    capacity was a sum of three slice lengths. Grow the slice via append on
    a nil slice instead; same result, no overflow-prone capacity expression.
  • refactor(wireguard): drop removed workers field (xray v26.6.22) (#5509)
    * v3.4.0
    
    * refactor(wireguard): drop removed `workers` field (xray v26.6.22)
    
    xray-core v26.6.22 (PR #6287) removed the WireGuard `workers` (num_workers)
    config field; the engine now relies on wireguard-go's internal worker
    fallback and no longer reads it. Remove it from the panel so it stops
    emitting a key xray ignores.
    
    Removed from the inbound/outbound/outbound-form WireGuard schemas, both
    WireGuard forms, the outbound form adapter (both directions) and defaults,
    the two affected tests, and the `workers` label in all 13 locales. Existing
    configs that still carry workers are simply dropped on parse — no migration
    needed since the field had no runtime effect.
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
    
    * Update version
    
    ---------
    
    Co-authored-by: MHSanaei <ho3ein.sanaei@gmail.com>
    Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>