mirror of
https://github.com/woodchen-ink/webp_server_go.git
synced 2025-07-18 13:42:02 +08:00
Added Safari support
This commit is contained in:
parent
6839c6a7b0
commit
e45ca996ac
@ -40,7 +40,7 @@ your files are at `/var/www/image/pics/tsuki.jpg`, then `IMG_PATH` shall be `/va
|
||||
3. Let Nginx to `proxy_pass http://localhost:3333/;`
|
||||
|
||||
## TODO
|
||||
- [ ] This version doesn't support header-based-output, which means Safari users will not see the converted `webp` images, this should be fixed in later releases.
|
||||
- [x] This version doesn't support header-based-output, which means Safari users will not see the converted `webp` images, this should be fixed in later releases.
|
||||
- [ ] Multi platform support.
|
||||
|
||||
## build your own binary
|
||||
|
@ -123,6 +123,13 @@ func main() {
|
||||
return
|
||||
}
|
||||
|
||||
// Check for Safari users
|
||||
UA := c.Get("User-Agent")
|
||||
if strings.Contains(UA,"Safari") && !strings.Contains(UA,"Chrome") && !strings.Contains(UA,"Firefox"){
|
||||
c.SendFile(ImgAbsolutePath)
|
||||
return
|
||||
}
|
||||
|
||||
if imageExists(WebpAbsolutePath) {
|
||||
c.SendFile(WebpAbsolutePath)
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user