feat: show node connection status and traffic stats in admin panel

Enable sing-box Clash/V2Ray APIs for per-user metrics, persist cumulative
traffic in SQLite, and refresh the dashboard every five seconds.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-16 09:57:16 +08:00
parent f0a3317e8b
commit ccf7e2a4c7
12 changed files with 595 additions and 3 deletions
+10
View File
@@ -61,6 +61,16 @@ fi
: "${REALITY_SHORT_ID:?}"
: "${PANEL_PASSWORD:?}"
if [[ -z "${CLASH_API_SECRET:-}" ]]; then
CLASH_API_SECRET="$(openssl rand -hex 16)"
if grep -q "^CLASH_API_SECRET=" "$ENV_FILE" 2>/dev/null; then
sed -i "s|^CLASH_API_SECRET=.*|CLASH_API_SECRET=${CLASH_API_SECRET}|" "$ENV_FILE"
else
echo "CLASH_API_SECRET=${CLASH_API_SECRET}" >> "$ENV_FILE"
fi
source "$ENV_FILE"
fi
normalize_panel_path() {
local p="${1:-}"
p="${p#/}"