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

@@ -35,11 +35,11 @@ func handleMedia(c *fiber.Ctx, url string) error {
utils.SetHeaders(c)
if utils.Config.ForceWebp &&
!strings.HasSuffix(c.Path(), ".webp") &&
c.Get("Sec-Fetch-Dest") == "image" &&
c.Query("no_webp") == "" &&
c.Accepts("image/webp") == "image/webp" &&
!strings.HasPrefix(c.Path(), "/stack") {
!strings.HasSuffix(c.Path(), ".webp") &&
c.Get("Sec-Fetch-Dest") == "image" &&
c.Query("no_webp") == "" &&
c.Accepts("image/webp") == "image/webp" &&
!strings.HasPrefix(c.Path(), "/stack") {
url = strings.ReplaceAll(url, ".png", ".webp")
url = strings.ReplaceAll(url, ".jpg", ".webp")
url = strings.ReplaceAll(url, ".jpeg", ".webp")