feat: 统计页支持一年时段和按日趋势

在线人数在新的有效访问后尽快刷新,历史查询保留一年并画出每日连接数。
This commit is contained in:
nixevol
2026-09-28 11:08:28 +08:00
parent 28170a7fe2
commit fe24a88bac
12 changed files with 358 additions and 36 deletions
+8 -6
View File
@@ -36,6 +36,7 @@ type App struct {
onlineMu sync.Mutex
onlineAt time.Time
onlineJSON []byte
onlinePoke chan struct{}
rangeMu sync.Mutex
}
@@ -54,12 +55,13 @@ func NewApp(cfg Config, now func() time.Time) (*App, error) {
return nil, err
}
a := &App{
cfg: cfg,
store: st,
rec: NewRecorder(),
now: now,
png: transparentPNG(),
salt: salt,
cfg: cfg,
store: st,
rec: NewRecorder(),
now: now,
png: transparentPNG(),
salt: salt,
onlinePoke: make(chan struct{}, 1),
}
mux := http.NewServeMux()
mux.HandleFunc("GET /tiles/", a.handleTile)