fix: 管理会话自动恢复与访问来源统计优化

- 新增 AdminSessionRecover:后台离线/后端重启时自动重试恢复会话,明确失效才回跳登录
- 认证 cookie 契约调整(SameSite=Lax 与刷新轮转适配),路由与守卫适配
- 访问来源统计查询优化与测试、管理端 analytics sources 页面适配
- 移动端布局修正:覆盖 body min-h-screen 避免内容区高度异常
This commit is contained in:
2026-09-28 03:33:52 +08:00
parent 0c3b3a710c
commit 3e0689fe98
15 changed files with 548 additions and 85 deletions

View File

@@ -120,9 +120,9 @@ func Setup(cfg *config.Config) (*gin.Engine, error) {
}
limiter := service.DefaultRateLimiter()
// 访问统计管道:攒批落库 + 保留期滚动清理(随进程生命周期)
pipeCtx, pipeCancel := context.WithCancel(context.Background())
defer pipeCancel()
// 访问统计管道:攒批落库 + 保留期滚动清理(随进程生命周期)。
// 不用 WithCancel+defer:Setup 返回即 cancel 会让落库协程在启动阶段就退出,事件永远不落库
pipeCtx := context.Background()
go visitSvc.StartFlusher(pipeCtx)
go visitSvc.RunRetention(pipeCtx)