2026-08-23 20:39:22 +03:00
|
|
|
package dashboard
|
|
|
|
|
|
|
|
|
|
import "net/http"
|
|
|
|
|
|
|
|
|
|
func (s *Server) routes(mux *http.ServeMux) {
|
|
|
|
|
mux.HandleFunc("GET /{$}", s.handleIndex)
|
|
|
|
|
|
|
|
|
|
mux.HandleFunc("GET /overview", s.handleOverview)
|
|
|
|
|
mux.HandleFunc("GET /overview/fragment", s.handleOverviewFragment)
|
|
|
|
|
|
|
|
|
|
mux.HandleFunc("GET /ips", s.handleIPsPage)
|
2026-09-18 18:47:11 +03:00
|
|
|
mux.HandleFunc("GET /ips/fragment", s.handleIPsFragment)
|
2026-08-23 20:39:22 +03:00
|
|
|
mux.HandleFunc("GET /ips/{ip}", s.handleIPDetail)
|
|
|
|
|
mux.HandleFunc("POST /ips", s.handleIPsSubmit)
|
|
|
|
|
mux.HandleFunc("POST /ips/{ip}/recheck", s.handleIPRecheck)
|
|
|
|
|
mux.HandleFunc("POST /ips/{ip}/cancel", s.handleIPCancel)
|
2026-08-23 22:24:55 +03:00
|
|
|
mux.HandleFunc("DELETE /ips/{ip}", s.handleIPDelete)
|
|
|
|
|
mux.HandleFunc("POST /ips/delete", s.handleIPsDeleteSelected)
|
2026-09-18 18:47:11 +03:00
|
|
|
mux.HandleFunc("POST /ips/recheck", s.handleIPsRecheckSelected)
|
2026-08-23 22:24:55 +03:00
|
|
|
mux.HandleFunc("POST /ips/clear", s.handleIPsClear)
|
2026-08-23 20:39:22 +03:00
|
|
|
|
|
|
|
|
mux.HandleFunc("GET /validators", s.handleValidatorsPage)
|
|
|
|
|
mux.HandleFunc("POST /validators", s.handleValidatorCreate)
|
|
|
|
|
mux.HandleFunc("PUT /validators/{id}", s.handleValidatorUpdate)
|
|
|
|
|
mux.HandleFunc("DELETE /validators/{id}", s.handleValidatorDelete)
|
|
|
|
|
|
|
|
|
|
mux.HandleFunc("GET /sites", s.handleSitesPage)
|
2026-08-26 20:47:54 +03:00
|
|
|
mux.HandleFunc("POST /sites", s.handleSiteCreate)
|
2026-08-23 20:39:22 +03:00
|
|
|
mux.HandleFunc("PUT /sites/{index}", s.handleSitePut)
|
|
|
|
|
mux.HandleFunc("DELETE /sites/{index}", s.handleSiteDelete)
|
|
|
|
|
|
|
|
|
|
mux.HandleFunc("GET /targets", s.handleTargetsPage)
|
|
|
|
|
mux.HandleFunc("POST /targets", s.handleTargetCreate)
|
|
|
|
|
mux.HandleFunc("PUT /targets/{group}", s.handleTargetUpdate)
|
|
|
|
|
mux.HandleFunc("DELETE /targets/{group}", s.handleTargetDelete)
|
|
|
|
|
|
|
|
|
|
mux.HandleFunc("GET /check-types", s.handleCheckTypesPage)
|
|
|
|
|
mux.HandleFunc("POST /check-types", s.handleCheckTypeCreate)
|
|
|
|
|
mux.HandleFunc("PUT /check-types/{name}", s.handleCheckTypeUpdate)
|
|
|
|
|
mux.HandleFunc("DELETE /check-types/{name}", s.handleCheckTypeDelete)
|
|
|
|
|
|
2026-08-24 10:29:08 +03:00
|
|
|
mux.HandleFunc("GET /settings", s.handleSettingsPage)
|
|
|
|
|
mux.HandleFunc("PUT /settings", s.handleSettingsPut)
|
2026-08-26 19:45:48 +03:00
|
|
|
mux.HandleFunc("PUT /settings/inbound-checks", s.handleInboundChecksPut)
|
2026-08-24 10:29:08 +03:00
|
|
|
|
2026-08-23 20:39:22 +03:00
|
|
|
mux.Handle("GET /static/", http.StripPrefix("/static/", http.FileServerFS(staticSubFS())))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (s *Server) handleIndex(w http.ResponseWriter, r *http.Request) {
|
|
|
|
|
http.Redirect(w, r, "/overview", http.StatusFound)
|
|
|
|
|
}
|