refactor: use per-source HTTP client instead of global proxy

- Remove global ProxyEnabled() logic from httpclient
- Each source now explicitly chooses client at import time:
  - flare client: for JS-rendering/cloudflare sources
  - normal httpclient: for REST API sources
- Updated 29 base sources based on Kotlin reference (network.cloudflareClient)
This commit is contained in:
achmad
2026-05-13 09:01:51 +07:00
parent b199bad30d
commit 9a42dd2ab1
31 changed files with 96 additions and 255 deletions
-12
View File
@@ -6,11 +6,9 @@ import (
"fmt"
"log"
"net/http"
"os"
"goyomi/internal/config"
"goyomi/internal/db"
"goyomi/internal/httpclient"
_ "goyomi/internal/registry"
_ "goyomi/sources/all/hentaihand"
_ "goyomi/sources/all/kemono"
@@ -46,16 +44,6 @@ func main() {
// Initialize config manager
config.InitConfigManager(database.Queries)
if os.Getenv("FLARESOLVERR_URL") != "" {
fsClient, err := httpclient.NewFlareSolverrClient()
if err != nil {
log.Printf("flaresolverr: client creation failed: %v", err)
} else {
httpclient.SetGlobalFlareSolverr(fsClient)
log.Printf("flaresolverr: client initialized")
}
}
mux := http.NewServeMux()
mux.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, "ok")