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

fix: Use webp as thumbnail #758

Merged
merged 7 commits into from Oct 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Expand Up @@ -34,6 +34,7 @@ require (
github.com/swaggo/swag v1.16.2
github.com/toorop/gin-logrus v0.0.0-20210225092905-2c785434f26f
golang.org/x/crypto v0.13.0
golang.org/x/image v0.12.0
golang.org/x/net v0.15.0
golang.org/x/term v0.12.0
modernc.org/sqlite v1.26.0
Expand Down Expand Up @@ -86,7 +87,6 @@ require (
go.etcd.io/bbolt v1.3.7 // indirect
go.uber.org/atomic v1.11.0 // indirect
golang.org/x/arch v0.5.0 // indirect
golang.org/x/image v0.12.0 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/sys v0.12.0 // indirect
golang.org/x/text v0.13.0 // indirect
Expand Down
2 changes: 2 additions & 0 deletions internal/core/processing.go
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/go-shiori/shiori/internal/model"
"github.com/go-shiori/warc"
"github.com/pkg/errors"
_ "golang.org/x/image/webp"

// Add support for png
_ "image/png"
Expand Down Expand Up @@ -204,6 +205,7 @@ func DownloadBookImage(url, dstPath string) error {
if !strings.Contains(cp, "image/jpeg") &&
!strings.Contains(cp, "image/pjpeg") &&
!strings.Contains(cp, "image/jpg") &&
!strings.Contains(cp, "image/webp") &&
!strings.Contains(cp, "image/png") {
return ErrNoSupportedImageType
}
Expand Down