]> Sergey Matveev's repositories - tofuproxy.git/blobdiff - rounds/transcodeWebP.go
I stopped using Xombrero
[tofuproxy.git] / rounds / transcodeWebP.go
index 95b409a3c3ffbfd97426b3dece6875eea5f65689..7c4995d46c962dd11bbb1a6ef4c508adcf0e28f2 100644 (file)
@@ -25,24 +25,19 @@ import (
        "net/http"
        "os"
        "os/exec"
-       "strings"
 
        "go.stargrave.org/tofuproxy/fifos"
 )
 
 const CmdDWebP = "dwebp"
 
-func isXombrero(req *http.Request) bool {
-       return strings.Contains(req.Header.Get("User-Agent"), "AppleWebKit/538.15")
-}
-
 func RoundTranscodeWebP(
        host string,
        resp *http.Response,
        w http.ResponseWriter,
        req *http.Request,
 ) (bool, error) {
-       if resp.Header.Get("Content-Type") != "image/webp" || isXombrero(req) {
+       if resp.Header.Get("Content-Type") != "image/webp" {
                return true, nil
        }
        tmpFd, err := os.CreateTemp("", "tofuproxy.*.webp")
@@ -65,6 +60,8 @@ func RoundTranscodeWebP(
        w.Header().Add("Content-Type", "image/png")
        w.WriteHeader(http.StatusOK)
        w.Write(data)
-       fifos.LogVarious <- fmt.Sprintf("%s %s\tWebP transcoded to PNG", req.Method, req.URL)
+       fifos.LogVarious <- fmt.Sprintf(
+               "%s %s\tWebP transcoded to PNG", req.Method, req.URL,
+       )
        return false, nil
 }