Added Safari support

This commit is contained in:
n0vad3v 2020-02-09 19:35:41 +08:00
parent 6839c6a7b0
commit e45ca996ac
No known key found for this signature in database
GPG Key ID: 8D42A0E699E50639
2 changed files with 8 additions and 1 deletions

View File

@ -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

View File

@ -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 {