Initial vibeproxy implementation
Self-contained HTTP/HTTPS/TCP/UDP reverse proxy manager written in Go, with SQLite storage, a Bootstrap 5 admin UI (Go templates, no JS framework), and a REST API under /api/v1. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QTXFrNP1imCW7jtfL5SZrw
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/owen/vibeproxy/internal/database"
|
||||
)
|
||||
|
||||
func (a *API) listRequestLogs(w http.ResponseWriter, r *http.Request) {
|
||||
f := database.LogFilter{
|
||||
Status: queryInt(r, "status", 0),
|
||||
Search: r.URL.Query().Get("q"),
|
||||
Limit: queryInt(r, "limit", 50),
|
||||
Offset: queryInt(r, "offset", 0),
|
||||
}
|
||||
if id := queryInt(r, "proxy_host_id", 0); id > 0 {
|
||||
id64 := int64(id)
|
||||
f.ProxyHostID = &id64
|
||||
}
|
||||
logs, total, err := database.QueryRequestLogs(a.db, f)
|
||||
if err != nil {
|
||||
writeError(w, http.StatusInternalServerError, err.Error())
|
||||
return
|
||||
}
|
||||
writeJSON(w, http.StatusOK, map[string]any{"logs": logs, "total": total})
|
||||
}
|
||||
|
||||
func (a *API) listAuditLogs(w http.ResponseWriter, r *http.Request) {
|
||||
limit := queryInt(r, "limit", 50)
|
||||
offset := queryInt(r, "offset", 0)
|
||||
logs, total, err := database.ListAuditLogs(a.db, limit, offset)
|
||||
if err != nil {
|
||||
writeError(w, http.StatusInternalServerError, err.Error())
|
||||
return
|
||||
}
|
||||
writeJSON(w, http.StatusOK, map[string]any{"logs": logs, "total": total})
|
||||
}
|
||||
Reference in New Issue
Block a user