Allow jxl based on Accept header (#326)

This commit is contained in:
Nova Kwok 2024-04-10 11:11:33 +08:00 committed by GitHub
parent 8c15bf3a03
commit b5842b264c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View File

@ -49,7 +49,7 @@ var (
ProxyMode bool ProxyMode bool
Prefetch bool Prefetch bool
Config = NewWebPConfig() Config = NewWebPConfig()
Version = "0.11.0" Version = "0.11.1"
WriteLock = cache.New(5*time.Minute, 10*time.Minute) WriteLock = cache.New(5*time.Minute, 10*time.Minute)
ConvertLock = cache.New(5*time.Minute, 10*time.Minute) ConvertLock = cache.New(5*time.Minute, 10*time.Minute)
RemoteRaw = "./remote-raw" RemoteRaw = "./remote-raw"

View File

@ -140,6 +140,9 @@ func GuessSupportedFormat(header *fasthttp.RequestHeader) map[string]bool {
if strings.Contains(accept, "image/avif") { if strings.Contains(accept, "image/avif") {
supported["avif"] = true supported["avif"] = true
} }
if strings.Contains(accept, "image/jxl") {
supported["jxl"] = true
}
supportedWebPs := []string{"iPhone OS 14", "CPU OS 14", "iPhone OS 15", "CPU OS 15", "iPhone OS 16", "CPU OS 16", "iPhone OS 17", "CPU OS 17"} supportedWebPs := []string{"iPhone OS 14", "CPU OS 14", "iPhone OS 15", "CPU OS 15", "iPhone OS 16", "CPU OS 16", "iPhone OS 17", "CPU OS 17"}
for _, version := range supportedWebPs { for _, version := range supportedWebPs {