mirror of
https://github.com/miniflux/v2.git
synced 2025-06-27 16:36:00 +00:00
perf(rewrite): make getPredefinedRewriteRules O(1)
This commit is contained in:
parent
b296f21e98
commit
81df0b2a16
2 changed files with 4 additions and 6 deletions
|
@ -136,11 +136,9 @@ func parseRules(rulesText string) (rules []rule) {
|
|||
}
|
||||
|
||||
func getPredefinedRewriteRules(entryURL string) string {
|
||||
urlDomain := urllib.Domain(entryURL)
|
||||
for domain, rules := range predefinedRules {
|
||||
if strings.Contains(urlDomain, domain) {
|
||||
return rules
|
||||
}
|
||||
urlDomain := urllib.DomainWithoutWWW(entryURL)
|
||||
if rules, ok := predefinedRules[urlDomain]; ok {
|
||||
return rules
|
||||
}
|
||||
|
||||
return ""
|
||||
|
|
|
@ -26,11 +26,11 @@ var predefinedRules = map[string]string{
|
|||
"optipess.com": "add_image_title",
|
||||
"peebleslab.com": "add_image_title",
|
||||
"quantamagazine.org": `add_youtube_video_from_id, remove("h6:not(.byline,.post__title__kicker), #comments, .next-post__content, .footer__section, figure .outer--content, script")`,
|
||||
"qwantz.com": "add_image_title,add_mailto_subject",
|
||||
"sentfromthemoon.com": "add_image_title",
|
||||
"thedoghousediaries.com": "add_image_title",
|
||||
"theverge.com": `add_dynamic_image, remove("div.duet--recirculation--related-list, .hidden")`,
|
||||
"treelobsters.com": "add_image_title",
|
||||
"www.qwantz.com": "add_image_title,add_mailto_subject",
|
||||
"xkcd.com": "add_image_title",
|
||||
"youtube.com": "add_youtube_video",
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue