mirror of
https://github.com/miniflux/v2.git
synced 2025-08-06 17:41:00 +00:00
refactor(mediaproxy): simplify shouldProxy
The original function was non-trivial to understand, as `!A && (B || !C)` isn't easily grokable by humans.
This commit is contained in:
parent
052e8dd0aa
commit
f864a2ed70
1 changed files with 10 additions and 2 deletions
|
@ -108,6 +108,14 @@ func proxifySourceSet(element *goquery.Selection, router *mux.Router, proxifyFun
|
|||
}
|
||||
|
||||
func shouldProxy(attrValue, proxyOption string) bool {
|
||||
return !strings.HasPrefix(attrValue, "data:") &&
|
||||
(proxyOption == "all" || !urllib.IsHTTPS(attrValue))
|
||||
if strings.HasPrefix(attrValue, "data:") {
|
||||
return false
|
||||
}
|
||||
if proxyOption == "all" {
|
||||
return true
|
||||
}
|
||||
if !urllib.IsHTTPS(attrValue) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue