Files
ds2api/internal/admin/handler_dev_capture.go

27 lines
608 B
Go

package admin
import (
"net/http"
"ds2api/internal/devcapture"
)
func (h *Handler) getDevCaptures(w http.ResponseWriter, _ *http.Request) {
store := devcapture.Global()
writeJSON(w, http.StatusOK, map[string]any{
"enabled": store.Enabled(),
"limit": store.Limit(),
"max_body_bytes": store.MaxBodyBytes(),
"items": store.Snapshot(),
})
}
func (h *Handler) clearDevCaptures(w http.ResponseWriter, _ *http.Request) {
store := devcapture.Global()
store.Clear()
writeJSON(w, http.StatusOK, map[string]any{
"success": true,
"detail": "capture logs cleared",
})
}