feat: 接入 AnyTLS 节点托管和用户流量同步
This commit is contained in:
@@ -7,8 +7,9 @@ import { DashboardCharts } from "./dashboard-charts";
|
||||
|
||||
function getNodePill(node: {
|
||||
enabled: number;
|
||||
node_type: "hy2" | "custom";
|
||||
node_type: "hy2" | "custom" | "anytls";
|
||||
last_error_message: string | null;
|
||||
last_sync_ok_at: string | null;
|
||||
}) {
|
||||
if (!node.enabled) {
|
||||
return { label: "已禁用", className: "status-pill status-pill--off" };
|
||||
@@ -17,6 +18,13 @@ function getNodePill(node: {
|
||||
if (node.node_type === "custom")
|
||||
return { label: "自定义订阅", className: "status-pill status-pill--ink" };
|
||||
|
||||
if (
|
||||
node.node_type === "anytls" &&
|
||||
(!node.last_sync_ok_at ||
|
||||
Date.parse(node.last_sync_ok_at) < new Date().getTime() - 90_000)
|
||||
)
|
||||
return { label: "心跳超时", className: "status-pill status-pill--danger" };
|
||||
|
||||
if (node.last_error_message) {
|
||||
return { label: "同步异常", className: "status-pill status-pill--danger" };
|
||||
}
|
||||
@@ -70,7 +78,9 @@ export default async function DashboardPage() {
|
||||
</section>
|
||||
|
||||
<DashboardCharts
|
||||
nodeHealth={data.nodeHealth.filter((node) => node.node_type === "hy2")}
|
||||
nodeHealth={data.nodeHealth.filter(
|
||||
(node) => node.node_type !== "custom",
|
||||
)}
|
||||
trafficTrend={data.trafficTrend}
|
||||
trafficBuckets={data.trafficBuckets}
|
||||
trafficUserOptions={data.trafficUserOptions}
|
||||
@@ -109,9 +119,11 @@ export default async function DashboardPage() {
|
||||
<p className="muted">
|
||||
{node.node_type === "custom"
|
||||
? "仅订阅 · 不参与轮询"
|
||||
: `在线 ${node.last_online_users} / 流 ${node.last_stream_count}`}
|
||||
: node.node_type === "anytls"
|
||||
? `AnyTLS · 流 ${node.last_stream_count}`
|
||||
: `在线 ${node.last_online_users} / 流 ${node.last_stream_count}`}
|
||||
</p>
|
||||
{node.node_type === "hy2" && (
|
||||
{node.node_type !== "custom" && (
|
||||
<p className="muted">
|
||||
最近成功 {formatLocalDateTime(node.last_sync_ok_at)}
|
||||
</p>
|
||||
|
||||
Reference in New Issue
Block a user