Skip insecure certificates check when scraping (#1120)

* Ignore insecure certificates when scraping
* add ScraperCertCheck to scraper config options
This commit is contained in:
bnkai
2021-03-01 02:47:39 +02:00
committed by GitHub
parent a9ac176e91
commit 144cd6e4f2
9 changed files with 47 additions and 0 deletions

View File

@@ -86,6 +86,7 @@ const SessionStoreKey = "session_store_key"
// scraping options
const ScrapersPath = "scrapers_path"
const ScraperUserAgent = "scraper_user_agent"
const ScraperCertCheck = "scraper_cert_check"
const ScraperCDPPath = "scraper_cdp_path"
// stash-box options
@@ -274,6 +275,17 @@ func GetScraperCDPPath() string {
return viper.GetString(ScraperCDPPath)
}
// GetScraperCertCheck returns true if the scraper should check for insecure
// certificates when fetching an image or a page.
func GetScraperCertCheck() bool {
ret := true
if viper.IsSet(ScraperCertCheck) {
ret = viper.GetBool(ScraperCertCheck)
}
return ret
}
func GetStashBoxes() []*models.StashBox {
var boxes []*models.StashBox
viper.UnmarshalKey(StashBoxes, &boxes)