pool-stats/web/indexHandler.go
Pijus Kamandulis ef247fc843 Added auth
2025-07-04 21:05:28 +03:00

29 lines
491 B
Go

package web
import (
"net/http"
"pool-stats/database"
"pool-stats/models"
)
type IndexPageData struct {
PageDataBase
Stats []models.TimeWindowHighShare
}
func (ws *WebServer) IndexHandler(w http.ResponseWriter, r *http.Request) {
tws := database.GetTimeWindowHighShares(ws.db)
if tws == nil {
http.Error(w, "Failed to load time window high shares", 500)
return
}
indexData := IndexPageData{
Stats: tws,
}
ws.renderTemplate(w, r, "templates/index.html", &indexData)
}