🐛 Fixes regex and logs query param not working

This commit is contained in:
Daniel Svitan 2025-04-11 22:48:44 +02:00
parent e9065fb654
commit 30aae96185

View File

@ -23,7 +23,7 @@ import (
const TimeFormat = "2006-01-02 15:04:05"
const DateFormat = "2006-01-02"
var LogRegex = regexp.MustCompile(`(?m)^.*/\d{4}-\d{2}-\d{2}_\d+\.txt$`)
var LogRegex = regexp.MustCompile(`(?m)^\d{4}-\d{2}-\d{2}_.*\.txt$`)
type Client struct {
ID uuid.UUID `json:"id"`
@ -185,12 +185,12 @@ func main() {
}))
app.GET("/admin/logs/:id", authed(idparam(func(c echo.Context, id uuid.UUID) error {
date := c.Param("date")
date := c.QueryParam("date")
if date == "" {
date = time.Now().Format(DateFormat)
}
skipRaw := c.Param("skip")
skipRaw := c.QueryParam("skip")
skip := 0
if skipRaw != "" {
skip, err = strconv.Atoi(skipRaw)
@ -199,7 +199,7 @@ func main() {
}
}
takeRaw := c.Param("take")
takeRaw := c.QueryParam("take")
take := 1024
if takeRaw != "" {
take, err = strconv.Atoi(takeRaw)