fix: update HTTP client to flare for Batch 4 sources

Based on Kotlin reference verification:
- madtheme, mangabox, mangacatalog, mangahub → flare

Also updated phase4-standalone.md with project requirement for
checking HTTP client type when porting sources from Kotlin
This commit is contained in:
achmad
2026-05-13 21:35:10 +07:00
parent 46f930718c
commit 71ef2d24fa
5 changed files with 24 additions and 46 deletions
+4 -9
View File
@@ -14,7 +14,7 @@ import (
"github.com/PuerkitoBio/goquery"
"goyomi/internal/httpclient"
"goyomi/internal/httpclient/flare"
"goyomi/internal/source"
"goyomi/sources/base/util"
)
@@ -27,12 +27,12 @@ type Config struct {
type Source struct {
cfg Config
client *httpclient.Client
client *flare.Client
id int64
}
func New(cfg Config) *Source {
c := httpclient.NewClient(httpclient.WithRateLimit(1, 2))
c := flare.NewClient(flare.WithRateLimit(1, 2))
return &Source{cfg: cfg, client: c, id: source.GenerateSourceID(cfg.Name, cfg.Lang)}
}
@@ -42,12 +42,7 @@ func (s *Source) Lang() string { return s.cfg.Lang }
func (s *Source) SupportsLatest() bool { return true }
func (s *Source) get(ctx context.Context, rawURL string) (*goquery.Document, error) {
req, err := http.NewRequestWithContext(ctx, http.MethodGet, rawURL, nil)
if err != nil {
return nil, err
}
req.Header.Set("Referer", s.cfg.BaseURL+"/")
resp, err := s.client.Do(req)
resp, err := s.client.Get(ctx, rawURL)
if err != nil {
return nil, err
}