2026-01-07 15:08:29 +00:00
|
|
|
package report
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"net/http"
|
|
|
|
|
|
2026-01-07 18:36:20 +00:00
|
|
|
"github.com/Gleipnir-Technology/nidus-sync/htmlpage"
|
|
|
|
|
"github.com/Gleipnir-Technology/nidus-sync/htmlpage/public-reports"
|
2026-01-07 15:08:29 +00:00
|
|
|
"github.com/go-chi/chi/v5"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func Router() chi.Router {
|
|
|
|
|
r := chi.NewRouter()
|
|
|
|
|
r.Get("/", getRoot)
|
2026-01-07 21:47:33 +00:00
|
|
|
r.Get("/nuisance", getNuisance)
|
|
|
|
|
r.Get("/pool", getPool)
|
2026-01-07 21:49:09 +00:00
|
|
|
r.Get("/quick", getQuick)
|
2026-01-07 21:47:33 +00:00
|
|
|
r.Get("/status", getStatus)
|
2026-01-07 20:47:55 +00:00
|
|
|
localFS := http.Dir("./static")
|
|
|
|
|
htmlpage.FileServer(r, "/static", localFS, publicreports.EmbeddedStaticFS, "static")
|
2026-01-07 15:08:29 +00:00
|
|
|
return r
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func getRoot(w http.ResponseWriter, r *http.Request) {
|
2026-01-07 18:36:20 +00:00
|
|
|
htmlpage.RenderOrError(
|
|
|
|
|
w,
|
|
|
|
|
publicreports.Root,
|
2026-01-07 21:47:33 +00:00
|
|
|
publicreports.ContextRoot{},
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func getNuisance(w http.ResponseWriter, r *http.Request) {
|
|
|
|
|
htmlpage.RenderOrError(
|
|
|
|
|
w,
|
|
|
|
|
publicreports.Nuisance,
|
|
|
|
|
publicreports.ContextNuisance{},
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
func getPool(w http.ResponseWriter, r *http.Request) {
|
|
|
|
|
htmlpage.RenderOrError(
|
|
|
|
|
w,
|
|
|
|
|
publicreports.Pool,
|
|
|
|
|
publicreports.ContextPool{},
|
|
|
|
|
)
|
|
|
|
|
}
|
2026-01-07 21:49:09 +00:00
|
|
|
func getQuick(w http.ResponseWriter, r *http.Request) {
|
|
|
|
|
htmlpage.RenderOrError(
|
|
|
|
|
w,
|
|
|
|
|
publicreports.Quick,
|
|
|
|
|
publicreports.ContextQuick{},
|
|
|
|
|
)
|
|
|
|
|
}
|
2026-01-07 21:47:33 +00:00
|
|
|
func getStatus(w http.ResponseWriter, r *http.Request) {
|
|
|
|
|
htmlpage.RenderOrError(
|
|
|
|
|
w,
|
|
|
|
|
publicreports.Status,
|
|
|
|
|
publicreports.ContextStatus{},
|
2026-01-07 18:36:20 +00:00
|
|
|
)
|
2026-01-07 15:08:29 +00:00
|
|
|
}
|