Close DV-01–04,07,09,13,14: unify operator-deck UX in server/web.
Standardize neon cyan on #00e8f5, wire SacredPageHeader across Builds/Path Tracer/LOTL, dedupe Pages.css, align Path Tracer chrome, drop dead wealth-deck CSS, add prefers-color-scheme shell + HelpTip, sidebar version from package.json build inject, and Vitest CSS regression guards.
This commit is contained in:
35
server/internal/api/dashboard_ws_init.go
Normal file
35
server/internal/api/dashboard_ws_init.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"crypto-miner-server/internal/db"
|
||||
)
|
||||
|
||||
const (
|
||||
dashboardInitDefaultLimit = 100
|
||||
dashboardInitMaxLimit = 2000
|
||||
)
|
||||
|
||||
// parseDashboardInitFilter reads optional init_limit / init_offset on /ws/dashboard.
|
||||
func parseDashboardInitFilter(r *http.Request) (db.AgentListFilter, bool) {
|
||||
limitStr := r.URL.Query().Get("init_limit")
|
||||
if limitStr == "" {
|
||||
return db.AgentListFilter{}, false
|
||||
}
|
||||
limit, err := strconv.Atoi(limitStr)
|
||||
if err != nil || limit <= 0 {
|
||||
limit = dashboardInitDefaultLimit
|
||||
}
|
||||
if limit > dashboardInitMaxLimit {
|
||||
limit = dashboardInitMaxLimit
|
||||
}
|
||||
offset := 0
|
||||
if offStr := r.URL.Query().Get("init_offset"); offStr != "" {
|
||||
if o, err := strconv.Atoi(offStr); err == nil && o >= 0 {
|
||||
offset = o
|
||||
}
|
||||
}
|
||||
return db.AgentListFilter{Limit: limit, Offset: offset}, true
|
||||
}
|
||||
Reference in New Issue
Block a user