1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-11 17:51:01 +00:00

refactor(internal): add an urllib.DomainWithoutWWW function

This commit is contained in:
jvoisin 2025-06-17 16:34:13 +02:00 committed by Frédéric Guillot
parent af15032145
commit b296f21e98
3 changed files with 7 additions and 3 deletions

View file

@ -486,7 +486,7 @@ func isBlockedResource(absoluteURL string) bool {
}
func isValidIframeSource(iframeSourceURL string) bool {
iframeSourceDomain := strings.TrimPrefix(urllib.Domain(iframeSourceURL), "www.")
iframeSourceDomain := urllib.DomainWithoutWWW(iframeSourceURL)
if _, ok := iframeAllowList[iframeSourceDomain]; ok {
return true

View file

@ -93,8 +93,7 @@ func findContentUsingCustomRules(page io.Reader, rules string) (baseURL string,
}
func getPredefinedScraperRules(websiteURL string) string {
urlDomain := urllib.Domain(websiteURL)
urlDomain = strings.TrimPrefix(urlDomain, "www.")
urlDomain := urllib.DomainWithoutWWW(websiteURL)
if rules, ok := predefinedRules[urlDomain]; ok {
return rules