From d8c33ca3ee0833fb613bbdcb35eb28d7b679f696 Mon Sep 17 00:00:00 2001 From: CN-JS-HuiBai Date: Sat, 11 Apr 2026 17:46:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E4=BF=9D=E5=AD=98=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/index.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/server/index.js b/server/index.js index ca71367..de6cc96 100644 --- a/server/index.js +++ b/server/index.js @@ -566,6 +566,7 @@ app.post('/api/setup/init', ensureSetupAccess, async (req, res) => { show_server_ip TINYINT(1) DEFAULT 0, ip_metric_name VARCHAR(100) DEFAULT NULL, ip_label_name VARCHAR(100) DEFAULT 'address', + custom_metrics JSON DEFAULT NULL, updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci `); @@ -583,6 +584,7 @@ app.post('/api/setup/init', ensureSetupAccess, async (req, res) => { await connection.query("ALTER TABLE site_settings ADD COLUMN IF NOT EXISTS show_server_ip TINYINT(1) DEFAULT 0 AFTER network_data_sources"); await connection.query("ALTER TABLE site_settings ADD COLUMN IF NOT EXISTS ip_metric_name VARCHAR(100) DEFAULT NULL AFTER show_server_ip"); await connection.query("ALTER TABLE site_settings ADD COLUMN IF NOT EXISTS ip_label_name VARCHAR(100) DEFAULT 'address' AFTER ip_metric_name"); + await connection.query("ALTER TABLE site_settings ADD COLUMN IF NOT EXISTS custom_metrics JSON DEFAULT NULL AFTER ip_label_name"); await connection.query(` CREATE TABLE IF NOT EXISTS latency_routes ( id INT AUTO_INCREMENT PRIMARY KEY, @@ -951,8 +953,9 @@ app.post('/api/settings', requireAuth, async (req, res) => { id, page_name, show_page_name, title, logo_url, logo_url_dark, favicon_url, default_theme, show_95_bandwidth, p95_type, require_login_for_server_details, blackbox_source_id, latency_source, latency_dest, latency_target, - icp_filing, ps_filing, network_data_sources, show_server_ip, ip_metric_name, ip_label_name - ) VALUES (1, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) + icp_filing, ps_filing, network_data_sources, show_server_ip, ip_metric_name, ip_label_name, + custom_metrics + ) VALUES (1, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ON DUPLICATE KEY UPDATE page_name = VALUES(page_name), show_page_name = VALUES(show_page_name), @@ -973,13 +976,14 @@ app.post('/api/settings', requireAuth, async (req, res) => { network_data_sources = VALUES(network_data_sources), show_server_ip = VALUES(show_server_ip), ip_metric_name = VALUES(ip_metric_name), - ip_label_name = VALUES(ip_label_name)`, + ip_label_name = VALUES(ip_label_name), + custom_metrics = VALUES(custom_metrics)`, [ settings.page_name, settings.show_page_name, settings.title, settings.logo_url, settings.logo_url_dark, settings.favicon_url, settings.default_theme, settings.show_95_bandwidth, settings.p95_type, settings.require_login_for_server_details, settings.blackbox_source_id, settings.latency_source, settings.latency_dest, settings.latency_target, settings.icp_filing, settings.ps_filing, settings.network_data_sources, settings.show_server_ip, - settings.ip_metric_name, settings.ip_label_name + settings.ip_metric_name, settings.ip_label_name, settings.custom_metrics ] );