37 lines
1.2 KiB
Go
37 lines
1.2 KiB
Go
package dashboard
|
|||
|
|
|
||
|
|
import "net/http"
|
||
|
|
|
||
|
|
type registryPageData struct {
|
||
|
|
PageData
|
||
|
|
Items []registryItem
|
||
|
|
}
|
||
|
|
|
||
|
|
type registryDetailData struct {
|
||
|
|
PageData
|
||
|
|
History registryHistoryResponse
|
||
|
|
}
|
||
|
|
|
||
|
|
// handleRegistryPage lists every address ever submitted to the check
|
||
|
|
// queue, with a summary of its accumulated check history — the durable
|
||
|
|
// record that survives an address being deleted from /ips and later
|
||
|
|
// re-added. See internal/db/migrations/0007_ip_registry.sql.
|
||
|
|
func (s *Server) handleRegistryPage(w http.ResponseWriter, r *http.Request) {
|
||
|
|
items, err := s.CA.ListRegistry(r.Context())
|
||
|
|
data := registryPageData{Items: items}
|
||
|
|
data.ActiveNav = "registry"
|
||
|
|
data.Banner = bannerFor(err)
|
||
|
|
s.renderPage(w, "registry_page", data)
|
||
|
|
}
|
||
|
|
|
||
|
|
// handleRegistryDetail shows one address's full retained check history
|
||
|
|
// across every cycle it has ever run, not just the current attempt — see
|
||
|
|
// ip_detail_content in ip_detail.html for the attempt-scoped equivalent.
|
||
|
|
func (s *Server) handleRegistryDetail(w http.ResponseWriter, r *http.Request) {
|
||
|
|
ip := r.PathValue("ip")
|
||
|
|
history, err := s.CA.GetRegistryHistory(r.Context(), ip)
|
||
|
|
data := registryDetailData{History: history}
|
||
|
|
data.ActiveNav = "registry"
|
||
|
|
data.Banner = bannerFor(err)
|
||
|
|
s.renderPage(w, "registry_detail_page", data)
|
||
|
|
}
|