mirror of
https://github.com/miniflux/v2.git
synced 2025-07-27 17:28:38 +00:00
http client: remove dependency on global config options
This commit is contained in:
parent
065331c77f
commit
16b7b3bc3e
7 changed files with 148 additions and 72 deletions
|
@ -10,6 +10,7 @@ import (
|
|||
"regexp"
|
||||
"strings"
|
||||
|
||||
"miniflux.app/config"
|
||||
"miniflux.app/errors"
|
||||
"miniflux.app/http/client"
|
||||
"miniflux.app/reader/browser"
|
||||
|
@ -30,15 +31,15 @@ func FindSubscriptions(websiteURL, userAgent, username, password string, fetchVi
|
|||
websiteURL = findYoutubeChannelFeed(websiteURL)
|
||||
websiteURL = parseYoutubeVideoPage(websiteURL)
|
||||
|
||||
request := client.New(websiteURL)
|
||||
request.WithCredentials(username, password)
|
||||
request.WithUserAgent(userAgent)
|
||||
clt := client.NewClientWithConfig(websiteURL, config.Opts)
|
||||
clt.WithCredentials(username, password)
|
||||
clt.WithUserAgent(userAgent)
|
||||
|
||||
if fetchViaProxy {
|
||||
request.WithProxy()
|
||||
clt.WithProxy()
|
||||
}
|
||||
|
||||
response, err := browser.Exec(request)
|
||||
response, err := browser.Exec(clt)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -118,8 +119,8 @@ func parseYoutubeVideoPage(websiteURL string) string {
|
|||
return websiteURL
|
||||
}
|
||||
|
||||
request := client.New(websiteURL)
|
||||
response, browserErr := browser.Exec(request)
|
||||
clt := client.NewClientWithConfig(websiteURL, config.Opts)
|
||||
response, browserErr := browser.Exec(clt)
|
||||
if browserErr != nil {
|
||||
return websiteURL
|
||||
}
|
||||
|
@ -155,10 +156,10 @@ func tryWellKnownUrls(websiteURL, userAgent, username, password string) (Subscri
|
|||
if err != nil {
|
||||
continue
|
||||
}
|
||||
request := client.New(fullURL)
|
||||
request.WithCredentials(username, password)
|
||||
request.WithUserAgent(userAgent)
|
||||
response, err := request.Get()
|
||||
clt := client.NewClientWithConfig(fullURL, config.Opts)
|
||||
clt.WithCredentials(username, password)
|
||||
clt.WithUserAgent(userAgent)
|
||||
response, err := clt.Get()
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue