mirror of
https://github.com/CJackHwang/ds2api.git
synced 2026-05-09 18:57:43 +08:00
refactor backend API structure
This commit is contained in:
26
internal/httpapi/admin/devcapture/handler_dev_capture.go
Normal file
26
internal/httpapi/admin/devcapture/handler_dev_capture.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package devcapture
|
||||
|
||||
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",
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user