Publish reviewed history-free open-source snapshot (2026-10-12)

This commit is contained in:
Zonghengjia Open Source
2026-10-11 23:23:20 +00:00
commit 901f27baf5
301 changed files with 32378 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
# 纵横家用户门户品牌资源
复用公司已有客户端标识,不生成或改造商标图案,无外部 CDN 依赖。
- `zonghengjia.png`:来自 Windows 项目 `assets/zonghengjia-app-logo-v1.png`,替换网页原来的绿色 T 占位标识,同时用于 favicon。
- `ucvl.png`:来自 Windows 项目 `assets/company-logo-original.png`,用于 Powered by 优创未来。
两张 PNG 按原始字节复制,透明背景不变;显示尺寸和移动端排版由 `css/portal-brand.css` 控制。
Binary file not shown.

After

Width:  |  Height:  |  Size: 616 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 531 KiB

+121
View File
@@ -0,0 +1,121 @@
:root {
--ink: #122018;
--muted: #64736a;
--paper: #f5f7f3;
--card: #ffffff;
--line: #dfe6df;
--brand: #1d6b47;
--brand-dark: #144d35;
--accent: #d6f56d;
--danger: #b94343;
--warning: #a56a10;
--shadow: 0 18px 50px rgba(22, 49, 35, .08);
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); }
body { margin: 0; min-height: 100vh; color: var(--ink); background: radial-gradient(circle at 85% 0%, rgba(214,245,109,.18), transparent 28%), var(--paper); font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }
.shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.site-header { background: rgba(255,255,255,.9); border-bottom: 1px solid var(--line); backdrop-filter: blur(14px); position: sticky; top: 0; z-index: 20; }
.header-inner { min-height: 72px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); }
.brand-mark { width: 39px; height: 39px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-weight: 800; background: var(--brand); box-shadow: 0 8px 22px rgba(29,107,71,.22); }
.brand strong, .brand small { display: block; line-height: 1.15; }
.brand strong { letter-spacing: .03em; }
.brand small { color: var(--muted); margin-top: 4px; font-size: 11px; }
.nav { display: flex; align-items: center; gap: 22px; }
.nav form { margin: 0; }
.nav a, .link-button { color: #405047; font-weight: 600; }
.link-button { border: 0; background: transparent; cursor: pointer; padding: 0; font: inherit; }
.nav-primary { border: 1px solid var(--brand); border-radius: 999px; padding: 7px 16px; }
.page { min-height: calc(100vh - 146px); padding: 58px 0 80px; }
.site-footer { border-top: 1px solid var(--line); color: var(--muted); padding: 24px 0; font-size: 13px; }
.eyebrow, .card-kicker { display: block; color: var(--brand); font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(34px, 5vw, 58px); line-height: 1.12; letter-spacing: -.04em; margin-bottom: 18px; }
h2 { font-size: 22px; line-height: 1.25; letter-spacing: -.02em; }
.muted { color: var(--muted); }
.auth-layout { min-height: 580px; display: grid; grid-template-columns: 1.15fr .85fr; gap: 9vw; align-items: center; }
.auth-copy > p { max-width: 620px; font-size: 17px; color: var(--muted); }
.feature-line { display: flex; align-items: center; gap: 16px; padding: 15px 0; border-top: 1px solid var(--line); max-width: 540px; font-weight: 650; }
.feature-line span { color: var(--brand); font-size: 12px; font-weight: 800; }
.auth-card, .narrow-card, .card { background: var(--card); border: 1px solid rgba(216,226,217,.9); border-radius: 24px; box-shadow: var(--shadow); }
.auth-card { padding: 42px; }
.narrow-card { max-width: 780px; margin: 0 auto; padding: 46px; }
.narrow-card.compact { max-width: 620px; }
.form-grid { display: grid; gap: 18px; }
.form-grid.two-column { grid-template-columns: 1fr 1fr; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid label, .form-grid p { display: grid; gap: 7px; font-weight: 700; margin: 0; }
input, select, textarea { width: 100%; border: 1px solid #cfd9d1; background: #fbfcfa; color: var(--ink); border-radius: 12px; padding: 12px 14px; font: inherit; outline: none; transition: border .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(29,107,71,.1); }
input[type="checkbox"] { width: auto; }
.checkbox-label { display: flex !important; flex-direction: row; align-items: center; font-weight: 500 !important; }
.form-grid small, .helptext { color: var(--muted); font-weight: 400; font-size: 12px; }
.form-grid ul { margin: 0; padding-left: 19px; color: var(--muted); font-size: 12px; font-weight: 400; }
.field-error, .errorlist { color: var(--danger) !important; font-size: 13px; }
.errorlist { margin: 0; }
.form-error { border-radius: 12px; background: #fff1f1; color: var(--danger); padding: 12px 14px; }
.button { appearance: none; border: 1px solid transparent; border-radius: 12px; padding: 11px 18px; font: inherit; font-weight: 750; cursor: pointer; display: inline-flex; justify-content: center; align-items: center; }
.button.primary { background: var(--brand); color: white; }
.button.primary:hover { background: var(--brand-dark); color: white; }
.button.secondary { color: var(--brand); border-color: #bdd0c3; background: #f5faf6; }
.button.ghost { color: var(--muted); background: transparent; }
.button.wide { width: 100%; }
.auth-foot { margin: 23px 0 0; text-align: center; color: var(--muted); }
.hero-row, .section-title, .card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; }
.hero-row h1 { font-size: 42px; margin: 8px 0; }
.status-pill { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 11px; font-size: 12px; font-weight: 800; background: #eef1ef; color: #5a665f; white-space: nowrap; }
.status-pill.success { background: #e6f5eb; color: #1f754a; }
.status-pill.warning { background: #fff3d9; color: #94610c; }
.status-pill.danger { background: #ffebeb; color: #a43b3b; }
.dashboard-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; margin-top: 30px; }
.card { padding: 28px; }
.card h2 { margin: 7px 0 0; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 28px 0 20px; }
.metrics div { background: #f6f8f5; border-radius: 16px; padding: 16px; }
.metrics small, .metrics strong { display: block; }
.metrics small { color: var(--muted); margin-bottom: 6px; }
.metrics strong { font-size: 19px; }
.progress { height: 8px; overflow: hidden; border-radius: 99px; background: #e9eee9; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), #79a93a); border-radius: inherit; }
.detail-list { margin: 25px 0 0; }
.detail-list div { display: flex; justify-content: space-between; border-top: 1px solid var(--line); padding: 13px 0; }
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; font-weight: 750; }
.subscription-card { margin-top: 20px; }
.copy-row { margin-top: 22px; display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.copy-row input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.notice-line, .empty-note { border-radius: 12px; padding: 11px 14px; background: #fff7e8; color: #855811; margin: 16px 0 0; }
.empty-state { text-align: center; background: white; border: 1px dashed #b7c7ba; border-radius: 24px; padding: 64px 24px; margin-top: 28px; }
.empty-icon { width: 54px; height: 54px; margin: 0 auto 18px; display: grid; place-items: center; border-radius: 18px; color: var(--brand); background: #eaf5ed; font-size: 26px; }
.section-block { margin-top: 46px; }
.section-title { align-items: center; margin-bottom: 18px; }
.section-title h2 { margin: 6px 0 0; }
.table-wrap { overflow-x: auto; background: white; border: 1px solid var(--line); border-radius: 18px; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; border-bottom: 1px solid var(--line); padding: 14px 17px; }
th { color: var(--muted); font-size: 12px; letter-spacing: .05em; }
tr:last-child td { border-bottom: 0; }
.message-stack { display: grid; gap: 8px; margin-bottom: 24px; }
.message { padding: 12px 15px; border-radius: 12px; background: #e9f4ec; color: #236845; }
.message.error { background: #ffeded; color: #a43b3b; }
@media (max-width: 850px) {
.auth-layout, .dashboard-grid { grid-template-columns: 1fr; }
.auth-layout { gap: 36px; }
.metrics { grid-template-columns: 1fr 1fr; }
.form-grid.two-column { grid-template-columns: 1fr; }
.form-grid .full { grid-column: auto; }
}
@media (max-width: 580px) {
.shell { width: min(100% - 24px, 1180px); }
.page { padding-top: 34px; }
.nav { gap: 12px; font-size: 13px; }
.auth-copy { display: none; }
.auth-card, .narrow-card, .card { padding: 23px; border-radius: 18px; }
.hero-row h1 { font-size: 32px; }
.metrics { grid-template-columns: 1fr; }
.copy-row { grid-template-columns: 1fr; }
}
+233
View File
@@ -0,0 +1,233 @@
:root {
--traffic-navy: #08234a;
--traffic-blue: #1478e6;
--traffic-cyan: #09b7dc;
--traffic-green: #0c9b71;
--traffic-red: #d64a61;
--traffic-muted: #6d8299;
--traffic-border: #d8e5f0;
--traffic-bg: #f2f7fb;
}
#content { padding: 0; }
#content-main { float: none; }
.traffic-monitor {
min-height: calc(100vh - 120px);
padding: 28px clamp(18px, 3vw, 48px) 44px;
color: var(--traffic-navy);
background:
radial-gradient(circle at 88% 2%, rgba(9, 183, 220, .13), transparent 28%),
linear-gradient(180deg, #f8fbfe 0%, var(--traffic-bg) 100%);
box-sizing: border-box;
}
.traffic-hero,
.traffic-toolbar,
.traffic-chart-heading,
.traffic-help,
.traffic-summary,
.traffic-node-strip { display: flex; }
.traffic-hero {
justify-content: space-between;
align-items: flex-start;
gap: 24px;
margin-bottom: 22px;
}
.traffic-eyebrow {
color: var(--traffic-blue);
font-size: 13px;
font-weight: 800;
letter-spacing: .08em;
}
.traffic-hero h1 {
margin: 7px 0 8px;
font-size: clamp(26px, 3vw, 38px);
line-height: 1.15;
color: var(--traffic-navy);
}
.traffic-hero p {
max-width: 760px;
margin: 0;
color: var(--traffic-muted);
font-size: 15px;
line-height: 1.7;
}
.traffic-live {
display: inline-flex;
align-items: center;
gap: 9px;
flex: 0 0 auto;
padding: 10px 14px;
border: 1px solid #cfe9df;
border-radius: 999px;
color: var(--traffic-green);
background: #edf9f5;
font-weight: 700;
}
.traffic-live i,
.node-online-dot {
width: 9px;
height: 9px;
border-radius: 50%;
background: currentColor;
box-shadow: 0 0 0 5px rgba(12, 155, 113, .12);
}
.node-online-dot { color: var(--traffic-green); }
.traffic-live.is-error { color: var(--traffic-red); border-color: #f0ccd3; background: #fff2f4; }
.traffic-toolbar {
align-items: center;
justify-content: space-between;
gap: 18px;
margin-bottom: 18px;
}
.traffic-range {
display: inline-flex;
gap: 4px;
padding: 4px;
border: 1px solid var(--traffic-border);
border-radius: 12px;
background: #fff;
}
.traffic-range button {
min-width: 76px;
padding: 8px 13px;
border: 0;
border-radius: 8px;
color: #60758a;
background: transparent;
cursor: pointer;
font: inherit;
font-weight: 700;
}
.traffic-range button.is-active { color: #fff; background: var(--traffic-blue); box-shadow: 0 4px 12px rgba(20, 120, 230, .25); }
.traffic-refresh { display: flex; gap: 12px; color: var(--traffic-muted); font-size: 13px; }
.traffic-refresh b { color: var(--traffic-blue); }
.traffic-node-strip {
gap: 12px;
overflow-x: auto;
padding: 2px 2px 12px;
scrollbar-width: thin;
}
.traffic-node,
.traffic-loading {
min-width: 245px;
border: 1px solid var(--traffic-border);
border-radius: 15px;
padding: 15px 17px;
background: rgba(255, 255, 255, .88);
box-sizing: border-box;
}
.traffic-node { text-align: left; color: var(--traffic-navy); cursor: pointer; font: inherit; transition: transform .18s, border-color .18s, box-shadow .18s; }
.traffic-node:hover { transform: translateY(-2px); border-color: #a9cdec; }
.traffic-node.is-active { border-color: var(--traffic-blue); box-shadow: 0 8px 24px rgba(21, 95, 164, .13); }
.traffic-node-head { display: flex; justify-content: space-between; gap: 10px; }
.traffic-node-name { display: flex; align-items: center; gap: 9px; font-size: 16px; font-weight: 800; }
.traffic-node.is-offline .node-online-dot { color: var(--traffic-red); box-shadow: 0 0 0 5px rgba(214, 74, 97, .1); }
.traffic-node-region { display: block; margin: 7px 0 11px 18px; color: var(--traffic-muted); font-size: 12px; }
.traffic-node-speed { display: flex; justify-content: space-between; gap: 12px; color: #48647d; font-size: 12px; }
.traffic-node-speed b { display: block; margin-top: 3px; color: var(--traffic-navy); font-size: 14px; }
.traffic-loading { min-width: 100%; color: var(--traffic-muted); text-align: center; }
.traffic-summary {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 14px;
margin: 8px 0 16px;
}
.metric-card {
position: relative;
overflow: hidden;
padding: 18px 20px;
border: 1px solid var(--traffic-border);
border-radius: 16px;
background: #fff;
box-shadow: 0 7px 24px rgba(15, 65, 105, .05);
}
.metric-card::after {
position: absolute;
content: "";
top: 0; right: 0;
width: 72px; height: 72px;
border-radius: 0 0 0 72px;
background: rgba(20, 120, 230, .06);
}
.metric-card--down::after { background: rgba(20, 120, 230, .11); }
.metric-card--up::after { background: rgba(9, 183, 220, .12); }
.metric-card span { color: var(--traffic-muted); font-size: 13px; font-weight: 700; }
.metric-card strong { display: block; margin: 8px 0 5px; color: var(--traffic-navy); font-size: clamp(22px, 2.2vw, 31px); line-height: 1; }
.metric-card small { color: #8a9bad; }
.traffic-chart-card {
padding: 22px 24px 18px;
border: 1px solid var(--traffic-border);
border-radius: 18px;
background: #fff;
box-shadow: 0 9px 30px rgba(15, 65, 105, .06);
}
.traffic-chart-heading { align-items: flex-start; justify-content: space-between; gap: 20px; }
.traffic-chart-heading h2 { margin: 5px 0 0; color: var(--traffic-navy); font-size: 21px; }
.traffic-legend { display: flex; gap: 18px; color: var(--traffic-muted); font-size: 13px; }
.traffic-legend span { display: inline-flex; align-items: center; gap: 7px; }
.traffic-legend i { width: 22px; height: 3px; border-radius: 4px; }
.legend-download { background: var(--traffic-blue); }
.legend-upload { background: var(--traffic-cyan); }
.traffic-chart-wrap { position: relative; height: clamp(280px, 40vh, 430px); margin-top: 16px; }
#traffic-chart { display: block; width: 100%; height: 100%; }
.traffic-empty { position: absolute; inset: 0; display: grid; place-items: center; color: #8da0b1; pointer-events: none; }
.traffic-tooltip { position: absolute; z-index: 3; min-width: 150px; padding: 9px 11px; border: 1px solid var(--traffic-border); border-radius: 9px; color: var(--traffic-navy); background: rgba(255,255,255,.96); box-shadow: 0 8px 22px rgba(8,35,74,.14); font-size: 12px; pointer-events: none; }
.traffic-tooltip b { display: block; margin-bottom: 4px; }
.traffic-tooltip span { display: block; line-height: 1.6; }
.traffic-help {
align-items: center;
gap: 28px;
margin-top: 16px;
padding: 16px 20px;
border: 1px solid #dbe8f2;
border-radius: 14px;
color: var(--traffic-muted);
background: rgba(255,255,255,.68);
}
.traffic-help div { display: flex; gap: 8px; flex: 1; }
.traffic-help b { flex: 0 0 auto; color: var(--traffic-navy); }
.traffic-help a { flex: 0 0 auto; padding: 9px 14px; border-radius: 9px; color: #fff; background: var(--traffic-blue); text-decoration: none; font-weight: 700; }
@media (max-width: 980px) {
.traffic-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.traffic-help { align-items: stretch; flex-direction: column; gap: 10px; }
.traffic-help a { align-self: flex-start; }
}
@media (max-width: 650px) {
.traffic-monitor { padding: 18px 12px 30px; }
.traffic-hero, .traffic-toolbar { align-items: stretch; flex-direction: column; }
.traffic-live { align-self: flex-start; }
.traffic-range { display: grid; grid-template-columns: repeat(4, 1fr); }
.traffic-range button { min-width: 0; padding-inline: 7px; }
.traffic-refresh { justify-content: space-between; }
.traffic-summary { grid-template-columns: 1fr; }
.traffic-chart-card { padding: 18px 12px 12px; }
.traffic-chart-heading { align-items: flex-start; flex-direction: column; }
.traffic-chart-wrap { height: 300px; }
}
+159
View File
@@ -0,0 +1,159 @@
/* Shared portal brand layer; no external fonts, icon services or scripts. */
:root {
--ink: #142d52; --muted: #61738f; --paper: #f4f8fe; --line: #dce7f5;
--brand: #095fe5; --brand-dark: #0648b0; --accent: #06b6e8;
--shadow: 0 4px 18px rgba(29,71,133,.045);
}
body { background: radial-gradient(ellipse at 85% 0%, #e5f3ff 0, transparent 40%), var(--paper); font-size: 14px; line-height: 1.65; }
:focus-visible { outline: 3px solid #0078d4; outline-offset: 4px; }
.shell { width: min(1160px, calc(100% - 48px)); }
.skip-link { position: absolute; left: 20px; top: -70px; padding: 10px 16px; background: white; z-index: 50; }
.skip-link:focus { top: 10px; }
.site-header { background: rgba(255,255,255,.94); position: static; }
.header-inner { min-height: 86px; gap: 24px; }
.brand { gap: 12px; flex-shrink: 0; }
.brand-mark { width: 52px; height: 52px; object-fit: contain; background: none; box-shadow: none; border-radius: 0; }
.brand strong, .brand small { line-height: 1.3; }
.brand strong { font-size: 23px; letter-spacing: .025em; color: #102e60; }
.brand small { font-size: 12px; letter-spacing: .08em; }
.company-brand { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.company-brand img { object-fit: contain; }
.company-brand b { font-weight: 600; white-space: nowrap; }
.company-brand small { display: block; color: var(--muted); font-size: 10px; letter-spacing: .16em; }
.nav-bar { border-top: 1px solid #edf3fa; background: #fbfdff; }
.nav-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 46px; }
.nav-caption { color: var(--muted); font-size: 12px; }
.nav { flex-wrap: wrap; gap: 4px 20px; }
.nav a, .link-button { color: #46607f; padding: 10px 0; display: inline-block; }
.nav [aria-current="page"] { color: var(--brand); box-shadow: inset 0 -2px var(--brand); }
.nav a:hover, .link-button:hover { color: var(--brand); }
.nav a.nav-primary { padding: 5px 14px; border: 0; border-radius: 8px; color: var(--brand); background: #eaf3ff; }
.page { min-height: calc(100vh - 207px); padding: 32px 0 48px; }
.site-footer { padding: 20px 0; font-size: 12px; background: #f9fbff; }
.footer-inner { display: flex; justify-content: space-between; gap: 16px; }
.eyebrow, .card-kicker { font-size: 11px; font-weight: 750; letter-spacing: .1em; }
h1 { font-size: clamp(28px, 3.2vw, 40px); line-height: 1.4; letter-spacing: -.025em; margin-bottom: 16px; }
h2 { font-size: 20px; line-height: 1.4; }
.icon { width: 24px; height: 24px; flex-shrink: 0; }
.auth-layout { min-height: 510px; grid-template-columns: 1.1fr 1fr; gap: 70px; }
.auth-copy .eyebrow { margin-bottom: 14px; }
.auth-copy > p { max-width: 510px; font-size: 15px; }
.feature-line { max-width: 480px; font-weight: 500; }
.auth-card, .narrow-card, .card { min-width: 0; border-color: var(--line); border-radius: 16px; }
.auth-card, .narrow-card { padding: 34px; }
.narrow-card.compact { max-width: 640px; }
.form-grid label, .form-grid p { font-weight: 650; min-width: 0; }
input, select, textarea { min-width: 0; border-color: #c9d8ea; background: #fbfdff; border-radius: 9px; padding: 11px 13px; }
input:focus, select:focus, textarea:focus { box-shadow: 0 0 0 3px #095fe512; }
.form-error { border-radius: 9px; }
.button { border-radius: 9px; padding: 10px 18px; font-weight: 650; gap: 8px; min-height: 42px; }
.button .icon { width: 18px; height: 18px; }
.button.primary { background: linear-gradient(120deg, #0870f5, #095bda); box-shadow: 0 3px 8px #095fe51a; }
.button.secondary { border-color: #cadcf6; background: #f5f9ff; }
.button.secondary:hover { background: #eaf3ff; }
.wecom-login { margin-top: 14px; }
.hero-row, .section-title, .card-head { gap: 20px; }
.hero-row { align-items: center; margin-bottom: 24px; }
.hero-row h1 { font-size: 28px; margin: 3px 0 6px; overflow-wrap: anywhere; }
.hero-row p { margin-bottom: 0; }
.account-meta { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; color: var(--muted); overflow-wrap: anywhere; }
.identity-badge { background: #e5efff; color: #1658ab; border-radius: 6px; padding: 2px 9px; font-size: 12px; }
.status-pill { padding: 4px 10px; font-weight: 650; background: #edf1f7; color: #5d6c82; }
.status-pill.success { background: #e5f6ef; color: #147653; }
.status-pill.warning { background: #fff2d7; color: #805509; }
.account-status { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; flex-shrink: 0; }
.dashboard-grid { gap: 18px; margin-top: 0; }
.card { padding: 24px; }
.card h2 { margin: 5px 0 0; }
.heading-icon { display: flex; align-items: center; gap: 12px; }
.icon-tile { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; flex-shrink: 0; border: 1px solid #dfebff; border-radius: 12px; background: #f0f6ff; color: var(--brand); }
.metrics { grid-template-columns: repeat(2, 1fr); margin: 22px 0 16px; }
.metrics div { background: #f6f9fe; border-radius: 10px; padding: 14px; }
.metrics small { margin-bottom: 5px; }
.metrics strong { font-size: 20px; color: #155fca; overflow-wrap: anywhere; }
.progress { height: 7px; background: #e8eff9; }
.progress span { max-width: 100%; background: linear-gradient(90deg, var(--brand), var(--accent)); }
.detail-list { margin-top: 20px; }
.detail-list div { gap: 12px; padding: 12px 0; }
.detail-list dd { font-weight: 650; }
.subscription-card { margin-top: 18px; }
.subscription-card h2 { font-size: 18px; }
.subscription-card p { margin-bottom: 0; }
.copy-row { margin-top: 18px; }
.copy-feedback { min-height: 20px; font-size: 12px; color: var(--muted); margin: 6px 0 0; }
.notice-line, .empty-note { border-radius: 9px; padding: 10px 13px; background: #fff8e9; color: #805510; margin: 14px 0; font-size: 13px; }
.empty-state { display: grid; grid-template-columns: 1.35fr 1fr; gap: 36px; text-align: left; background: linear-gradient(115deg, #fff 45%, #f2f8ff); border: 1px solid var(--line); border-radius: 16px; padding: 30px; margin-top: 0; box-shadow: var(--shadow); }
.empty-state h2 { font-size: 24px; margin: 12px 0 8px; }
.empty-state p { color: var(--muted); max-width: 470px; margin-bottom: 18px; }
.setup-steps { list-style: none; margin: 0; padding: 4px 0 4px 30px; border-left: 1px solid var(--line); display: grid; align-content: center; gap: 20px; }
.setup-steps li { display: flex; align-items: flex-start; gap: 12px; }
.step-number { display: grid; place-items: center; width: 28px; height: 28px; flex-shrink: 0; background: #e9f2ff; border-radius: 8px; color: var(--brand); font-size: 12px; font-weight: 750; }
.setup-steps small { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.section-block { margin-top: 26px; }
.lifecycle { margin-bottom: 20px; }
.lifecycle-track { display: flex; list-style: none; padding: 0; margin: 20px 0; gap: 0; overflow-x: auto; }
.lifecycle-track li { flex: 1; min-width: 90px; display: flex; flex-direction: column; align-items: center; gap: 8px; border-top: 3px solid #e1e9f4; padding: 12px 6px 2px; color: #64748b; font-size: 13px; text-align: center; }
.lifecycle-track li.done { border-color: #329f87; color: #176c55; }
.lifecycle-track li.current { border-color: #095fe5; color: #095fe5; font-weight: 700; background: #eef5ff; border-radius: 0 0 8px 8px; }
.lifecycle-dot { display: grid; place-items: center; width: 26px; height: 26px; border: 1px solid currentColor; border-radius: 50%; }
.lifecycle.attention .notice-line { color: #895700; background: #fff9eb; }
.team-shortcuts { margin: 0 0 20px; flex-wrap: wrap; gap: 14px; }
.section-title { margin-bottom: 14px; }
.section-title h2 { margin: 0; font-size: 18px; }
.section-title .icon { color: var(--brand); width: 21px; height: 21px; }
.section-subtitle { color: var(--muted); margin: 4px 0 0; font-size: 12px; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 16px; }
.plan-card { display: flex; flex-direction: column; }
.plan-card h2 { font-size: 18px; }
.plan-card .plan-label { color: var(--brand); font-size: 17px; font-weight: 650; margin: 16px 0 10px; }
.plan-card .button { margin-top: auto; align-self: flex-start; }
.plan-card .muted { font-size: 13px; }
.table-wrap { border-radius: 12px; }
th, td { padding: 13px 16px; }
th { background: #f8fbff; white-space: nowrap; }
td { font-size: 13px; }
.records-empty { display: flex; align-items: center; gap: 16px; padding: 22px 24px; }
.records-empty p { margin: 3px 0 0; font-size: 13px; }
.message { border-radius: 9px; }
@media (max-width: 900px) {
.auth-layout { gap: 32px; }
.dashboard-grid { grid-template-columns: 1fr; }
.nav-caption { display: none; }
.nav-inner { justify-content: flex-end; }
}
@media (max-width: 640px) {
.shell { width: calc(100% - 28px); }
.page { padding: 24px 0 32px; }
.header-inner { min-height: 78px; gap: 12px; }
.brand { gap: 8px; }
.brand strong { font-size: 19px; }
.brand small { font-size: 10px; }
.brand-mark { width: 42px; height: 48px; }
.company-brand { font-size: 10px; gap: 6px; }
.company-brand img { width: 28px; height: 26px; }
.company-brand small { display: none; }
.company-brand > span { max-width: 68px; }
.company-brand .powered-label { display: block; }
.nav { gap: 0 16px; font-size: 12px; }
.nav-inner { justify-content: flex-start; }
.auth-layout, .empty-state { grid-template-columns: 1fr; }
.auth-layout { min-height: 0; }
.auth-copy { display: none; }
.auth-card, .narrow-card, .card { padding: 20px; border-radius: 12px; }
.hero-row { gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.hero-row h1 { font-size: 24px; }
.account-meta { font-size: 12px; }
.empty-state { padding: 22px; gap: 22px; }
.empty-state h2 { font-size: 22px; }
.setup-steps { border-left: 0; border-top: 1px solid var(--line); padding: 20px 0 0; gap: 16px; }
.form-grid.two-column { grid-template-columns: 1fr; }
.form-grid .full { grid-column: auto; }
.metrics { grid-template-columns: 1fr 1fr; }
.metrics strong { font-size: 18px; }
.lifecycle-track li { min-width: 0; padding: 10px 2px 2px; font-size: 11px; }
.copy-row { grid-template-columns: 1fr; }
.section-title { gap: 12px; }
.section-title .button { padding: 8px 12px; font-size: 12px; }
.footer-inner { flex-direction: column; gap: 4px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; } }
+144
View File
@@ -0,0 +1,144 @@
:root {
--vpn-navy: #062247;
--vpn-blue: #087fda;
--vpn-cyan: #12b9ea;
--vpn-line: #a9c9df;
--vpn-bg: #f3f7fb;
--vpn-ok: #16875b;
--vpn-warn: #b66b00;
--vpn-bad: #bf3e4c;
}
#content { padding: 0; }
#content-main { float: none; width: auto; }
.vpn-dashboard { background: var(--vpn-bg); min-height: calc(100vh - 70px); padding: 26px clamp(18px, 3vw, 46px) 46px; color: #17334f; }
.dashboard-hero { display: flex; align-items: stretch; justify-content: space-between; gap: 28px; margin-bottom: 22px; }
.dashboard-hero h1 { margin: 5px 0 7px; color: var(--vpn-navy); font-size: clamp(25px, 2.4vw, 38px); line-height: 1.2; }
.dashboard-hero p { margin: 0; color: #60778c; font-size: 15px; }
.eyebrow, .step-label { color: var(--vpn-blue); font-weight: 700; letter-spacing: .08em; }
.next-action { align-items: flex-start; background: #fff; border: 1px solid #dce8f1; border-left: 5px solid var(--vpn-ok); border-radius: 14px; box-shadow: 0 8px 24px rgba(28, 67, 99, .08); color: #39536b !important; display: flex; flex-direction: column; justify-content: center; min-width: 300px; padding: 15px 20px; text-decoration: none; }
.next-action.is-warning { border-left-color: var(--vpn-warn); }
.next-action span { color: #7890a5; font-size: 12px; }
.next-action strong { color: var(--vpn-navy); font-size: 16px; margin-top: 4px; }
.workflow-tabs { background: #dfeaf2; border: 1px solid #cadbe7; border-radius: 16px; display: grid; gap: 1px; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 22px; overflow: hidden; padding: 1px; }
.workflow-tab { background: #f8fbfd; border: 0; color: #536e84; cursor: pointer; display: flex; flex-direction: column; min-height: 88px; padding: 14px 18px; position: relative; text-align: left; }
.workflow-tab::after { background: transparent; bottom: 0; content: ""; height: 4px; left: 0; position: absolute; right: 0; }
.workflow-tab:hover { background: #fff; }
.workflow-tab:focus-visible { box-shadow: inset 0 0 0 3px rgba(8, 127, 218, .35); outline: 0; z-index: 2; }
.workflow-tab.is-active { background: #fff; color: var(--vpn-blue); }
.workflow-tab.is-active::after { background: linear-gradient(90deg, var(--vpn-cyan), var(--vpn-blue)); }
.workflow-tab span { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.workflow-tab strong { color: var(--vpn-navy); font-size: 17px; margin: 3px 0 4px; }
.workflow-tab small { color: #748a9c; font-size: 12px; }
.workflow-tab-panel[hidden] { display: none; }
.workflow-panel { background: #fff; border: 1px solid #dbe7f0; border-radius: 18px; box-shadow: 0 10px 30px rgba(16, 55, 86, .07); margin-bottom: 22px; overflow: hidden; padding: 22px 22px 8px; }
.workflow-panel--ai { border-top: 4px solid var(--vpn-cyan); }
.workflow-panel--nodes { border-top: 4px solid var(--vpn-blue); }
.workflow-panel--security { border-top: 4px solid var(--vpn-warn); }
.section-heading { align-items: center; display: flex; justify-content: space-between; gap: 18px; }
.section-heading h2 { color: var(--vpn-navy); font-size: 22px; margin: 3px 0 0; }
.section-heading p, .workflow-note { color: #6b8093; margin: 0; }
.workflow-note { background: #eef9fd; border-radius: 9px; margin-top: 14px; padding: 10px 13px; }
.runtime-pill { align-items: center; background: #fff4f4; border-radius: 999px; color: var(--vpn-bad); display: flex; font-weight: 700; gap: 7px; padding: 8px 13px; }
.runtime-pill i { background: currentColor; border-radius: 50%; height: 8px; width: 8px; }
.runtime-pill.is-ok { background: #eaf8f1; color: var(--vpn-ok); }
.ai-flow-legend { display: flex; gap: 10px; justify-content: center; margin: 18px 0 6px; }
.ai-flow-legend span { border-radius: 999px; font-size: 11px; font-weight: 700; padding: 5px 11px; }
.legend-start { background: var(--vpn-navy); color: #fff; }
.legend-action { background: #e9f5fd; color: var(--vpn-blue); }
.legend-state { background: #fff5dc; color: #926000; }
.ai-action-flow { align-items: center; display: flex; flex-direction: column; margin: 10px auto 24px; max-width: 1120px; padding: 8px 14px; }
.ai-flow-terminal, .ai-flow-action, .ai-flow-state { border-radius: 14px; box-sizing: border-box; display: flex; flex-direction: column; min-height: 82px; justify-content: center; padding: 13px 18px; text-align: center; width: 400px; }
.ai-flow-terminal { background: linear-gradient(135deg, var(--vpn-navy), #0a4a82); color: #fff; width: 340px; }
.ai-flow-terminal--end { background: linear-gradient(135deg, var(--vpn-blue), #0d61ba); }
.ai-flow-terminal span, .ai-flow-action span, .ai-flow-state span { font-size: 11px; font-weight: 800; letter-spacing: .06em; }
.ai-flow-terminal strong, .ai-flow-action strong, .ai-flow-state strong { font-size: 15px; line-height: 1.35; margin-top: 4px; }
.ai-flow-action { background: #edf8ff; border: 2px solid #8dccf0; box-shadow: 0 7px 18px rgba(15, 99, 156, .08); color: var(--vpn-navy) !important; text-decoration: none; }
.ai-flow-action span { color: var(--vpn-blue); }
.ai-flow-action small, .ai-flow-state small, .ai-flow-side-result small { color: #71879a; font-size: 12px; margin-top: 4px; }
.ai-flow-action:hover { background: #e2f4ff; border-color: var(--vpn-blue); }
.ai-flow-state { background: #fff8e8; border: 2px solid #e6bd68; color: #543b0c; position: relative; }
.ai-flow-state::before { background: #fff8e8; border-left: 2px solid #e6bd68; border-top: 2px solid #e6bd68; content: ""; height: 18px; left: 50%; position: absolute; top: -11px; transform: translateX(-50%) rotate(45deg); width: 18px; }
.ai-flow-state span { color: #9a6807; }
.ai-flow-arrow { height: 39px; position: relative; width: 4px; }
.ai-flow-arrow::before { background: var(--vpn-blue); bottom: 7px; content: ""; left: 1px; position: absolute; top: 0; width: 2px; }
.ai-flow-arrow::after { border-left: 6px solid transparent; border-right: 6px solid transparent; border-top: 8px solid var(--vpn-blue); bottom: 0; content: ""; left: -4px; position: absolute; }
.ai-flow-arrow span { background: #fff; border: 1px solid #b8d6e9; border-radius: 999px; color: var(--vpn-blue); font-size: 11px; font-weight: 800; left: 13px; padding: 2px 7px; position: absolute; top: 8px; z-index: 2; }
.ai-flow-decision-row { display: grid; gap: 64px; grid-template-columns: 1fr 400px 1fr; position: relative; width: 100%; }
.ai-flow-state { grid-column: 2; }
.ai-flow-side-result { align-self: center; border: 1px solid; border-radius: 12px; display: flex; flex-direction: column; min-height: 70px; justify-content: center; padding: 11px 14px; position: relative; text-align: center; text-decoration: none; }
.ai-flow-side-result b { border-radius: 999px; color: currentColor; font-size: 11px; left: 50%; padding: 2px 7px; position: absolute; top: -12px; transform: translateX(-50%); }
.ai-flow-side-result strong { color: #183a58; font-size: 13px; }
.ai-flow-side-result--left { grid-column: 1; }
.ai-flow-side-result--right { grid-column: 3; }
.ai-flow-side-result--left::after, .ai-flow-side-result--right::before { border-top: 2px solid #9bc3da; content: ""; position: absolute; top: 50%; width: 64px; }
.ai-flow-side-result--left::after { right: -65px; }
.ai-flow-side-result--right::before { left: -65px; }
.ai-flow-side-result.status-ok b { background: #dff4e9; }
.ai-flow-side-result.status-warn b { background: #ffedc6; }
.ai-flow-side-result.status-bad b { background: #ffe0e3; }
.fishbone-scroll { overflow-x: auto; padding: 12px 2px 2px; scrollbar-color: #b7cddd transparent; }
.fishbone { --stage-count: 5; height: 360px; min-width: 1190px; position: relative; }
.fishbone-spine { background: linear-gradient(90deg, var(--vpn-cyan), var(--vpn-blue)); border-radius: 8px; height: 8px; left: 112px; position: absolute; right: 112px; top: 184px; }
.fishbone-spine::after { border-bottom: 11px solid transparent; border-left: 18px solid var(--vpn-blue); border-top: 11px solid transparent; content: ""; position: absolute; right: -14px; top: -7px; }
.fishbone-start, .fishbone-end { background: var(--vpn-navy); border: 4px solid #d9ecf8; border-radius: 50%; color: white; display: flex; flex-direction: column; height: 90px; justify-content: center; position: absolute; text-align: center; top: 142px; width: 90px; z-index: 3; }
.fishbone-start { left: 0; }
.fishbone-end { right: 0; }
.fishbone-end { background: linear-gradient(135deg, var(--vpn-blue), #0c5db8); }
.fishbone-start span, .fishbone-end span { font-size: 11px; opacity: .72; }
.fishbone-start strong, .fishbone-end strong { font-size: 13px; line-height: 1.3; padding: 0 7px; }
.bone-stage { position: absolute; top: 0; transform: translateX(-50%); width: 170px; }
.stage-status { background: #f7fbfe; border: 1px solid #cfe2ef; border-radius: 11px; box-shadow: 0 6px 15px rgba(28, 75, 108, .07); color: #526c82 !important; display: flex; flex-direction: column; min-height: 53px; padding: 10px 12px; position: absolute; text-align: center; text-decoration: none; top: 8px; width: 146px; }
.stage-status::after { background: currentColor; content: ""; height: 50px; left: 50%; opacity: .35; position: absolute; top: 100%; width: 2px; }
.stage-status span { font-size: 11px; }
.stage-status strong { color: #183a58; font-size: 13px; line-height: 1.3; margin-top: 3px; }
.status-ok { background: #edf9f3; border-color: #bde3d1; color: var(--vpn-ok) !important; }
.status-warn { background: #fff7e9; border-color: #f0d39b; color: var(--vpn-warn) !important; }
.status-bad { background: #fff0f1; border-color: #efbec4; color: var(--vpn-bad) !important; }
.status-info { background: #eef8fd; border-color: #bfdeef; color: var(--vpn-blue) !important; }
.stage-node { align-items: center; background: white; border: 4px solid var(--vpn-blue); border-radius: 50%; box-shadow: 0 5px 15px rgba(8, 88, 151, .18); color: var(--vpn-navy) !important; display: flex; flex-direction: column; height: 78px; justify-content: center; left: 38px; position: absolute; text-align: center; text-decoration: none; top: 143px; width: 78px; z-index: 4; }
.stage-node:hover { background: #edf8ff; transform: translateY(-2px); }
.stage-node b { color: var(--vpn-blue); font-size: 12px; }
.stage-node span { font-size: 13px; font-weight: 700; line-height: 1.2; max-width: 68px; }
.stage-actions { background: #f8fbfd; border: 1px solid #d8e6ef; border-radius: 10px; display: flex; flex-direction: column; gap: 5px; left: 1px; min-height: 58px; padding: 10px 12px; position: absolute; top: 267px; width: 144px; }
.stage-actions::before { background: var(--vpn-line); content: ""; height: 64px; left: 50%; position: absolute; top: -65px; transform: rotate(31deg); transform-origin: bottom; width: 2px; z-index: 1; }
.stage-actions a, .stage-actions span { font-size: 12px; line-height: 1.25; position: relative; text-align: center; z-index: 2; }
.stage-actions a { color: #0869ae; font-weight: 650; text-decoration: none; }
.stage-actions span { color: #73899a; }
.isolated-tools { display: grid; gap: 16px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.isolated-tools a { background: #fff; border: 1px solid #dbe7f0; border-radius: 14px; color: #4d667b !important; display: flex; flex-direction: column; min-height: 98px; padding: 17px 20px; text-decoration: none; }
.isolated-tools a:hover { border-color: #8bc9ea; box-shadow: 0 8px 24px rgba(21, 82, 123, .08); }
.isolated-tools span { color: var(--vpn-blue); font-size: 12px; font-weight: 700; }
.isolated-tools strong { color: var(--vpn-navy); font-size: 17px; margin: 5px 0; }
.isolated-tools small { color: #71879a; }
@media (max-width: 900px) {
.vpn-dashboard { padding: 18px 12px 34px; }
.dashboard-hero, .section-heading { align-items: stretch; flex-direction: column; }
.next-action { min-width: 0; }
.isolated-tools { grid-template-columns: 1fr; }
.workflow-panel { padding-left: 14px; padding-right: 14px; }
.workflow-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ai-flow-decision-row { gap: 24px; grid-template-columns: minmax(145px, 1fr) minmax(260px, 1.5fr) minmax(145px, 1fr); }
.ai-flow-terminal, .ai-flow-action, .ai-flow-state { max-width: 100%; width: 360px; }
.ai-flow-decision-row .ai-flow-state { width: auto; }
.ai-flow-side-result--left::after, .ai-flow-side-result--right::before { width: 24px; }
.ai-flow-side-result--left::after { right: -25px; }
.ai-flow-side-result--right::before { left: -25px; }
}
@media (max-width: 520px) {
.workflow-tabs { display: flex; overflow-x: auto; }
.workflow-tab { flex: 0 0 190px; }
.ai-flow-legend { flex-wrap: wrap; }
.ai-action-flow { align-items: stretch; padding-left: 0; padding-right: 0; }
.ai-flow-terminal, .ai-flow-action, .ai-flow-state { margin: 0 auto; width: min(100%, 360px); }
.ai-flow-decision-row { display: flex; flex-direction: column; gap: 12px; }
.ai-flow-side-result { margin: 0 auto; order: 2; width: min(86%, 320px); }
.ai-flow-side-result--left::after, .ai-flow-side-result--right::before { display: none; }
}
+214
View File
@@ -0,0 +1,214 @@
(() => {
"use strict";
const root = document.querySelector(".traffic-monitor");
if (!root) return;
const endpoint = root.dataset.endpoint;
const nodeStrip = document.getElementById("traffic-nodes");
const canvas = document.getElementById("traffic-chart");
const empty = document.getElementById("traffic-empty");
const tooltip = document.getElementById("traffic-tooltip");
const ctx = canvas.getContext("2d");
const state = { minutes: 60, nodes: [], selectedId: null, points: [] };
let loading = false;
const formatRate = (bytesPerSecond) => {
const bits = Number(bytesPerSecond || 0) * 8;
if (bits >= 1e9) return `${(bits / 1e9).toFixed(2)} Gbps`;
if (bits >= 1e6) return `${(bits / 1e6).toFixed(2)} Mbps`;
if (bits >= 1e3) return `${(bits / 1e3).toFixed(1)} Kbps`;
return `${Math.round(bits)} bps`;
};
const formatBytes = (bytes) => {
let value = Number(bytes || 0);
const units = ["B", "KB", "MB", "GB", "TB"];
let unit = 0;
while (value >= 1024 && unit < units.length - 1) { value /= 1024; unit += 1; }
return `${value.toFixed(unit === 0 ? 0 : value >= 100 ? 0 : value >= 10 ? 1 : 2)} ${units[unit]}`;
};
const formatTime = (value, includeDate = false) => {
if (!value) return "尚未上报";
return new Intl.DateTimeFormat("zh-CN", {
month: includeDate ? "2-digit" : undefined,
day: includeDate ? "2-digit" : undefined,
hour: "2-digit",
minute: "2-digit",
second: includeDate ? undefined : "2-digit",
hour12: false,
}).format(new Date(value));
};
const selectedNode = () => state.nodes.find((node) => node.id === state.selectedId) || state.nodes[0];
function renderNodes() {
if (!state.nodes.length) {
nodeStrip.innerHTML = '<div class="traffic-loading">尚未配置可用节点</div>';
return;
}
nodeStrip.innerHTML = state.nodes.map((node) => `
<button type="button" class="traffic-node ${node.online ? "" : "is-offline"} ${node.id === state.selectedId ? "is-active" : ""}" data-node-id="${node.id}">
<span class="traffic-node-head">
<span class="traffic-node-name"><i class="node-online-dot"></i>${escapeHtml(node.name)}</span>
<small>${node.online ? "在线" : "离线"}</small>
</span>
<span class="traffic-node-region">${escapeHtml(node.slug)} · ${escapeHtml(node.region)}</span>
<span class="traffic-node-speed">
<span>下载<b>${formatRate(node.current_download_bytes_per_second)}</b></span>
<span>上传<b>${formatRate(node.current_upload_bytes_per_second)}</b></span>
</span>
</button>
`).join("");
nodeStrip.querySelectorAll("[data-node-id]").forEach((button) => {
button.addEventListener("click", () => {
state.selectedId = Number(button.dataset.nodeId);
render();
});
});
}
function renderSummary(node) {
const set = (id, value) => { document.getElementById(id).textContent = value; };
if (!node) {
["current-download", "current-upload", "total-traffic", "active-subscriptions"].forEach((id) => set(id, "--"));
set("chart-title", "请选择节点");
return;
}
set("current-download", formatRate(node.current_download_bytes_per_second));
set("current-upload", formatRate(node.current_upload_bytes_per_second));
set("total-traffic", formatBytes(node.total_upload_bytes + node.total_download_bytes));
set("total-breakdown", `上传 ${formatBytes(node.total_upload_bytes)} · 下载 ${formatBytes(node.total_download_bytes)}`);
set("active-subscriptions", `${node.active_subscriptions} 个`);
set("last-seen", node.last_seen_at ? `最后上报 ${formatTime(node.last_seen_at)}` : "等待节点上报");
set("chart-title", `${node.name} · ${node.region}`);
}
function escapeHtml(value) {
return String(value ?? "").replace(/[&<>'"]/g, (char) => ({
"&": "&amp;", "<": "&lt;", ">": "&gt;", "'": "&#39;", '"': "&quot;",
})[char]);
}
function drawChart(node) {
const samples = node?.samples || [];
empty.hidden = samples.length > 0;
tooltip.hidden = true;
const rect = canvas.getBoundingClientRect();
const dpr = Math.max(1, window.devicePixelRatio || 1);
canvas.width = Math.round(rect.width * dpr);
canvas.height = Math.round(rect.height * dpr);
ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
ctx.clearRect(0, 0, rect.width, rect.height);
state.points = [];
if (!samples.length || rect.width < 120 || rect.height < 100) return;
const pad = { top: 18, right: 18, bottom: 30, left: 67 };
const width = rect.width - pad.left - pad.right;
const height = rect.height - pad.top - pad.bottom;
const start = Date.now() - state.minutes * 60 * 1000;
const end = Date.now();
const maxBps = Math.max(1, ...samples.flatMap((sample) => [sample.upload_bytes_per_second, sample.download_bytes_per_second]));
const topBps = maxBps * 1.15;
const xFor = (at) => pad.left + Math.max(0, Math.min(1, (new Date(at).getTime() - start) / (end - start))) * width;
const yFor = (value) => pad.top + height - (Number(value || 0) / topBps) * height;
ctx.font = "12px system-ui, sans-serif";
ctx.lineWidth = 1;
for (let row = 0; row <= 4; row += 1) {
const y = pad.top + (height * row / 4);
ctx.strokeStyle = "#e6eef5";
ctx.beginPath(); ctx.moveTo(pad.left, y); ctx.lineTo(rect.width - pad.right, y); ctx.stroke();
ctx.fillStyle = "#8294a7";
ctx.textAlign = "right";
ctx.fillText(formatRate(topBps * (1 - row / 4)), pad.left - 10, y + 4);
}
for (let col = 0; col <= 4; col += 1) {
const x = pad.left + width * col / 4;
ctx.fillStyle = "#8294a7";
ctx.textAlign = col === 0 ? "left" : col === 4 ? "right" : "center";
ctx.fillText(formatTime(start + (end - start) * col / 4, state.minutes >= 1440), x, rect.height - 7);
}
const drawSeries = (field, color, fillColor) => {
const gradient = ctx.createLinearGradient(0, pad.top, 0, pad.top + height);
gradient.addColorStop(0, fillColor);
gradient.addColorStop(1, "rgba(255,255,255,0)");
ctx.beginPath();
samples.forEach((sample, index) => {
const x = xFor(sample.at); const y = yFor(sample[field]);
index ? ctx.lineTo(x, y) : ctx.moveTo(x, y);
});
const last = samples[samples.length - 1]; const first = samples[0];
ctx.lineTo(xFor(last.at), pad.top + height);
ctx.lineTo(xFor(first.at), pad.top + height);
ctx.closePath(); ctx.fillStyle = gradient; ctx.fill();
ctx.beginPath();
samples.forEach((sample, index) => {
const x = xFor(sample.at); const y = yFor(sample[field]);
index ? ctx.lineTo(x, y) : ctx.moveTo(x, y);
});
ctx.strokeStyle = color; ctx.lineWidth = 2.5; ctx.lineJoin = "round"; ctx.lineCap = "round"; ctx.stroke();
};
drawSeries("download_bytes_per_second", "#1478e6", "rgba(20,120,230,.16)");
drawSeries("upload_bytes_per_second", "#09b7dc", "rgba(9,183,220,.09)");
state.points = samples.map((sample) => ({ x: xFor(sample.at), sample }));
}
function render() {
if (!state.selectedId && state.nodes.length) state.selectedId = state.nodes[0].id;
if (state.selectedId && !state.nodes.some((node) => node.id === state.selectedId)) state.selectedId = state.nodes[0]?.id || null;
renderNodes();
const node = selectedNode();
renderSummary(node);
drawChart(node);
}
async function refresh() {
if (loading) return;
loading = true;
const live = document.getElementById("traffic-live");
try {
const response = await fetch(`${endpoint}?minutes=${state.minutes}`, { credentials: "same-origin", cache: "no-store" });
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const data = await response.json();
state.nodes = data.nodes || [];
live.classList.remove("is-error");
live.querySelector("span").textContent = "监控数据连接正常";
document.getElementById("traffic-updated").textContent = `刷新于 ${formatTime(data.generated_at)}`;
render();
} catch (error) {
live.classList.add("is-error");
live.querySelector("span").textContent = "监控数据暂时中断";
} finally {
loading = false;
}
}
document.querySelectorAll("[data-minutes]").forEach((button) => {
button.addEventListener("click", () => {
document.querySelectorAll("[data-minutes]").forEach((item) => item.classList.remove("is-active"));
button.classList.add("is-active");
state.minutes = Number(button.dataset.minutes);
refresh();
});
});
canvas.addEventListener("mousemove", (event) => {
if (!state.points.length) return;
const rect = canvas.getBoundingClientRect();
const mouseX = event.clientX - rect.left;
const point = state.points.reduce((best, candidate) => Math.abs(candidate.x - mouseX) < Math.abs(best.x - mouseX) ? candidate : best);
if (Math.abs(point.x - mouseX) > 36) { tooltip.hidden = true; return; }
tooltip.innerHTML = `<b>${formatTime(point.sample.at, true)}</b><span>下载 ${formatRate(point.sample.download_bytes_per_second)}</span><span>上传 ${formatRate(point.sample.upload_bytes_per_second)}</span>`;
tooltip.hidden = false;
tooltip.style.left = `${Math.min(rect.width - 175, Math.max(4, point.x + 10))}px`;
tooltip.style.top = "18px";
});
canvas.addEventListener("mouseleave", () => { tooltip.hidden = true; });
window.addEventListener("resize", () => drawChart(selectedNode()));
refresh();
window.setInterval(refresh, 5000);
})();
+16
View File
@@ -0,0 +1,16 @@
/* Subscription URLs are credentials: no logging, analytics or network calls. */
document.querySelectorAll('[data-copy-target]').forEach(function (button) {
button.addEventListener('click', async function () {
const input = document.getElementById(button.dataset.copyTarget);
const feedback = document.getElementById('copy-feedback');
if (!input) return;
try {
await navigator.clipboard.writeText(input.value);
if (feedback) feedback.textContent = '已复制订阅地址,请勿转发给他人。';
} catch (_) {
input.focus();
input.select();
if (feedback) feedback.textContent = '浏览器未允许自动复制,已选中地址,请手动复制。';
}
});
});
+43
View File
@@ -0,0 +1,43 @@
(function () {
"use strict";
const tabs = Array.from(document.querySelectorAll("[data-workflow-tab]"));
if (!tabs.length) return;
const panels = new Map(
tabs.map((tab) => [tab.dataset.workflowTab, document.getElementById(tab.dataset.workflowTab)])
);
function activate(tab, moveFocus) {
tabs.forEach((item) => {
const selected = item === tab;
item.classList.toggle("is-active", selected);
item.setAttribute("aria-selected", String(selected));
item.tabIndex = selected ? 0 : -1;
const panel = panels.get(item.dataset.workflowTab);
if (panel) {
panel.hidden = !selected;
panel.classList.toggle("is-active", selected);
}
});
if (moveFocus) tab.focus();
if (history.replaceState) history.replaceState(null, "", `#${tab.dataset.workflowTab}`);
}
tabs.forEach((tab, index) => {
tab.addEventListener("click", () => activate(tab, false));
tab.addEventListener("keydown", (event) => {
let target = null;
if (event.key === "ArrowRight") target = tabs[(index + 1) % tabs.length];
if (event.key === "ArrowLeft") target = tabs[(index - 1 + tabs.length) % tabs.length];
if (event.key === "Home") target = tabs[0];
if (event.key === "End") target = tabs[tabs.length - 1];
if (!target) return;
event.preventDefault();
activate(target, true);
});
});
const initial = tabs.find((tab) => `#${tab.dataset.workflowTab}` === window.location.hash);
if (initial) activate(initial, false);
})();