feat: 站点访问统计与可配置侧边栏组件

- 新增访问统计:visitstats 服务与查询、visit_capture 中间件、爬虫/来源识别、管理端 analytics 页面
- 新增侧边栏:sidebar 服务与 handler、管理端 sidebar 配置页、前端侧边栏组件
- 新增 widget 嵌入代码生成(widgetCode)与 widgetApi
- 遥测逻辑迁移至 handler 层,删除 service/telemetry
- env 示例补充 Docker 部署可信代理 IP 说明
This commit is contained in:
2026-09-24 18:53:45 +08:00
parent 3e55b5d230
commit 7b327bc8cc
60 changed files with 6539 additions and 572 deletions

View File

@@ -99,7 +99,7 @@
栏在 scrollY=0 时的视口 top,否则第一下滚动会先空走一截再吸住 */
--header-bar: 68px;
--header-h: calc(var(--header-bar) + 1px);
--main-pad-y: 2.25rem;
--main-pad-y: 1.25rem;
--rail-top: calc(var(--header-h) + var(--main-pad-y));
--rail-max-h: calc(100vh - var(--rail-top) - 1rem);
@@ -6329,29 +6329,29 @@ a.j13-mention-token:hover {
/* ----- 正文时间线:日志行样式(非标题墙);日徽章为唯一强层级 ----- */
.j13-timeline {
position: relative;
margin: 1rem 0 1.25rem;
padding: 0.1rem 0 0.1rem 0.1rem;
display: flex;
flex-direction: column;
gap: 1.15rem;
}
/* 连续主干:贯穿所有日分组,避免按日分段导致竖线"断树" */
.j13-timeline::before {
content: "";
position: absolute;
left: 0.38rem;
top: 0.55rem;
bottom: 0.55rem;
width: 1.5px;
border-radius: 1px;
background: color-mix(in srgb, var(--ok) 45%, var(--line));
z-index: 0;
}
.j13-timeline-day {
position: relative;
padding-left: 1.15rem;
}
.j13-timeline-day::before {
content: "";
position: absolute;
left: 0.28rem;
top: 1.7rem;
bottom: 0.2rem;
width: 1.5px;
border-radius: 1px;
background: color-mix(in srgb, var(--ok) 32%, var(--line));
}
.j13-timeline-day:last-child::before {
bottom: 0.85rem;
}
.j13-timeline-day-label {
display: inline-flex;
align-items: center;
@@ -6401,12 +6401,12 @@ a.j13-mention-token:hover {
position: absolute;
left: -1.15rem;
top: 0.85rem;
width: 0.42rem;
height: 0.42rem;
width: 0.5rem;
height: 0.5rem;
margin-left: 0.28rem;
border-radius: 999px;
background: var(--ok);
border: 2px solid var(--panel);
border: 1.5px solid var(--panel);
box-shadow: 0 0 0 1px color-mix(in srgb, var(--ok) 40%, var(--line));
transform: translateX(-50%);
z-index: 1;
@@ -6532,6 +6532,77 @@ a.j13-mention-token:hover {
border-radius: 10px;
border: 1px solid var(--line);
background: var(--panel);
transition: border-color 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}
.j13-tl-edit-card:hover {
border-color: var(--control-border-hover);
}
/* 已排除条目:降饱和度 + 虚线边,提示不会写入正文 */
.j13-tl-edit-card.is-excluded {
opacity: 0.55;
background: var(--tint);
border-style: dashed;
}
.j13-tl-tag {
display: inline-flex;
align-items: center;
padding: 0.05rem 0.4rem;
border-radius: 4px;
font-size: 10.5px;
font-weight: 600;
line-height: 1.4;
letter-spacing: 0.01em;
background: var(--ink-3);
color: var(--panel);
}
.j13-tl-count {
display: inline-flex;
align-items: center;
padding: 0.05rem 0.45rem;
border-radius: 999px;
font-size: 11.5px;
font-weight: 600;
line-height: 1.4;
font-variant-numeric: tabular-nums;
background: var(--accent-soft);
color: var(--accent);
}
.j13-tl-count.is-muted {
background: var(--tint);
color: var(--ink-3);
}
.j13-tl-empty {
display: flex;
flex-direction: column;
align-items: center;
gap: 0.6rem;
padding: 1.6rem 1rem;
border: 1px dashed var(--line-2);
border-radius: 10px;
background: var(--tint);
color: var(--ink-3);
font-size: 13px;
text-align: center;
}
.j13-tl-hint {
margin-top: 0.35rem;
font-size: 11.5px;
color: var(--ink-3);
font-variant-numeric: tabular-nums;
}
.j13-tl-banner {
margin-top: 0.5rem;
padding: 0.45rem 0.65rem;
border-radius: 8px;
font-size: 12.5px;
line-height: 1.5;
border: 1px solid transparent;
}
.j13-tl-banner.is-warn,
.j13-tl-banner.is-err {
background: var(--danger-soft);
color: var(--danger);
border-color: color-mix(in srgb, var(--danger) 25%, transparent);
}
/* ----- 分页 ----- */
@@ -9018,3 +9089,69 @@ html.j13-reduce-chrome .j13-att-card.is-fresh {
display: block;
}
.settings-nav-item small { margin-left:8px; }
/* ===== 访问统计:横向 Tab 导航 ===== */
.admin-analytics-page {
width: 100%;
max-width: 1120px;
}
.admin-analytics-tabs {
display: flex;
align-items: stretch;
gap: 0.15rem;
overflow-x: auto;
scrollbar-width: thin;
border-bottom: 1px solid var(--line);
margin-bottom: 1.25rem;
padding: 0 0.25rem;
}
.admin-analytics-tab {
position: relative;
white-space: nowrap;
padding: 0.55rem 0.9rem;
font-size: 13.5px;
font-weight: 500;
line-height: 1.35;
color: var(--ink-2);
text-decoration: none;
border-radius: 0.6rem 0.6rem 0 0;
transition: background 0.15s ease, color 0.15s ease;
}
.admin-analytics-tab:hover {
background: var(--panel-2);
color: var(--ink);
}
.admin-analytics-tab:visited {
color: var(--ink-2);
}
.admin-analytics-tab[aria-current="page"],
.admin-analytics-tab[aria-current="page"]:visited {
color: var(--nav-active-ink);
background: var(--nav-active-bg);
font-weight: 600;
}
.admin-analytics-tab[aria-current="page"]::after {
content: "";
position: absolute;
left: 0.5rem;
right: 0.5rem;
bottom: 0;
height: 2px;
background: var(--accent);
border-radius: 2px 2px 0 0;
}
.admin-analytics-tab:focus-visible {
outline: 2px solid var(--accent);
outline-offset: -2px;
}
/* ── 侧栏管理:站长自定义工具容器 ──
不附加面板底色/边框,视觉完全交给工具自带的 HTML/CSS;
仅保证在侧栏列内不横向溢出。 */
.j13-widget-body {
min-width: 0;
}
.j13-widget-body > .j13-widget-html {
min-width: 0;
}