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
+7
View File
@@ -21,6 +21,7 @@ from werkzeug.middleware.proxy_fix import ProxyFix
from db import add_node, delete_node, list_nodes, node_count, verify_admin
from links import build_links, load_env
from stats import collect_node_stats
ROOT = Path(os.environ.get("JIEDIAN_ROOT", Path(__file__).resolve().parents[1]))
SECRET_FILE = ROOT / "data" / ".panel_secret"
@@ -119,6 +120,12 @@ def dashboard():
)
@app.route("/api/stats", methods=["GET"])
@login_required
def api_stats():
return jsonify(collect_node_stats())
@app.route("/api/nodes", methods=["GET"])
@login_required
def api_list_nodes():