Commit graph

2344 commits

Author SHA1 Message Date
root
db2c78d0bb fix: add error logging for node state writes and queries
Silent error swallowing made it impossible to diagnose why worker
couldn't see master's heartbeat. Now logs errors from:
- updateNodeState upsert failures
- writeStateToSharedMariaDB connection/write failures
- getNodeStatesShared query failures
- list endpoint shows state count in logs

Also improved First() call to not overwrite state on error.

Bump version to v1.6.5.
2026-04-24 22:08:00 +08:00
root
c74b1cfb0f docs: update node management tasktracking with v1.6.4 fix 2026-04-24 21:30:42 +08:00
root
226bae2b2f fix: master heartbeat not visible to workers in shared MariaDB mode
When master uses SQLite locally, updateNodeState only wrote to local DB.
Workers querying shared MariaDB never saw the master's heartbeat.

Now master also writes its heartbeat to the shared MariaDB via a
temporary connection when MariaDB connection settings are configured.

Bump version to v1.6.4.
2026-04-24 21:29:57 +08:00
root
8f540db399 docs: update node management sidebar tasktracking with v1.6.3 fixes 2026-04-24 20:59:01 +08:00
root
d733ff2af1 fix: add node settings to defaultValueMap and settingGroups
Node settings (nodeRole, nodeId, syncInterval, trafficFlushInterval)
now have defaults in the settings system. On fresh install, they are
automatically created in x-ui.json under the 'node' group. The
settingGroupAliases now look in 'node' first, then 'other' for
backward compatibility.
2026-04-24 20:57:12 +08:00
root
d5bf2858ce fix: query shared MariaDB for node states instead of local DB
In shared mode, the master may use SQLite locally while workers
write heartbeats to the shared MariaDB. The /list endpoint now
opens a temporary MariaDB connection to query node_states when
the local DB is not MariaDB.
2026-04-24 18:01:59 +08:00
root
c1a9831e85 chore: bump version to v1.6.1 2026-04-24 17:44:17 +08:00
root
a3d8e9c55c style: apply gofmt formatting 2026-04-24 17:44:02 +08:00
root
07fecdbf86 fix: add component includes and fix API paths in nodes page 2026-04-24 17:39:01 +08:00
root
2721dd0f13 chore: bump version to v1.6.0-beta 2026-04-24 17:25:02 +08:00
root
678d35d303 fix: correct divider text and worker empty message in nodes page 2026-04-24 17:19:50 +08:00
root
8fadc148a2 docs: mark node management sidebar tasks 6-7 as done 2026-04-24 17:14:04 +08:00
root
7d75d02c1e feat: add nodes.html page with node list and config form 2026-04-24 17:13:35 +08:00
root
fe46db245e docs: update tasktracking for node management tasks 3-5 2026-04-24 17:11:13 +08:00
root
c09c618207 feat: add nodes menu item to sidebar 2026-04-24 17:10:46 +08:00
root
fc77154c8b feat: add i18n translations for node management 2026-04-24 17:10:42 +08:00
root
cb4b1eba85 feat: register NodeController routes and nodes page
- Add nodeController field and route group in api.go
- Add /panel/nodes page route in xui.go
- Verified node.go does not add duplicate checkAdmin middleware
2026-04-24 17:08:52 +08:00
root
16eb179eaf feat: add NodeController with list, getConfig, and updateConfig endpoints
Expose node management API endpoints for the cluster feature:
- GET /node/list — returns connected nodes with online status
- GET /node/config — returns current node + DB configuration
- POST /node/config — validates and persists node settings to x-ui.json
2026-04-24 17:06:11 +08:00
root
85c6b661ac feat: add GetNodeStates query for node management 2026-04-24 17:02:47 +08:00
root
67435b892b chore: bump version to v1.5.4.1-beta 2026-04-24 16:16:00 +08:00
root
f5862abc2e feat: add CodeMirror YAML editor for Clash template and fix settings save button bug
- Replace plain textarea with CodeMirror editor (YAML syntax highlighting, line numbers, auto-indent) for Clash subscription template
- Fix confAlerts crash when subClashURI/subURI/subJsonURI is null/undefined (prevented save button from enabling)
- Add yaml.js CodeMirror mode asset
- Include docs and .gitignore cleanup
2026-04-24 16:15:22 +08:00
root
582037ae70 fix: settings save button and multiple UI bugs
- Fix duplicate :min attributes on a-input-number (webPort, subPort, tgCpu)
- Fix mismatched closing tags (a-input/a-switch instead of a-input-number)
- Fix twoFactorEnable toggle receiving MouseEvent instead of boolean
- Fix noise input handlers referencing undefined global `event`
- Add error handling to settings change detection polling loop
- Bump version to v1.5.4-beta
2026-04-24 15:44:48 +08:00
root
5ec81ea3d0 fix: add error handling for Xray, geo, and toolchain downloads in CI 2026-04-24 15:09:24 +08:00
root
314c4e75d7 fix: use absolute path for toolchain find on cache miss 2026-04-24 15:05:23 +08:00
root
aadd8fdd89 style: apply gofmt formatting 2026-04-24 14:43:44 +08:00
root
96a1bc9f1f fix: resolve doubled toolchain path in CI build
The find command on cache hit returns an absolute path
(e.g., /tmp/toolchain/x86-64--musl--stable-2025.08-1),
but the PATH/CC lines were prepending /tmp/toolchain/ again,
causing /tmp/toolchain//tmp/toolchain/... to fail.
2026-04-24 14:40:58 +08:00
root
288635adfc fix: Clash YAML injection, path validation, and default template
- Quote all YAML string values with %q to prevent injection
- Remove unused host parameter from GetClash
- Add backend path normalization for SubClashPath
- Log StreamSettings JSON unmarshal errors
- Expand template panel by default and provide default template
2026-04-24 14:35:28 +08:00
root
11cdb07e89 feat: add Clash YAML subscription endpoint with template injection
Add /clash/:subid endpoint that returns complete Clash YAML config.
User provides full template (DNS, routing, proxy-groups, rules) in
settings, panel generates proxies from inbound/client data and injects
via proxies: [] placeholder replacement.

- New SubClashService reads template, generates vmess/vless/trojan/ss
  proxy entries with transport (ws/grpc/h2/tcp/httpupgrade), TLS, and
  Reality support
- Settings: subClashEnable, subClashPath, subClashURI, subClashTemplate
- UI: Clash settings tab, QR code on subpage, Desktop dropdown with
  clash-verge:// deep link preferring Clash URL
- Version bump to v1.5.2-beta
2026-04-24 11:25:10 +08:00
root
1a02ebb024 fix: MariaDB JSON_EACH compatibility for subscription and traffic queries
Replace SQLite-only JSON_EACH with DB-type branching (JSON_TABLE for
MariaDB) in subscription, client traffic, and migration queries.
Bump version to v1.5.1.
2026-04-24 10:16:48 +08:00
root
eca9b219cf docs: add missing task tracking records for multi-node and traffic fixes
Add task tracking records for commits that were missing documentation:
- 2026-04-10: multi-node backend foundation (7 commits)
- 2026-04-15: improve mariadb flow and traffic flush
- 2026-04-23: install cron before acme.sh
- 2026-04-24: resolve client traffic InboundId from DB
- 2026-04-24: fix traffic flush blocked by stale inboundId=0 delta
2026-04-24 03:04:15 +08:00
root
51f17922fa fix: resolve shared-mode traffic flush blocked by stale inboundId=0 delta
The traffic-pending.json file could contain a stale client traffic delta
with inboundId=0 (created before the InboundId resolution fix). When
flushToDatabase tried to INSERT this into client_traffics, it violated
the foreign key constraint fk_inbounds_client_stats, causing the entire
transaction to roll back and blocking ALL traffic from being written to
MariaDB.

- Skip deltas with InboundID==0 in flushToDatabase with a warning log
- Share a single TrafficPendingStore between XrayTrafficJob and the
  flush loop to eliminate a race condition from dual file instances
- Add test for zero InboundID skip behavior
2026-04-24 02:56:23 +08:00
root
157fb93f24 chore: bump version to v1.4.5-beta 2026-04-24 02:31:00 +08:00
root
99e2e6c2e2 fix: resolve client traffic InboundId from DB in shared mode, set online clients
In shared mode the Xray API returns InboundId=0 for client traffic.
Collect() now looks up the real InboundId from the client_traffics table
by email, and skips unknown emails with a warning. Also computes and
sets online clients in XrayTrafficJob since addClientTraffic is bypassed.
2026-04-24 02:29:02 +08:00
root
6784f3e738 fix: install cron before acme.sh for all distros
Add cronie (rhel/fedora/centos/arch/opensuse) and dcron (alpine) to
install_base, and ensure crond is enabled+started before acme.sh runs.
2026-04-23 17:23:44 +08:00
root
f8c572e112 fix: detect stale mariadb service file when server package is missing
has_local_mariadb_service() only checked if the systemd unit file existed,
but not whether the mariadb-server package was actually installed. When the
package was removed but the service file remained, the script would skip
server installation and fail on restart. Now verifies the server package
is installed via dpkg/rpm in addition to the unit file check.
2026-04-23 15:20:34 +08:00
root
27c2430d4f fix: show actual systemctl error when MariaDB restart fails
restart_mariadb_service() and start_mariadb_service() suppressed stderr
with 2>/dev/null, hiding the real failure reason. Now captures and displays
the systemctl error output and service status on failure for diagnostics.
2026-04-23 15:05:05 +08:00
Sora39831
df20cc7e0b feat: add local mariadb port and remote ip access controls 2026-04-22 11:20:55 +08:00
Sora39831
cc66b073a4 fix: add remote mariadb config menu, pending verification 2026-04-22 10:33:24 +08:00
Sora39831
326abb3a44 fix: avoid admin credential prompt on fresh mariadb install 2026-04-22 10:10:04 +08:00
Sora39831
fa73367e7e fix: avoid migrate blocking and allow uninstall of partial installs 2026-04-22 09:52:10 +08:00
Sora39831
afa0d5a5bd fix: accept direct panel port input in install flow 2026-04-22 09:45:56 +08:00
Sora39831
e23e69bc48 Refine MariaDB setup and uninstall behavior 2026-04-15 17:48:18 +08:00
Sora39831
e50b2f471d feat: improve mariadb flow, db settings init, and traffic flush 2026-04-15 16:58:49 +08:00
Sora39831
85cd0b60f2 docs: add multi-node shared control guidance 2026-04-10 15:33:04 +08:00
Sora39831
6b58044e00 feat: add node management shell and installer flows 2026-04-10 15:31:35 +08:00
Sora39831
87282dde33 feat: add durable traffic deltas and shared flush loop 2026-04-10 15:25:16 +08:00
Sora39831
3cfa554786 feat: add cache-backed worker sync and heartbeat loops 2026-04-10 15:15:42 +08:00
Sora39831
34b9f01d0a feat: guard shared writes and bump version transactionally 2026-04-10 11:22:49 +08:00
Sora39831
fd0af148cb feat: add shared metadata models and helpers 2026-04-10 11:16:16 +08:00
Sora39831
36826706ec feat: add node config and startup validation 2026-04-10 11:13:52 +08:00