Skip to content

Commit

Permalink
chore: update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
fumiama committed May 5, 2024
1 parent 66b2729 commit 99cc5b6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 29 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ require (
github.com/fumiama/cron v1.3.0
github.com/fumiama/go-base16384 v1.7.0
github.com/fumiama/go-registry v0.2.6
github.com/fumiama/terasu v0.0.0-20240502091919-c887e26289a8
github.com/gin-gonic/gin v1.8.2
github.com/go-playground/assert/v2 v2.2.0
github.com/go-playground/validator/v10 v10.11.1
Expand All @@ -39,6 +38,7 @@ require (
github.com/fumiama/go-simple-protobuf v0.1.0 // indirect
github.com/fumiama/gofastTEA v0.0.10 // indirect
github.com/fumiama/imgsz v0.0.2 // indirect
github.com/fumiama/terasu v0.0.0-20240502091919-c887e26289a8 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.19.6 // indirect
Expand Down
34 changes: 6 additions & 28 deletions img/pool/img.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"regexp"
"strings"

"github.com/fumiama/terasu/http2"
"github.com/sirupsen/logrus"
"github.com/wdvxdr1123/ZeroBot/message"

Expand Down Expand Up @@ -43,18 +42,6 @@ func GetImage(name string) (m *Image, err error) {
m.n = name
m.item, err = getItem(name)
if err == nil && m.u != "" {
var resp *http.Response
resp, err = http2.Head(m.String())
if err == nil {
if resp.StatusCode == http.StatusOK {
return
}
if resp.StatusCode == http.StatusNotFound {
logrus.Debugln("[imgpool] image", name, m, "outdated, code:", resp.StatusCode)
err = ErrImgFileOutdated
return
}
}
_, err = web.RequestDataWithHeaders(http.DefaultClient, m.String(), "GET", func(r *http.Request) error {
r.Header.Set("Range", "bytes=0-1")
r.Header.Set("User-Agent", web.RandUA())
Expand All @@ -79,22 +66,13 @@ func NewImage(send ctxext.NoCtxSendMsg, get ctxext.NoCtxGetMsg, name, f string)
m.SetFile(f)
m.item, err = getItem(name)
if err == nil && m.item.u != "" {
var resp *http.Response
resp, err = http2.Head(m.String())
_, err = web.RequestDataWithHeaders(http.DefaultClient, m.String(), "GET", func(r *http.Request) error {
r.Header.Set("Range", "bytes=0-1")
r.Header.Set("User-Agent", web.RandUA())
return nil
}, nil)
if err == nil {
if resp.StatusCode == http.StatusOK {
return
}
if resp.StatusCode != http.StatusNotFound {
_, err = web.RequestDataWithHeaders(http.DefaultClient, m.String(), "GET", func(r *http.Request) error {
r.Header.Set("Range", "bytes=0-1")
r.Header.Set("User-Agent", web.RandUA())
return nil
}, nil)
if err == nil {
return
}
}
return
}
logrus.Debugln("[imgpool] image", name, m, "outdated:", err, "updating...")
}
Expand Down

0 comments on commit 99cc5b6

Please sign in to comment.