Commit Graph
100 Commits
  • docs(readme): revamp README and sync all translations
    Rewrite the five translated READMEs (fa, ar, zh, es, ru) to match the overhauled English README: centered badge layout plus Features, Screenshots, Supported Platforms, Database/Docker, Environment Variables, Supported Languages, and Contributing sections. Add Windows to supported platforms and a fallback feature (multiple protocols on one port). Refresh the referenced screenshots.
  • fix(clients): keep Add Client modal in viewport with internal scroll
    Open the modal near the top (top: 20) and let the body scroll internally (maxHeight + overflowY auto, overflowX hidden) so the tall vertical-layout form no longer leaves a large gap above and runs off the bottom.
  • fix(xray): clear dirty state after saving unchanged config
    Editing an outbound and re-saving it without real changes left the top Save button stuck enabled, and clicking it never cleared it. The form re-normalizes values into deeply-equal config, so react-query keeps the same configQuery.data reference on refetch and the seed effect that resets the dirty baseline never re-runs. Advance the baseline to the persisted value in saveMut.onSuccess instead of relying solely on the refetch.
  • feat(outbounds): pick dialerProxy from other outbound tags for proxy chaining
    Turn the outbound sockopt dialerProxy free-text input into a searchable Select populated with the other outbound tags, so users can build a proxy chain (route one outbound through another) without typing tags by hand. The list excludes the current outbound, so self-reference cycles cannot be selected. A tooltip and placeholder explain the chaining concept. Adds dialerProxyPlaceholder and dialerProxyHint to all 13 locales.
    
    Closes #4446
  • chore(generated): sync node types/zod with TLS verification fields (#4757)
    Regenerated frontend types from the model.Node change in the previous commit (adds tlsVerifyMode and pinnedCertSha256).
  • feat(nodes): add per-node TLS verification mode for self-signed certs (#4757)
    Adds a per-node TLS verification mode to the Add/Edit Node dialog so the panel can reach nodes that serve HTTPS with a self-signed certificate:
    
    - verify (default): normal CA validation.
    - skip: InsecureSkipVerify, with a clear UI warning that it drops MITM protection.
    - pin: validates the leaf certificate's SHA-256 (base64 or hex) via VerifyConnection while bypassing the default chain/name check — keeps MITM protection for self-signed certs, the secure alternative to skip.
    
    New Node model fields tlsVerifyMode + pinnedCertSha256 (gorm auto-migrated). Probe() selects the HTTP client per node via nodeHTTPClientFor, keeping the SSRF-guarded dialer. A new POST /panel/api/nodes/certFingerprint endpoint (FetchCertFingerprint) lets the UI fetch and pin the node's current certificate in one click. Endpoint documented in api-docs/openapi; i18n added across all locales. Verified end-to-end in Docker (verify rejects, skip bypasses, fetch matches, pin accepts correct / rejects wrong).
  • feat(inbounds): support Unix domain socket path in Listen field (#4429)
    UDS listen already worked for proxying (the listen string is passed to xray verbatim and port 0 is accepted), and the Go sub/link layer already ignores the bind listen. The only gap was the frontend resolveAddr, which would put a socket-path listen into share/sub links (e.g. vless://uuid@/run/xray/x.sock:0). resolveAddr now treats a path-style listen (starting with / or @) as having no client-reachable address and falls back to hostOverride/hostname. Adds a test and a Listen-field help hint across all locales.
  • feat(x-ui.sh): support Cloudflare API Token for DNS SSL (menu 20) (#4595)
    Menu 20 only exported CF_Key/CF_Email, so a restricted Cloudflare API Token was misread as a Global Key and acme.sh failed with 'invalid domain'. Add a token-or-global-key prompt (default token): an API Token exports CF_Token, the Global Key keeps the previous CF_Key + CF_Email behavior. Also stop echoing the key/token value to the debug log.
  • fix(fallbacks): allow free-form dest entries for external servers (#4748)
    Since v3.1.0 every fallback row had to reference a panel inbound via childId, so rows with only a free-form dest (e.g. 8080 or 127.0.0.1:8080 to an external Nginx) were silently dropped at three layers: the frontend save filter, the backend SetByMaster guard, and BuildFallbacksJSON. A row is now valid when it has a child OR an explicit dest; self-references normalize to childId 0, and BuildFallbacksJSON prefers an explicit dest (also fixing rows whose child was deleted). UI gains allowClear on the child picker; help text updated across all locales. Verified end-to-end in Docker: a free-form dest fallback now persists and is injected into the live xray config. Refs #4554, #4639.
  • fix(raw): complete the HTTP header section for inbound and outbound
    Align both raw (TCP) transport forms with the Xray docs: request {version, method, path, headers} + response {version, status, reason, headers}. The outbound form was missing the request.path input, so panel-created outbounds were stuck on GET / and could not match a custom inbound path; add it with the same comma-separated array handling as the inbound. Also drop a stale inbound comment that claimed xray-core ignores the inbound request object, which contradicts both the code and the docs (request and response must match on both sides).
  • fix(x-ui.sh): preserve 2FA on credential reset (#4758)
    Go's flag package parses '-resetTwoFactor false' as '-resetTwoFactor=true' with a dangling positional 'false', so two-factor auth was always wiped on username/password reset regardless of the prompt answer. Omit the flag in the preserve branch (default is false) and use '-resetTwoFactor=true' in the disable branch.
  • fix(inbounds): allow port 0 for UDS inbounds (#4783)
    Unix Domain Socket inbounds (listen path starting with /) use port 0, which xray-core ignores. Validation was hard-locked to a minimum of 1 in three places: the shared Zod PortSchema, the AntD InputNumber, and the Go Inbound model tag. Adds an InboundPortSchema (min 0) for the inbound form/API schemas, makes the port InputNumber min UDS-aware, and relaxes the Inbound model validate tag to gte=0. PortSchema and the Node model stay min 1.
  • fix(warp): persist client_id so WARP outbound gets reserved bytes (#4781)
    RegWarp now stores config.client_id from the Cloudflare registration, and WarpModal sources the reserved bytes from the live config response (falling back to stored creds). Previously reservedFor read an always-missing client_id, producing an empty reserved array.
  • feat(x-ui.sh): add PostgreSQL management menu
    Add a self-contained 'PostgreSQL Management' submenu (main-menu option 27) so the panel can be set up and migrated without re-running the remote install script:
    
    - Install PostgreSQL locally (server + client tools + dedicated xui user/db), ported from install.sh so x-ui.sh stays standalone
    
    - Migrate SQLite to PostgreSQL via 'x-ui migrate-db', then write XUI_DB_TYPE/XUI_DB_DSN to the service env file and restart the panel; client tools are ensured first so in-panel backup/restore works for local and external databases
    
    - Service control: status (clusters + port 5432), start, stop, restart, enable autostart, view log, with auto-detected cluster version
  • fix(nodes): sum client traffic across nodes instead of overwriting
    A client shared across multiple nodes has a single email-keyed client_traffics row, but each node reports its cumulative up/down. setRemoteTrafficLocked overwrote the row with one node's cumulative, so non-owning nodes hit the create branch and OnConflict-DoNothing, silently dropping their traffic and under-counting the client.
    
    Make the shared row a pure accumulator (like the local path): a new node_client_traffics(node_id, email) baseline table stores each node's last cumulative; the node path converts cumulative to a per-node delta (clamped to the post-reset value on a negative delta) and does up = up + delta. First observation seeds the baseline and adds 0 so upgrades and newly-shared clients are not double-counted. Create-vs-accumulate now keys off global email existence. Baselines are cleaned in DelClientStat, the node sweeps, and NodeService.Delete.
  • fix(hysteria): use pinSHA256 for pinned cert and emit ech in share links
    Hysteria links now carry the pinned peer cert under the hysteria2-standard pinSHA256 key instead of pcs (frontend genHysteriaLink + outbound importer round-trip), and the Go subscription generator emits ech from echConfigList. Also drops the dead allowInsecure guard in genHysteriaLink, which read a field that does not exist on TlsClientSettings.
  • fix(sub): source Userinfo total/expiry from client config in multi-node (#4645)
    The Subscription-Userinfo header read total/expiry from client_traffics, but in a multi-node setup the master's node sync overwrites those with the node snapshot's zeros, so the header reported total=0; expire=0 even though the panel UI (which reads the clients table) showed the configured limits. AggregateTrafficByEmails now falls back to the clients table for total/expiry when the traffic row is zero, keeping up/down/lastOnline from client_traffics.
  • fix(db): make password-hash migration idempotent to prevent lock-out (#4612)
    The UserPasswordHash seeder bcrypt-hashed user.Password unconditionally, assuming plaintext. If it ran on an already-bcrypt value (DB restore, SQLite<->Postgres switch, history_of_seeders inconsistency on upgrade) it double-hashed the password, locking the admin out with both old and new passwords rejected. Skip any password that is already a bcrypt hash.
  • fix(outbound): add None option to uTLS fingerprint in TLS form (#4760)
    Hysteria doesn't use uTLS, but the outbound TLS form's uTLS dropdown only listed concrete fingerprints (chrome, firefox, ...) with no explicit empty entry. Add a None option, matching the inbound TLS form, so the fingerprint can be left empty.
  • fix(outbound): carry ALPN, fingerprint and UDP mask when importing a Hysteria2 link (#4760)
    parseHysteria2Link hardcoded alpn to h3 and never read fp, ech, or the fm (finalmask) param, so importing a Hysteria2 client URL as an outbound dropped the configured ALPN, fingerprint, and salamander UDP mask. Parse alpn (falling back to h3 only when absent), fp, ech, and the pcs pinned-cert key, and restore the UDP mask via applyFinalMaskParam.
  • fix(sockopt): rename interfaceName to interface so xray honors it
    xray-core reads the bind-interface sockopt as json:"interface", but the schema and forms used interfaceName. Go's JSON unmarshal is case-insensitive, yet interfacename != interface, so the value never reached xray and interface binding silently did nothing. Rename the field across the schema, the inbound/outbound forms, and the golden fixture to match xray-core and the official docs.
  • fix(sub): ensure unique Clash proxy names (#4641)
    genRemark can return an empty string (remark-less inbound, or a remark model that depends on the email the Clash path drops), which was set verbatim as the proxy name. mihomo rejects the whole config on a duplicate name, so two such proxies made the Clash Verge profile vanish on refresh; a single one was dropped from the PROXY group, collapsing it to DIRECT so Rule mode stopped proxying while Global still worked. Guarantee every proxy carries a non-empty, unique name before assembling the group.
  • fix(settings): enforce trafficDiff max of 100 in UI (#4769)
    The trafficDiff InputNumber and form schema lacked an upper bound, so values above 100 were accepted in the UI but rejected by the backend (gte=0,lte=100), failing the entire settings save with a misleading 'request body failed validation' error. Add max=100 to the input and .max(100) to the schema.
  • fix(outbound): fill encryption and pqv when importing VLESS link
    The link-to-JSON importer dropped two VLESS Reality fields:
    
    - pqv (post-quantum ML-DSA-65 verify key) was never parsed; map it back
      to realitySettings.mldsa65Verify, matching the inbound link generator.
    - encryption was force-reset to 'none' in the form adapter regardless of
      the parsed value, discarding post-quantum encryption strings.
    
    Add regression tests for both paths.
  • fix(docker): grant NET_ADMIN/NET_RAW so fail2ban IP-limit bans apply
    The image bundles fail2ban (enabled by default) to enforce per-client IP
    limits via iptables, but docker-compose.yml granted no capabilities. The
    job logs the ban and fail2ban reports it as banned, yet the iptables
    action fails with "Permission denied (you must be root)" and no rule is
    inserted, so the client is never actually blocked. Add cap_add
    NET_ADMIN/NET_RAW to the service and document the docker run flags.
  • test(iplimit): align ban-policy tests with last-IP-wins (#4699)
    PR #4699 restored the "keep newest live IP, ban the oldest" policy in
    check_client_ip_job.go but left the integration test asserting the old
    "protect original, ban newcomer" behavior, so it failed. Update the test
    to expect the oldest live IP banned and the newest kept, and fix the now
    misleading name/comment on the partitionLiveIps concurrency unit test.
  • chore: bump bundled Xray-core to v26.6.1
    Update the Xray-core download URLs in the release workflow and DockerInit.sh from v26.5.9 to v26.6.1.
  • feat(outbound): sync DNS outbound config with Xray core changes
    Rename the DNS rule wire key qtype to qType (reading the legacy qtype on parse for back-compat), add the new rCode response-code field for the return action (omitted when zero), and rename the reject action to return. Align the DNS rule action set across the form dropdown, schema, and adapter to the core's valid values (direct/drop/return/hijack), dropping the never-valid rejectIPv4/rejectIPv6 entries.
  • feat(finalmask): sync transport with upstream Xray core changes
    Consolidate the eight legacy mKCP/header UDP mask types into a single mkcp-legacy type ({header, value}), simplify xicmp to {dgram, ips}, and add the new realm UDP mask type, matching the updated Xray-core wire format. Update the FinalMask schema enum, the transport form, the mKCP seeding default, and the backend KCP share-link translation. Refresh golden fixtures/snapshots and add backend coverage for the mapping.
  • fix(inbounds): refresh routing inbound-tag list after inbound changes
    The routing-rule tag picker reads inboundTags from the xray config query
    (['xray','config']), but refresh() only invalidated the inbounds/clients
    buckets. So after adding, editing or deleting an inbound the tag list stayed
    stale until a hard refresh wiped the react-query cache. Invalidate the xray
    config query too, alongside the existing inbounds-options fix.
  • fix(inbounds): drop listen address from auto-generated inbound tag
    A non-empty, non-any Address (listen) leaked into the tag as
    in-<listen>:<port>-<transport> (e.g. in-127.0.0.1:443-tcp). The tag is
    now always in-<port>-<transport>, with the node prefix and numeric dedup
    suffix still handling uniqueness across nodes and same-port/different-listen
    inbounds. Mirrored in the Go authority and the TS form preview, kept in
    parity by tests.
    
    Existing colon-form tags are now treated as custom, so editing such an
    inbound preserves its tag rather than rewriting it; new inbounds (or a
    cleared tag field) get the clean form.
  • fix(test): drain macrotasks via setTimeout, not setImmediate
    setImmediate is a Node global not declared in the frontend's DOM tsconfig,
    so tsc --noEmit failed with 'Cannot find name setImmediate'. setTimeout is
    universally typed and still flushes React's pending setImmediate: looping
    the awaits keeps afterEach unresolved across several event-loop iterations,
    so the queued check-phase callback fires while window still exists.
  • Update Go module dependency versions
    Bump several Go module versions in go.mod and regenerate go.sum. Updated dependencies include github.com/go-playground/validator/v10 (v10.30.2 -> v10.30.3), github.com/shirou/gopsutil/v4 (v4.26.4 -> v4.26.5), github.com/ebitengine/purego (v0.10.0 -> v0.10.1), github.com/rogpeppe/go-internal (v1.14.1 -> v1.15.0), golang.org/x/exp (updated pseudo-version), and google.golang.org/genproto/googleapis/rpc (updated pseudo-version). These are routine patch/minor updates to pick up fixes and checksum changes.
  • fix(test): drain React scheduler macrotask before jsdom teardown
    React 19 defers passive-effect flushes onto a setImmediate callback that
    reads window.event. When one was still queued as vitest tore down the
    jsdom environment, it fired after window was deleted and surfaced as an
    unhandled 'window is not defined' error, failing the run with exit 1
    despite all tests passing. Drain the macrotask queue in afterEach so any
    pending callback runs while window still exists.
  • feat(clients): show last-online tooltip on the depleted tag too
    The Online column already surfaced last-online on the offline tag; extend the same tooltip to the depleted (ended) tag so a depleted client's last activity is visible without enabling it.
  • feat(clients): enforce unique subId per client like email
    Reject creating or editing a client with a subId already owned by a different client, mirroring the email-uniqueness checks against client_records in Create and Update (BulkCreate inherits via Create). The old multi-inbound model duplicated a client across inbounds sharing one subId, so this check was dropped; the first-class multi-client model makes per-client subId uniqueness correct again. Existing duplicates are left untouched; only new/edited duplicates are blocked.
  • fix(inbounds): correct per-inbound client counts and align stat colors
    The client column under-counted clients attached to an inbound whose shared client_traffics row is keyed to a different inbound: rollupClients filtered settings.clients down to emails that had a stat row on that inbound. Count from settings.clients membership instead. Also surface all/active/disable/depleted/online with the Clients-page color scheme and widen the column.
  • fix(clients): refresh summary counts after a client mutation
    The summary card derived active/bucket counts from the live client_stats snapshot, which only refreshed on the next traffic broadcast (up to 5s). A removal therefore left the counts stale while only total tracked the refetched server summary. Clear the snapshot in invalidateAll so the card falls back to the authoritative server summary immediately; the next stats event repopulates it for live tracking.
  • fix(ui): exit infinite spinner with a retry card on failed initial load
    List pages wrapped content in <Spin spinning={!fetched}> where 'fetched' only flipped true once data arrived. With staleTime: Infinity + retry: 1, a transient network error on first load left the query in a permanent error state and the spinner stuck forever.
    
    Now 'fetched' also settles on query.isError, and a failed load shows a Result error card with a Refresh button that self-heals when the backend returns, mirroring the existing XrayPage pattern. Applied to clients, inbounds, groups, nodes, and the dashboard.
    
    Fixes #4723
  • feat(inbounds): attach existing clients to an inbound in one click
    Adds an 'Attach Existing Clients' row action on multi-user inbounds (shown even when the inbound is empty). It opens a modal listing the whole client pool with search and group filter, all attachable clients pre-selected, and attaches the selection to that inbound via the existing bulkAttach endpoint. Clients already on the inbound are shown disabled and skipped. Translations added for all 13 locales.
  • feat(nodes): bulk panel self-update with live online indicator
    Adds the ability to update node panels to the latest release from the Nodes
    page: select online, enabled nodes (checkboxes) and trigger their official
    self-updater, or use the per-row Update action. A node whose reported panel
    version trails the latest GitHub release is flagged with an 'update available'
    tag (compared via lib/panel-version, mirroring the Go isNewerVersion).
    
    Backend: Remote.UpdatePanel calls the node's existing
    POST /panel/api/server/updatePanel; NodeService.UpdatePanels fans out over the
    selected ids, skipping disabled/offline nodes with a per-node reason; exposed
    as POST /panel/api/nodes/updatePanel (documented in endpoints.ts + openapi.json).
    
    The bulk request sends a JSON body, so it sets Content-Type: application/json
    explicitly — axios defaults POST to form-urlencoded, which made ShouldBindJSON
    fail with 'invalid character i'.
    
    Also reuses the clients-page online cue on the Nodes page: a pulsing green dot
    plus green label for an online node. The .online-dot style moved to the shared
    styles/utils.css so both pages load it.
    
    Translations for all new node keys added across every language file.
  • feat(clients): live online dot + last-online tooltip on offline
    Two small UX cues on the clients table online column:
    
    - a pulsing green dot next to the Online tag so an active client reads as
      live at a glance (honors prefers-reduced-motion).
    - hovering the Offline tag shows the client's last-online timestamp from
      record.traffic.lastOnline, formatted with the panel's calendar setting
      (or "-" when the client has never connected).
  • fix(clients): keep the summary card live without a page refresh
    The clients page summary counters (Online / Depleted / Depleting / Disabled
    / Active) came only from the paged-list response (staleTime: Infinity), so
    they stayed frozen until a manual refresh or a mutation-triggered refetch —
    the per-row columns updated over WebSocket but the summary card did not.
    
    The client_stats WS event already broadcasts every client's traffic
    (enable/up/down/total/expiryTime) every few seconds, so recompute the summary
    client-side from it: computeClientsSummary mirrors the server's
    buildClientsSummary, the latest event is stored in allClientStats, and the
    summary is a useMemo over that plus the live onlines set. Falls back to the
    server summary until the first event lands and keeps the server's
    authoritative total. No extra polling, consistent with the existing
    no-REST-fallback traffic design.
  • fix(sub): keep listen/bind IP out of subscription page URLs
    The subscription page leaked an inbound's server-side Listen IP into the
    client-facing URLs when a bind address was set:
    
    - Per-config links: resolveInboundAddress returned the bind Listen IP
      (loopback/private/public alike) instead of the host the subscriber
      reached the panel on. It now returns the node address for node-managed
      inbounds, otherwise the subscriber host; the bind Listen is ignored
      (External Proxy remains the way to advertise a specific endpoint).
    
    - Subscription Copy URL (SUB/JSON/CLASH): BuildURLs composed the base
      differently from the panel's Client Information page and never
      normalized the request host, so a loopback/bind request leaked the raw
      IP. The composition is extracted into the shared
      SettingService.BuildSubURIBase, used by both the panel and the sub page
      so they render identically, and fed the already-normalized subscriber
      host.
  • fix(inbound): re-derive auto tags on edit and keep node tags consistent
    Auto-generated inbound tags (in-<port>-<l4>, n<id>- prefixed for node inbounds) now re-derive when port/listen/transport change on update instead of keeping the stale round-tripped value. The resolved tag is mirrored onto the API response, and NodeID is pinned to the stored row so a node inbound never loses its n<id>- prefix on edit. The edit form recomputes the tag live via a Go-parity helper so the JSON preview matches what gets saved.
    
    Make node/central tag matching prefix-agnostic in all three places (traffic attribution, remote-id resolution, and the orphan sweep) so an n<id>- prefix present on only one side can no longer spawn duplicate inbounds or drop traffic on sync.
    
    Force LF on shell scripts via .gitattributes (CRLF broke the Docker build shebang when the repo is checked out on Windows) and add a .dockerignore to keep node_modules/.git out of the build context.
    
    Adds Go and frontend tests covering tag re-derivation, prefix-agnostic matching, and node-snapshot prefix mismatch.
  • fix(tgbot): send login notification asynchronously
    UserLoginNotify ran SendMsgToTgbotAdmins synchronously on the login request goroutine. When Telegram was unreachable, the send retried up to 3x with a 30s timeout each, blocking the login handler for ~90s+ and effectively locking users out (issue #4585).
    
    Dispatch the send in a goroutine after the cheap bot-running/login-notify-enabled guards so login always returns promptly; the existing per-send 30s context timeout and bounded retries keep the background goroutine from leaking.
  • fix(model): accept tun protocol in inbound validation
    Adding a TUN inbound failed with "request body failed validation" because the Inbound.Protocol oneof allowlist omitted "tun". Add it so the validator matches the protocol the frontend already offers.
    
    Closes #4736
  • fix(ci): raise issue-bot max-turns so full triage completes
    The handle-issue job capped at 25 turns, which only covered the
    early-exit spam/duplicate paths. Real bug reports went through the full
    flow (categorize + Read/Grep the code + post an answer) and hit the cap
    mid-step 5, leaving the issue labeled but with no reply. Raise to 45 to
    match the heavier path; the mention job already uses 40.
    @
  • fix(postgres): record client traffic when inbound_id is stale
    When an inbound is deleted and recreated it gets a new id, but the shared-by-email client_traffics row keeps the old (now deleted) inbound_id because AddClientStat's OnConflict-DoNothing never refreshes it. The traffic updater matched rows with inbound_id IN (local inbounds), so those orphaned rows were dropped: client traffic and online status stopped updating and auto-renew skipped them, while inbound-level traffic (matched by tag) kept working and the client count still showed (matched by email).
    
    Match by email and exclude only rows owned by a node inbound (inbound_id NOT IN (node inbounds)) in addClientTraffic and autoRenewClients. The local Xray only reports local-client emails, so a stale local pointer no longer hides the row, while genuine node-owned rows stay protected. Verified against a real affected dump: visible rows went from 4/668 to 668/668.
  • fix(frontend): add missing react-hooks/exhaustive-deps
    ESLint failed the frontend build on four react-hooks/exhaustive-deps errors. Add the missing dependencies: the hysteria streamSettings effect now lists form, and the inbounds page prompt/import/general-action callbacks now list t. Both form (Form.useForm) and t (useTranslation) are stable references, so no extra re-renders or loops.
  • fix(postgres): commit client traffic backfill in migration
    MigrationRequirements backfills missing client_traffics rows from each inbound's settings.clients, but the later MultiDomain->ExternalProxy detection query used SQLite-only json_extract and executed via .Scan. On PostgreSQL it errored, rolling back the whole transaction including the backfill, so clients had no traffic rows: client traffic was never recorded, clients showed offline, and the inbound list showed 0 clients until each inbound was edited and saved.
    
    Make the detection query dialect-aware (NULLIF(stream_settings,'')::jsonb #>> / #>) so the function runs to completion and commits on both dialects.
  • fix(ci): let issue bot run for non-collaborator issue authors
    The handle-issue job uses claude-code-action, which by default refuses
    to run unless the triggering user has write access. Public issue authors
    never do, so the job failed on essentially every real issue. Set
    allowed_non_write_users: "*" on the triage job (mention job left gated).
  • fix(postgres): resync id sequences so adding clients no longer collides
    resetPostgresSequences hardcoded table names that did not match the models: it used "client_records" (real table is "clients") and "inbound_fallback_children" (real table is "inbound_fallbacks"). For both, pg_get_serial_sequence returned NULL, so the guarded setval was a silent no-op and those id sequences were never advanced past MAX(id) after a SQLite->Postgres migration. The first client added afterward reused an existing id and failed with duplicate key value violates unique constraint "clients_pkey".
    
    Resolve table names from the models via GORM instead of hardcoding, and run the resync on every Postgres startup (initModels) so databases already broken by the previous migration repair themselves on boot.
  • fix(inbounds): only reset id sequence when all inbounds are deleted
    Commit 80110f9 realigned sqlite_sequence to MAX(id) after every delete,
    which recycled freed ids and let a newly added inbound take an old
    inbound id. Now the sequence row is cleared only when the table is empty,
    so the counter keeps climbing while any inbound remains and existing ids
    are never reused. Still guarded behind !IsPostgres().
    @
  • feat(inbounds): clearer client validation errors on save
    When an inbound save fails Zod validation, the toast previously showed a
    raw path like `settings.clients.494.tgId: Invalid input`, which gave no
    hint which of hundreds of clients was at fault. Resolve the client array
    index back to the client email, name the field, and append a "(+N more)"
    count when several fields fail. console.error now logs a readable list of
    every issue instead of dumping the whole form.
    
    Adds the invalidClientField/invalidField/moreIssues toast strings across
    all 13 translations.
  • refactor(inbounds): remove column sorter from inbound list
    Drop the table header sorter on the inbounds page: the sortKey/sortOrder
    state, the sortedInbounds memo and onChange handler, the per-column
    sorterFor spreads, the SORT_FNS comparator map, and the now-unused
    SortKey/SortOrder types. The list renders in DB order.
  • fix(postgres): stop FK constraint from blocking inbound delete
    The schema was written for SQLite, which never enforces foreign keys, so
    relationships are managed in application code and deleting an inbound keeps
    its client_traffics by design. On Postgres GORM auto-created the
    fk_inbounds_client_stats constraint, which rejected those deletes with
    SQLSTATE 23503.
    
    Set DisableForeignKeyConstraintWhenMigrating so neither backend creates the
    constraint, and drop the already-created one on existing Postgres DBs via
    dropLegacyForeignKeys. Also revert the client_traffics deletion that
    c20ee00f added to DelInbound so traffic is preserved.
  • fix(outbounds): prevent freedom save crash, complete its fields (#4686)
    freedomToWire called Object.entries(s.fragment), but getFieldsValue(true)
    returns freedom settings without a fragment object when the Fragment switch
    is off (its sub-fields never register). That threw 'Cannot convert undefined
    or null to object' and silently killed the save. Guard fragment with a
    fallback so an unset value is treated as empty.
    
    While verifying against xray-core's freedom config, also:
    - add the missing userLevel field (schema, form schema, adapter, UI)
    - fix noise applyTo enum to ip/ipv4/ipv6 (xray rejects the old host/all)
    
    Closes #4686
  • fix(postgres): clear client_traffics before deleting inbound
    DelInbound removed the client_inbounds join rows but never deleted the
    inbound's client_traffics, so Postgres rejected the inbound delete with
    fk_inbounds_client_stats (SQLSTATE 23503). SQLite never enforced the FK
    so this went unnoticed. Delete client_traffics first, matching the order
    already used in the sync path.
  • fix(settings): sync generated schemas
    - entity.go: tighten SessionMaxAge validate tag gte=0 -> gte=1 to match the panel UI (min 60) and the hand-written setting.ts schema
    
    - GeneralTab.tsx: add max bounds to sessionMaxAge (525600) and pageSize (1000), raise pageSize min to 1
    
    - regenerate zod.ts/types.ts, picking up pending drift: panelProxy field, client group field, InboundFallback.dest, and dropping the stale hysteria2 protocol enum value
  • feat(postgres): in-panel backup/restore and consistent CLI backend
    Two PostgreSQL gaps on the panel:
    
    1. x-ui setting and other CLI subcommands read XUI_DB_TYPE/XUI_DB_DSN from
       the process environment, which systemd injects via EnvironmentFile but a
       plain shell invocation does not. On a PostgreSQL install the CLI silently
       fell back to SQLite, so changes made from the management menu never
       reached the panel's database. Load the systemd EnvironmentFile
       (/etc/default/x-ui and distro equivalents) at startup; godotenv.Load does
       not override existing vars, so it stays a no-op for the managed service.
    
    2. DB backup/restore (panel endpoints and the Telegram bot) only handled the
       SQLite file, so on PostgreSQL Back Up returned a stale/absent x-ui.db and
       Restore silently did nothing. Add pg_dump/pg_restore based backup/restore:
       - GetDb/ImportDB run pg_dump (custom format) / pg_restore, passing
         credentials via the PG* environment instead of argv.
       - getDb downloads x-ui.dump on Postgres, x-ui.db on SQLite.
       - Telegram backup sends the matching file via GetDb.
       - BackupModal shows a Postgres note and accepts .dump; the dist page
         injects window.X_UI_DB_TYPE; new strings translated for all locales.
       - install.sh installs postgresql-client for the external-DSN path and
         points the user to in-panel Backup & Restore.
    
    Closes #4658
  • i18n(nodes): translate basePath and apiToken labels
    Localize the node form 'basePath' (zh-CN, zh-TW, tr-TR) and 'apiToken'
    (zh-CN, zh-TW, uk-UA) labels that were still showing the English defaults.
  • fix(inbounds): auto-increment WireGuard peer IP
    New peers were always seeded with allowedIPs 10.0.0.2/32, so each "Add
    peer" reused the same address. Derive the next address from the highest
    IPv4 already present across existing peers (max + 1, keeping its prefix),
    falling back to 10.0.0.2/32 when there are no peers yet.
    
    Closes #4682
  • fix(clients): persist group for node-inbound clients
    The client create/edit form left `group` out of the request payload, so choosing a group in the form was silently dropped (bulkAdd from the Groups page still worked because it writes the column directly). Add `group` to the payload next to `comment`.
    
    SyncInbound also overwrote group_name unconditionally; a group set via bulkAdd is never pushed to the node, so the next node snapshot — which lacks it — wiped the column. Keep group sticky (only overwrite when the incoming value is non-empty); group is only ever set/cleared via the Groups page. Preserve comment for node clients during snapshot sync the same way. Add tests.
  • fix(sub): don't leak loopback bind IP into link host
    When the sub server is reached on a loopback/unspecified host (e.g. 127.0.0.2 from its Listen IP bind), the request host was used as the link address. Substitute the configured Subscription/Web Domain, or normalize loopback to localhost, so the sub link address matches the panel's Client Information.
  • @
    ci: replace legacy frontend path filters with frontend/** glob
    
    The CI, CodeQL, and release workflows still gated on a per-extension
    list (**.js, **.html, **.css, **.cjs, ...) left over from the old
    Vue/JS UI. That list missed .tsx entirely, so React component edits
    never triggered the workflows, and carried dead entries like **.cjs.
    Replace the whole enumeration with a single frontend/** glob in all
    three so any change under frontend/ triggers build/test/analysis,
    while keeping **.go, go.mod, go.sum, **.sh, and the service-file paths.
    @
  • fix(clients): persist sort selection across navigation
    The clients page saved searchKey and filters to localStorage but not
    the sort selection, so leaving the page and returning reset sort to the
    default (Oldest). Persist the chosen sort alongside the existing filter
    state and restore it on mount, matching the filter-persistence pattern.
  • fix(inbounds): reset id sequence on delete so old ids are reused
    SQLite AUTOINCREMENT keeps a high-water mark in sqlite_sequence that
    deleting rows never lowers, so after removing inbounds the next add kept
    climbing instead of reusing freed ids. DelInbound now realigns the
    counter to MAX(id) after each delete, clearing the sqlite_sequence row
    entirely when the table is empty so the next inbound starts at id 1.
    Guarded behind !IsPostgres(); Postgres sequences are left untouched.
  • feat(inbounds): add multi-select and bulk delete
    Mirror the clients page: checkbox selection on the desktop table and on
    mobile cards, with a danger Delete button in the toolbar that removes all
    selected inbounds in one call.
    
    Backend adds POST /panel/api/inbounds/bulkDel, which loops the existing
    DelInbound per id (xray restarts at most once) and returns {deleted,
    skipped}. Frontend shows a confirm modal plus a result toast, clears the
    selection on success, adds bulk-delete i18n keys across all 13 languages,
    and documents the endpoint in the in-panel API docs.
  • fix(inbounds): preserve client data on delete and show traffic in detail
    Deleting an inbound now only detaches its clients (removes the
    client_inbounds rows). It no longer deletes client_traffics or client IP
    logs: those are keyed centrally by email (one row per client) and must
    survive, since a client may stay attached to other inbounds and is
    managed from the Clients page.
    
    Separately, /get/:id now uses a new GetInboundDetail that preloads and
    enriches ClientStats, so hydrated records (info / QR / export) carry
    per-client traffic instead of null. DBInbound.toJSON drops the internal
    _clientStatsMap cache so it no longer leaks into the exported JSON.
  • fix(settings): reject spaces, '\' and control chars in URI path settings
    webBasePath, subPath, subJsonPath and subClashPath are URL paths, so '/'
    stays allowed, but spaces, backslashes and control characters break
    routing. Strip them as you type (shared sanitizePath helper, now also
    applied to the panel base path) and reject them on save in
    AllSetting.CheckValid so direct API callers are covered too.
  • fix(clients): reject spaces, '/', '\' and control chars in subscription ID
    Like the client email, the subId is embedded directly in subscription
    URLs, so the same characters break it. Validate it on the backend
    (Create + Update) and the frontend (Zod), with a localized message
    across all 13 locales. An empty subId stays allowed (it is then
    auto-generated).
  • fix(clients): reject spaces, '/', '\' and control chars in client email
    Client emails containing a slash broke the path-param routes
    (edit/delete/view returned 404 / "client not found"), leaving stale
    records that could only be cleared with manual SQLite edits. Validate
    the email on both the backend (Create + Update, which also covers the
    bulk paths) and the frontend (Zod) so these characters are rejected at
    save time with a clear, localized message across all 13 locales.
    
    Closes #4695
  • refactor(frontend): reorganize source tree & break down oversized modals/tabs (#4698)
    * refactor(frontend): reorganize components & pages into feature folders
    
    No behavior change; pure file relocation + import path updates.
    
    * refactor(frontend): move shared protocol enums to schemas/protocols/shared
    
    Decouple Outbound from Inbound schemas: SSMethodSchema and VmessSecuritySchema (shared between inbound & outbound) now live in a neutral schemas/protocols/shared/ module. Outbound no longer reaches into schemas/protocols/inbound/*. Pure relocation + import rewiring; schema values identical, snapshots & golden tests unchanged.
    
    * refactor(frontend): break InboundList into helpers/types/RowActions/columns hook/stats modal
    
    InboundList.tsx 781 -> 203 lines. Extracted pure helpers (network labels, sort fns, isInboundMultiUser), shared types, the row-actions menu/cell, the table columns hook, and the mobile stats modal into the list/ folder. Code moved verbatim; no behavior change. typecheck/lint/test/build green, 337 tests pass.
    
    * refactor(frontend): extract InboundInfoModal helpers, types & buildInboundInfo
    
    InboundInfoModal.tsx 1081 -> 836 lines. Moved the pure data helpers (network host/path readers, link-protocol check, copy/download/statsColor/IP formatting) plus all shared types and the buildInboundInfo data builder into info/helpers.ts and info/types.ts. The state-coupled render body is left intact (no React render tests to guard a deeper split). Code moved verbatim; no behavior change. All gates green, 337 tests pass.
    
    * test(frontend): add React Testing Library + jsdom render-test harness
    
    - vitest projects: node unit tests stay lean; new jsdom 'components' project runs *.test.tsx
    - component setup: matchMedia/ResizeObserver/localStorage polyfills, react-i18next init, persian-calendar-suite stub (only used under jalali locale)
    - smoke + field-label structure snapshots for Inbound & Outbound form modals
    - establishes the regression net required before decomposing the oversized form modals
    - 341 tests pass (337 unit + 4 component); typecheck/lint/build green
    
    * test(frontend): per-protocol field-structure coverage for both form modals
    
    - drive the protocol Select in jsdom and snapshot rendered Form.Item labels for every protocol
    - 10 outbound + 10 inbound protocol states captured as the regression net for protocol-core extraction
    - add robust select-driving helpers (test-utils) + post-test body cleanup (setup.components)
    - 341 tests pass; typecheck/lint green
    
    * refactor(frontend): extract OutboundFormModal constants & stream helpers
    
    OutboundFormModal.tsx 2238 -> 2080. Moved the pure option arrays/sets and the stream-slice helpers (newStreamSlice, hysteriaStreamSlice, isMuxAllowed, buildAddModeValues) into outbound-form-constants.ts and outbound-form-helpers.ts. Per-protocol render snapshots unchanged -> verified no behavior change. typecheck/lint/build green.
    
    * refactor(frontend): extract InboundFormModal advanced JSON editors
    
    InboundFormModal.tsx 3129 -> 2863. Moved AdvancedSliceEditor and AdvancedAllEditor (the in-modal JSON slice/all editors) into advanced-editors.tsx along with their adapter-helper imports. Per-protocol render snapshots unchanged -> verified no behavior change. typecheck/lint/build green.
    
    * refactor(frontend): extract OutboundFormModal loopback/blackhole/dns field blocks
    
    Moved the outbound-only protocol field blocks (loopback, blackhole, dns) out of the modal render body into outbound-only-fields.tsx. First render-body extraction behind the per-protocol snapshot net: loopback/blackhole/dns snapshots unchanged -> verified no behavior change. typecheck/lint/build green.
    
    * refactor(frontend): extract OutboundFormModal freedom field block
    
    OutboundFormModal.tsx 2063 -> 1753. Moved the freedom protocol field block (domainStrategy, fragment, noises, finalRules) into outbound-freedom-fields.tsx. Verbatim relocation; freedom per-protocol snapshot unchanged -> no behavior change. typecheck/lint/build green.
    
    * refactor(frontend): extract OutboundFormModal wireguard field block
    
    OutboundFormModal.tsx 1753 -> 1622. Moved the wireguard protocol field block (address, keypair gen, domainStrategy, peers + allowedIPs) into outbound-wireguard-fields.tsx; dropped now-unused icon/InputAddon/WireguardDomainStrategy imports. Verbatim relocation; wireguard snapshot unchanged -> no behavior change. typecheck/lint/build green.
    
    * refactor(frontend): extract OutboundFormModal core protocol fields
    
    OutboundFormModal.tsx 1622 -> 1538. Moved the shared protocol core field blocks (vmess/vless ID, vmess security, vless encryption/reverseTag, trojan/ss password, ss method/uot, socks/http user/pass) into outbound-core-fields.tsx; dropped now-unused schema/option imports. Per-protocol snapshots unchanged -> no behavior change. typecheck/lint/build green.
    
    * refactor(frontend): fold OutboundFormModal server address/port block into core fields
    
    OutboundFormModal.tsx 1538 -> 1516. Moved the shared connect-target (address/port) block into OutboundCoreProtocolFields at the same render position; dropped the now-unused SERVER_PROTOCOLS import. Snapshots unchanged -> no behavior change. typecheck/lint/build green.
    
    * refactor(frontend): split outbound-only protocol forms into per-protocol files
    
    Replace the grouped outbound-only-fields.tsx + outbound-freedom-fields.tsx with one file per protocol under outbounds/protocols/: freedom.tsx, blackhole.tsx, dns.tsx, loopback.tsx (+ barrel). Matches the prompt's 1-file-per-protocol structure. Outbound snapshots unchanged -> no behavior change. typecheck/lint/build green.
    
    * refactor(frontend): split outbound protocol forms into per-protocol files
    
    Replace the grouped outbound-core-fields / outbound-wireguard-fields with one file per protocol under outbounds/protocols/: vmess, vless, trojan, shadowsocks, http, socks, wireguard, freedom, blackhole, dns, loopback (+ shared server-target). Matches the prompt's 1-file-per-protocol structure (per-modal). Outbound snapshots unchanged -> no behavior change. typecheck/lint/build green.
    
    * refactor(frontend): split outbound transport forms into per-transport files
    
    Extract the tcp(raw)/kcp/ws/grpc/httpupgrade transport blocks into outbounds/transport/ per-file components (RawForm, KcpForm, WsForm, GrpcForm, HttpUpgradeForm). xhttp + hysteria transport remain inline for a follow-up. Verbatim relocation; outbound snapshots unchanged -> no behavior change. typecheck/lint/build green.
    
    * refactor(frontend): extract OutboundFormModal xhttp transport form
    
    Move the xhttp transport block into transport/xhttp.tsx (takes form + onXmuxToggle prop); drop now-unused HeaderMapEditor and MODE_OPTIONS imports from the modal. OutboundFormModal.tsx down to ~1001 lines (from 2238 originally). Verbatim relocation; outbound snapshots unchanged -> no behavior change. typecheck/lint/build green.
    
    * refactor(frontend): extract OutboundFormModal tls/reality security forms
    
    Move the TLS and Reality field blocks into outbounds/security/{tls,reality}.tsx; the none/TLS/Reality Radio.Group selector stays in the modal. Drop now-unused ALPN_OPTIONS/UTLS_OPTIONS imports. OutboundFormModal.tsx down to ~918 lines (from 2238 originally). Verbatim relocation; outbound snapshots unchanged -> no behavior change. typecheck/lint/build green.
    
    * refactor(frontend): split inbound-only protocol forms (tun, tunnel) into per-file
    
    Extract the tun and tunnel protocol blocks from InboundFormModal into inbounds/form/protocols/{tun,tunnel}.tsx (presentational, declarative). First inbound-side per-protocol split. Verbatim relocation; inbound snapshots unchanged -> no behavior change. typecheck/lint/build green.
    
    * refactor(frontend): split inbound wireguard & shadowsocks protocol forms
    
    Extract the wireguard and shadowsocks protocol blocks from InboundFormModal into inbounds/form/protocols/{wireguard,shadowsocks}.tsx (presentational; form + regen handlers / isSSWith2022 passed as props). Drop now-unused Divider + SSMethodSchema imports. Verbatim relocation; inbound snapshots unchanged -> no behavior change. typecheck/lint/build green.
    
    * refactor(frontend): split inbound vless/http/mixed/hysteria protocol forms
    
    Extract the remaining inbound protocol blocks into inbounds/form/protocols/: vless (auth handlers/state as props), http + mixed (shared accounts-list), hysteria. Drop now-unused HysteriaMasqueradeForm/Typography/Text imports from the modal. InboundFormModal.tsx 2841 -> 2478. Inbound snapshots unchanged -> no behavior change. typecheck/lint/build green.
    
    * refactor(frontend): move HysteriaMasqueradeForm to lib/xray/forms/transport
    
    The hysteria masquerade form edits streamSettings.hysteriaSettings.masquerade (a transport/stream concept) and is rendered identically by both modals, so it belongs next to FinalMaskForm in lib/xray/forms/transport/ rather than protocols/shared/. Moved the file, updated the transport barrel + both consumers (inbound hysteria protocol form, outbound modal), and removed the now-empty protocols/shared/ folder. Pure relocation; snapshots unchanged, typecheck/lint/build green.
    
    * refactor(frontend): extract inbound transport forms into transport/ folder
    
    Move the six inbound stream-transport blocks (tcp/raw, ws, grpc, xhttp,
    httpupgrade, kcp) out of InboundFormModal into presentational components
    under inbounds/form/transport/. XhttpForm takes the form instance and
    re-derives its mode/obfs/placement watches internally; the rest are
    declarative. InboundFormModal drops from 2566 to 2105 lines. No behavior
    change — per-protocol field-label snapshots unchanged.
    
    * refactor(frontend): extract inbound security forms into security/ folder
    
    Move the inbound TLS and Reality stream-security blocks out of
    InboundFormModal into presentational components under
    inbounds/form/security/. The Radio.Group security selector stays in the
    modal; TlsForm and RealityForm receive their cert/key/ECH generation
    handlers and the saving flag as props. InboundFormModal drops from 2105
    to 1708 lines.
    
    Add inbound-form-blocks.test.tsx: render-snapshot coverage for each
    extracted transport (raw/ws/grpc/kcp/httpupgrade/xhttp) and security
    (tls/reality) component in isolation inside a minimal Form. The full
    modal cannot exercise the stream/security tabs in jsdom because they are
    gated behind Form.useWatch values that do not propagate in the test
    harness, so component-level snapshots are the regression net for these
    blocks. No behavior change.
    
    * refactor(frontend): extract outbound sockopt/mux/hysteria transport blocks
    
    Move the last three oversized inline stream blocks out of
    OutboundFormModal into presentational components under
    xray/outbounds/transport/: SockoptForm (~260 lines, the worst offender),
    MuxForm, and HysteriaForm. Each takes the form instance; MuxForm also
    takes protocol/network and keeps its isMuxAllowed gate. OutboundFormModal
    drops from 962 to 621 lines and no inline section now exceeds the
    250-line guideline. Existing outbound-form-modal snapshots already cover
    sockopt/mux and stay byte-identical, confirming no behavior change.
    
    * refactor(frontend): extract inbound sockopt + external-proxy blocks
    
    Move the inbound Sockopt (~250 lines) and External Proxy stream blocks
    out of InboundFormModal into presentational components under
    inbounds/form/transport/, mirroring the outbound extraction. Each takes
    its toggle handler (toggleSockopt / toggleExternalProxy) as a prop and
    keeps its render-prop getFieldValue gate. InboundFormModal drops from
    1708 to 1332 lines.
    
    Extend inbound-form-blocks.test.tsx with isolated render-snapshot
    coverage for both (SockoptForm seeded enabled + happyEyeballs;
    ExternalProxyForm seeded with one TLS entry). No behavior change.
    
    * refactor(frontend): break down RoutingTab into sections
    
    Extract RoutingTab's presentational pieces into the routing/ folder:
    helpers.ts (arrJoin/csv/chipPreview/ruleCriteriaChips), types.ts
    (RuleRow), CriterionRow.tsx, RuleCardList.tsx (mobile card view), and
    useRoutingColumns.tsx (desktop table columns hook). RoutingTab stays the
    orchestrator holding rule state, mutate, tag-option memos and the
    pointer-drag reorder logic, and drops from 550 to 291 lines. No behavior
    change.
    
    * refactor(frontend): extract BasicsTab constants and rule helpers
    
    Move BasicsTab's geo option arrays + freedom/ipv4 outbound presets into
    basics/constants.ts and the routing-rule get/set/sync helpers into
    basics/helpers.ts. BasicsTab drops from 550 to 447 lines and keeps its
    Collapse-of-settings panels (which stay coupled to mutate + derived
    state, so splitting them into components would only add prop-drilling).
    No behavior change.
    
    * refactor(frontend): break down DnsTab columns/helpers/types
    
    Extract DnsTab's pure pieces into the dns/ folder: helpers.ts
    (STRATEGIES/DEFAULT_FAKEDNS + addr/domains/expectedIPs accessors),
    types.ts (DnsConfig/HostRow/FakednsRow), and useDnsColumns.tsx
    (useDnsServerColumns + useFakednsColumns table-column hooks taking their
    row handlers as params). DnsTab stays the orchestrator for dns state,
    mutate, hosts sync and the Collapse panels, and drops from 539 to 424
    lines. No behavior change.
    
    * refactor(frontend): break down OutboundsTab into sections
    
    Extract OutboundsTab's pieces: outbounds-tab-types.ts (OutboundRow),
    outbounds-tab-helpers.ts (address/untestable/security/breakdown +
    traffic/testing/result accessors), useOutboundColumns.tsx (desktop table
    columns hook) and OutboundCardList.tsx (mobile card view). OutboundsTab
    stays the orchestrator for outbound state, mutate, reorder and the
    toolbar, and drops from 516 to 238 lines. No behavior change.
    
    This completes plan section 2.4.5 — all four oversized Xray tabs
    (Basics/Routing/Dns/Outbounds) are now broken into sections + hooks.
    
    * refactor(frontend): fold HysteriaMasqueradeForm into the hysteria forms
    
    Inline the masquerade fields directly into both hysteria transport forms
    (inbounds/form/protocols/hysteria + xray/outbounds/transport/hysteria)
    and delete the shared lib/xray/forms/transport/HysteriaMasqueradeForm so
    each hysteria form is self-contained. The masquerade JSX is unchanged;
    form is typed as the untyped FormInstance (as the shared component was)
    so the masquerade name paths still resolve. No behavior change.
    
    * refactor(frontend): slim InboundFormModal by extracting hooks + sections
    
    Pull the modal's non-layout logic into focused files at the form root:
    - useSecurityActions.ts: TLS/Reality key + cert generation handlers and
      onSecurityChange (consumed by the security tab)
    - useInboundFallbacks.ts: fallback row state + load/save/derive/add/
      update/remove/move handlers + eligible-child options
    - FallbacksCard.tsx: the fallbacks card UI (presentational)
    - SniffingTab.tsx: the sniffing tab UI (presentational)
    
    Also drop the stale "Pattern A rewrite / sibling file" header comment and
    the imports the extractions made unused. InboundFormModal goes from 1332
    to 868 lines with no behavior change (351 tests green, snapshots
    unchanged).
  • fix(outbounds): lock hysteria to its QUIC transport + TLS, add version/masquerade
    The hysteria protocol now offers only the Hysteria transport (other transports removed) and security is always TLS. This prevents the broken hysteria-over-tcp / security:none outbounds that made xray-core fail to start with 'Failed to build Hysteria config. > version != 2'.
    
    Show the fixed version field directly under Transmission, and expose the full masquerade sub-form on the outbound too. The masquerade UI was extracted into a shared HysteriaMasqueradeForm component used by both the inbound and outbound forms.
    
    Closes #4665
  • feat(clients/inbounds): IP log popups, clearer titles, tag-based inbound labels
    Add an IP Log popup (view list + refresh + clear) to the client edit form and the Client Information modal, with IPs stacked vertically.
    
    Identify inbounds by their xray tag (not remark/protocol:port) across every picker and chip: attach/detach modals, the attached-inbounds column and field, the filter drawer, and bulk-add. Add the tag field to the InboundOption schema (the backend already returned it).
    
    Clarify modal titles/labels: Client Information (was More Information) and Inbound Information (was Inbound's Data); Client Information / QR Code titles now include the client email.
    
    i18n: rename keys moreInformation->clientInfo and inboundData->inboundInfo with proper translations in all languages; addTitle->addClient, editTitle->editClient, addToGroupPlaceholder->groupName.
  • fix(outbounds): parse wireguard:// links and fix ss:// query-string port
    Add parseWireguardLink to the outbound import dispatcher: maps the secretKey userinfo, peer publicKey/endpoint, address, mtu, reserved, preSharedKey and keepAlive (probing common client aliases). Previously any wireguard:// link fell through to null and showed "Wrong Link!".
    
    Also fix parseShadowsocksLink so a trailing query string (e.g. ?type=tcp) no longer leaks into the host:port slice, which made Number(port) NaN and silently fell back to 443. Strip the query before parsing in both the modern and legacy ss forms.
  • fix(xray): test UDP outbounds via xray probe (#4657) + Vision testseed & Flow form fixes
    Outbound connection tester (#4657): UDP-based outbounds (wireguard,
    hysteria, kcp/quic transports) were probed with a raw UDP dial that
    treated the inevitable read timeout as success, so every one reported a
    fake ~5s 'alive'. Route them through the authoritative xray
    burstObservatory probe and drop the broken raw-UDP path. Test All now
    runs a parallel TCP lane and a serial HTTP lane so xray-probe outbounds
    don't collide on the test semaphore.
    
    Vision testseed: the [900, 500, 900, 256] default repeats 900, and a
    tags Select keys each tag by value -> 'two children with the same key,
    900'. Render it as four InputNumbers (inbound + outbound forms); the
    field is a fixed 4-tuple where repeats are valid.
    
    Inbound form: drop the null-valued 'Local Panel' Select option (AntD
    rejects null option values; placeholder + allowClear already cover it).
    
    Outbound form: add an explicit 'None' option to the Flow selector.
  • fix(outbounds): persist optional blocks and fix stale edit reopen
    - derive XMUX toggle from saved xmux on load, seed defaults on enable,
      and drop xmux when disabled (#4654)
    - save the JSON tab straight from parsed text so sockopt, finalmask (TCP
      masks), mux, and reverse excludes round-trip instead of being dropped
      by the form-store bounce
    - remove the redundant Host/Path fields from HTTP obfuscation that fought
      the request.headers editor over the same form path
    - rebuild the outbounds table columns on row content change (rows, not
      rows.length) so a re-opened edited outbound shows fresh values
    - add adapter round-trip regression tests
    
    Closes #4654
  • fix(outbounds): support proxyProtocol on freedom outbound
    Xray's freedom outbound accepts a numeric proxyProtocol (0 disabled,
    1 or 2 for the PROXY protocol version), but the panel had no field for
    it and the typed form adapter dropped the key on save — so a value set
    via the JSON editor disappeared the moment the outbound was saved.
    
    Model proxyProtocol through the freedom wire schema, the form schema,
    and both adapter directions (clamped to 0/1/2, omitted from the wire
    when 0), and add a Select (none / v1 / v2) to the freedom section of
    the outbound form. Add round-trip test coverage and the proxyProtocol
    label across all locales.
    
    Closes #4486
  • fix(qr): hide QR for post-quantum links on client QR page
    Opening the client sublinks/QR modal crashed when a link used
    post-quantum keys (ML-DSA-65 / ML-KEM-768): the encoded URL exceeds
    the antd QRCode capacity and the component throws. The client QR modal
    rendered the QRCode unconditionally, so it took down the page.
    
    The names don't appear verbatim in a share link — mldsa65Verify rides
    inside pqv=<base64> and ML-KEM-768 inside encryption=mlkem768x25519plus.
    The QR modal and inbound QR modal used a literal-substring guard that
    missed those encoded forms, leaving the QR (and the crash) in place.
    
    Consolidate detection into a single isPostQuantumLink() helper in
    inbound-link.ts and reuse it across the client QR, inbound QR, client
    info, and sub surfaces. The copy/download link still works; only the
    QR image is suppressed for oversized post-quantum links.
    
    Closes #4656
  • fix(ssl): prompt before setting IP cert path for panel
    The IP certificate flow auto-set the panel cert path silently, unlike the
    domain and Cloudflare flows which ask first. Add the same
    "Would you like to set this certificate for the panel? (y/n)" prompt so
    the IP flow is consistent and only configures the panel on confirmation.
  • fix(clients): store flow per-inbound for shared clients
    A client shared across inbounds (e.g. VLESS+TCP+Reality and VLESS+WS+TLS)
    had its `flow` applied globally, so enabling xtls-rprx-vision for Reality
    broke the WS+TLS inbound for the same client (#4628).
    
    Gate flow per inbound at every fan-out site via clientWithInboundFlow,
    reusing inboundCanEnableTlsFlow (VLESS+TCP+TLS/Reality only), and make
    ListForInbound treat flow_override as authoritative so an empty override
    means "no flow on this inbound" instead of inheriting the record's global
    flow. Also tighten buildTargetClientFromSource (copy-clients) to gate on
    transport, not just protocol.
  • fix(clients): preserve UUID when toggling enable from clients page
    The clients list returns slim rows without secrets (uuid/password/auth)
    or flow/security/tgId/reset/group. setEnable built its update payload
    straight from the slim row, sending an empty id, so the backend treated
    it as a new client and regenerated the UUID (and dropped the omitted
    fields). Hydrate the full record first and send a complete payload that
    changes only the enable flag.
  • fix(nodes): use GREATEST for last_online merge on PostgreSQL
    setRemoteTrafficLocked merged last_online with MAX(last_online, ?), which
    is SQLite's two-argument scalar max. PostgreSQL's MAX() is aggregate-only,
    so node traffic sync failed every cycle with "function max(bigint, unknown)
    does not exist (SQLSTATE 42883)", flooding the logs.
    
    Add a dialect-aware database.GreatestExpr helper (GREATEST on Postgres,
    MAX on SQLite) and use it for the last_online merge. last_online is a
    non-null int64, so the two functions are semantically identical here.
    
    Closes #4633
  • fix(outbounds): preserve TLS/Reality security on save
    OutboundFormModal.onOk built the save payload from form.validateFields(),
    which only returns REGISTERED Form.Item values. The security selector is a
    Radio.Group that writes streamSettings.security via setFieldValue with no
    bound Form.Item, so validateFields() dropped it — network, tlsSettings and
    realitySettings (all registered) survived, but the security discriminator
    vanished and xray-core fell back to security="none". This hit both new
    outbounds and re-saved ones.
    
    Read the full form store with getFieldsValue(true) for the payload (still
    validating first), matching how the inbound modal already does it.
    
    Closes #4634
  • fix(nodes): clean up orphaned client_inbounds on node inbound removal
    When a remote node disconnects or one of its inbounds vanishes from the
    traffic snapshot, setRemoteTrafficLocked deleted the central inbound row
    but left the client_inbounds join rows behind. Affected clients ended up
    linked to hundreds of phantom inbounds, and editing one then failed with
    "record not found" / "Load Old Data Error" because Update aborted on the
    first GetInbound miss.
    
    - Detach client_inbounds rows when deleting a vanished node inbound
    - Prune stale links during client Update instead of aborting the save
    - Drop orphaned client_inbounds rows on startup to heal existing DBs
    
    Closes #4636
  • fix(inbounds): restore xHTTP Headers editor in form
    The xHTTP transport schema and share-link emitter already supported a
    headers map, but the inbound form lost its editor row, so operators had
    no way to set custom headers on xHTTP inbounds. Add the HeaderMapEditor
    row in the same position the outbound form uses.
  • fix(sub): stop external-proxy dest from clobbering TLS SNI
    externalProxySNI fell back to ep["dest"] when an external-proxy row had
    no SNI of its own, silently overwriting the upstream tlsSettings
    serverName already written into the share-link params. Operators using
    forceTls=same with a CDN edge IP got SNI=<edge-ip> in the link instead
    of the real cert hostname, breaking TLS handshakes.
    
    The fallback is dropped: an explicit ep["sni"] still overrides, but a
    blank entry now leaves the upstream SNI in place. Tests updated.
  • feat(fallbacks): add per-rule dest override
    Operators can now type an explicit dest (e.g. "8443", "127.0.0.1:8443",
    "/dev/shm/x.sock") on each fallback row to override the auto-resolved
    child listen+port. Empty keeps the existing auto behavior.
    
    Adds the column to inbound_fallbacks (GORM AutoMigrate), threads it
    through the panel form, API docs, and translations.
  • fix(groups): fetch full client list for Add/Remove/SubLinks modals
    GroupsPage was sourcing modal candidates from useClients(), which is server-paginated at 25 rows — so "Add clients to group" only ever offered the first page, "Remove" missed members past page 1, and SubLinks silently skipped emails whose record wasn't in the cached page. Pull the unpaginated list via /panel/api/clients/list when any of the three modals open.
  • feat(tls): surface pinnedPeerCertSha256 in panel, share links, and subs
    Adds a panel-only `pinnedPeerCertSha256` field on TLS settings with a tags input and a random-hash generator. The hashes ride share links as `pcs` (v2rayN-compatible), Clash sub as `pin-sha256`, and JSON sub as `pinnedPeerCertSha256`, while remaining stripped from the run-config sent to xray-core.
  • i18n(panel): translate Copy/Cancel buttons, Stream/Sniffing tabs, and All-Inbounds filenames
    - TextModal: route the Copy button label and the post-copy toast
      through t('copy')/t('copied') instead of hardcoded English.
    - PromptModal: route cancelText through t('cancel') and default okText
      through t('confirm') so the import-inbound prompt stops showing
      "Cancel" in non-English UI.
    - InboundsPage: pass the All-Inbounds and All-Inbounds-Subs download
      filenames through t(...) so each locale can localize them.
    - en-US.json: add pages.inbounds.exportAllLinksFileName and
      pages.inbounds.exportAllSubsFileName.
    - All 12 non-English locales: translate streamTab and sniffingTab
      (previously left as literal English) and add the two new filename
      keys with appropriate translations.
    
    All 13 locale files now have 1541 lines.
  • fix(clients): bump auto-generated email length to 10 chars
    The "create" form opened with a 9-char random email default, the bulk
    modal's random portion was only 6 chars, and the inbound-defaults seed
    used 8 — all below the 10-char minimum we want for new clients. Bring
    each generator to 10 so an unedited auto-generated email meets the
    threshold without the user having to extend it.