mirror of
https://github.com/CJackHwang/ds2api.git
synced 2026-05-04 00:15:28 +08:00
27 lines
608 B
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",
|
|
})
|
|
}
|