This commit is contained in:
orangix
2026-01-19 02:36:52 +01:00
parent 8cb2524924
commit e5b87dc924
16 changed files with 66 additions and 67 deletions

View File

@@ -18,8 +18,8 @@ func RenderError(c *fiber.Ctx, code int) error {
c.Set("Content-Type", "image/png")
return c.Status(code).Send(img)
} else {
return c.Status(code).Render("errors/" + strconv.Itoa(code), fiber.Map{
return c.Status(code).Render("errors/"+strconv.Itoa(code), fiber.Map{
"path": c.Path(),
})
}
}
}

View File

@@ -9,4 +9,4 @@ func FormatDate(date string) (string, error) {
}
return time.Format("Jan 2, 2006 3:04 PM"), nil
}
}

View File

@@ -2,4 +2,4 @@ package utils
import "regexp"
var ImgurRe = regexp.MustCompile(`https?://(i\.)?imgur\.com`)
var ImgurRe = regexp.MustCompile(`https?://(i\.)?imgur\.com`)

View File

@@ -35,7 +35,7 @@ func GetJSON(url string) (gjson.Result, error) {
return gjson.Result{}, err
}
switch (res.StatusCode) {
switch res.StatusCode {
case 200:
return gjson.Parse(string(body)), nil
case 429:
@@ -43,4 +43,4 @@ func GetJSON(url string) (gjson.Result, error) {
default:
return gjson.Result{}, fmt.Errorf("received status %s, expected 200 OK.\n%s", res.Status, string(body))
}
}
}

View File

@@ -25,4 +25,4 @@ func SetReqHeaders(req *http.Request) {
req.Header.Set("Sec-Fetch-Mode", "cors")
req.Header.Set("Sec-Fetch-Site", "same-site")
req.Header.Set("User-Agent", "Mozilla/5.0 (Windows NT 10.0; rv:102.0) Gecko/20100101 Firefox/102.0")
}
}