Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server don't conversions images to jxl format in Firefox Nightly #325

Closed
MIKU-N opened this issue Apr 9, 2024 · 3 comments
Closed

Server don't conversions images to jxl format in Firefox Nightly #325

MIKU-N opened this issue Apr 9, 2024 · 3 comments
Assignees

Comments

@MIKU-N
Copy link

MIKU-N commented Apr 9, 2024

Describe the bug
Firefox Nightly can be enabled JPEG XL supported via the image.jxl.enabled flag in about:config in Nightly.
But when I test,server don't conversions images to jxl format,why it happend?that is about Minimized Conversion?
image

To Reproduce
Just use Firefox Nightly,And enabled JPEG XL supported via the image.jxl.enabled flag in about:config

Expected behavior
I think if browser can be enabled JPEG XL supported,then the server should provide support.

Screenshots and logs

webp-webp-1  | 
webp-webp-1  |  
webp-webp-1  |          ▌ ▌   ▌  ▛▀▖ ▞▀▖                ▞▀▖
webp-webp-1  |          ▌▖▌▞▀▖▛▀▖▙▄▘ ▚▄ ▞▀▖▙▀▖▌ ▌▞▀▖▙▀▖ ▌▄▖▞▀▖
webp-webp-1  |          ▙▚▌▛▀ ▌ ▌▌   ▖ ▌▛▀ ▌  ▐▐ ▛▀ ▌   ▌ ▌▌ ▌
webp-webp-1  |          ▘ ▘▝▀▘▀▀ ▘   ▝▀ ▝▀▘▘   ▘ ▝▀▘▘   ▝▀ ▝▀
webp-webp-1  | 
webp-webp-1  |          WebP Server Go - v0.11.0
webp-webp-1  |          Developed by WebP Server team. https://github.com/webp-sh
webp-webp-1  | 
webp-webp-1  | Allowed file types as source: [jpg png jpeg bmp gif]
webp-webp-1  | Convert to WebP Enabled: true
webp-webp-1  | Convert to AVIF Enabled: true
webp-webp-1  | Convert to JXL Enabled: true
webp-webp-1  | WebP Server Go is Running on http://0.0.0.0:3333
webp-webp-1  | time="2024-04-09 17:48:16" level=warning msg="can't read metadata: open metadata/local/be7d584b2c1d29a5.json: no such file or directory" func="[38:webp_server_go/helper.ReadMetadata]"
webp-webp-1  | time="2024-04-09 17:48:17" level=info msg="WebP@70%: /opt/pics/piclist/upload/202311141658847.png->/opt/exhaust/local/be7d584b2c1d29a5.webp 2618893->229418 8.76% deflated" func="[284:webp_server_go/encoder.convertLog]"
webp-webp-1  | time="2024-04-09 17:48:23" level=info msg="AVIF@70%: /opt/pics/piclist/upload/202311141658847.png->/opt/exhaust/local/be7d584b2c1d29a5.avif 2618893->156645 5.98% deflated" func="[284:webp_server_go/encoder.convertLog]"
webp-webp-1  | 50.114.xxx.xxx - [2024-04-09 17:48:16] GET /piclist/upload/202311141658847.png 200  Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:126.0) Gecko/20100101 Firefox/126.0
webp-webp-1  | 50.114.xxx.xxx - [2024-04-09 17:49:16] GET /piclist/upload/202311141658847.png 200  Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:124.0) Gecko/20100101 Firefox/124.0

Environment (please complete the following information):

  • OS: Windows 11
  • version or branch: v0.11.0
@MIKU-N
Copy link
Author

MIKU-N commented Apr 9, 2024

It seems that you have missed the head judgment of image/jxl.

func GuessSupportedFormat(header *fasthttp.RequestHeader) map[string]bool {
var (
supported = map[string]bool{
"raw": true,
"webp": false,
"avif": false,
"jxl": false,
}
ua = string(header.Peek("user-agent"))
accept = strings.ToLower(string(header.Peek("accept")))
)
if strings.Contains(accept, "image/webp") {
supported["webp"] = true
}
if strings.Contains(accept, "image/avif") {
supported["avif"] = 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"}
for _, version := range supportedWebPs {
if strings.Contains(ua, version) {
supported["webp"] = true
break
}
}
supportedAVIFs := []string{"iPhone OS 16", "CPU OS 16", "iPhone OS 17", "CPU OS 17"}
for _, version := range supportedAVIFs {
if strings.Contains(ua, version) {
supported["avif"] = true
break
}
}
// Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4 Safari/605.1.15 <- iPad
// Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.3.1 Safari/605.1.15 <- Mac
// Mozilla/5.0 (iPhone; CPU iPhone OS 17_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4 Mobile/15E148 Safari/604.1 <- iPhone @ Safari
supportedJXLs := []string{"iPhone OS 17", "CPU OS 17", "Version/17"}
if strings.Contains(ua, "iPhone") || strings.Contains(ua, "Macintosh") {
for _, version := range supportedJXLs {
if strings.Contains(ua, version) {
supported["jxl"] = true
break
}
}
}
return supported
}

@n0vad3v
Copy link
Member

n0vad3v commented Apr 10, 2024

Should be fixed by #326, you can try using ghcr.io/webp-sh/webp_server_go:master image to see if it works by now.

@MIKU-N
Copy link
Author

MIKU-N commented Apr 10, 2024

Should be fixed by #326, you can try using ghcr.io/webp-sh/webp_server_go:master image to see if it works by now.

Now it fixed!Thanks!
image

@MIKU-N MIKU-N closed this as completed Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants