feat: 支持自定义订阅节点并兼容现有数据库

This commit is contained in:
2026-09-29 11:52:41 +08:00
parent 3faf960f35
commit ab7d1c937a
27 changed files with 2203 additions and 449 deletions
+13 -5
View File
@@ -7,12 +7,16 @@ import { DashboardCharts } from "./dashboard-charts";
function getNodePill(node: {
enabled: number;
node_type: "hy2" | "custom";
last_error_message: string | null;
}) {
if (!node.enabled) {
return { label: "已禁用", className: "status-pill status-pill--off" };
}
if (node.node_type === "custom")
return { label: "自定义订阅", className: "status-pill status-pill--ink" };
if (node.last_error_message) {
return { label: "同步异常", className: "status-pill status-pill--danger" };
}
@@ -66,7 +70,7 @@ export default async function DashboardPage() {
</section>
<DashboardCharts
nodeHealth={data.nodeHealth}
nodeHealth={data.nodeHealth.filter((node) => node.node_type === "hy2")}
trafficTrend={data.trafficTrend}
trafficBuckets={data.trafficBuckets}
trafficUserOptions={data.trafficUserOptions}
@@ -103,11 +107,15 @@ export default async function DashboardPage() {
</span>
</p>
<p className="muted">
在线 {node.last_online_users} / 流 {node.last_stream_count}
</p>
<p className="muted">
最近成功 {formatLocalDateTime(node.last_sync_ok_at)}
{node.node_type === "custom"
? "仅订阅 · 不参与轮询"
: `在线 ${node.last_online_users} / 流 ${node.last_stream_count}`}
</p>
{node.node_type === "hy2" && (
<p className="muted">
最近成功 {formatLocalDateTime(node.last_sync_ok_at)}
</p>
)}
{node.last_error_message ? (
<p className="error-text">{node.last_error_message}</p>
) : null}