🐛 Fixes regex and logs query param not working
This commit is contained in:
parent
e9065fb654
commit
30aae96185
@ -23,7 +23,7 @@ import (
|
|||||||
const TimeFormat = "2006-01-02 15:04:05"
|
const TimeFormat = "2006-01-02 15:04:05"
|
||||||
const DateFormat = "2006-01-02"
|
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 {
|
type Client struct {
|
||||||
ID uuid.UUID `json:"id"`
|
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 {
|
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 == "" {
|
if date == "" {
|
||||||
date = time.Now().Format(DateFormat)
|
date = time.Now().Format(DateFormat)
|
||||||
}
|
}
|
||||||
|
|
||||||
skipRaw := c.Param("skip")
|
skipRaw := c.QueryParam("skip")
|
||||||
skip := 0
|
skip := 0
|
||||||
if skipRaw != "" {
|
if skipRaw != "" {
|
||||||
skip, err = strconv.Atoi(skipRaw)
|
skip, err = strconv.Atoi(skipRaw)
|
||||||
@ -199,7 +199,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
takeRaw := c.Param("take")
|
takeRaw := c.QueryParam("take")
|
||||||
take := 1024
|
take := 1024
|
||||||
if takeRaw != "" {
|
if takeRaw != "" {
|
||||||
take, err = strconv.Atoi(takeRaw)
|
take, err = strconv.Atoi(takeRaw)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user