mirror of
https://github.com/miniflux/v2.git
synced 2025-07-12 16:58:36 +00:00
Make add_invidious_video rule applicable for different invidious instances
This commit is contained in:
parent
bf2f7d1e16
commit
0f258fd55b
3 changed files with 11 additions and 7 deletions
|
@ -100,7 +100,7 @@ func sanitizeAttributes(baseURL, tagName string, attributes []html.Attribute) ([
|
|||
|
||||
if isExternalResourceAttribute(attribute.Key) {
|
||||
if tagName == "iframe" {
|
||||
if isValidIframeSource(attribute.Val) {
|
||||
if isValidIframeSource(baseURL, attribute.Val) {
|
||||
value = rewriteIframeURL(attribute.Val)
|
||||
} else {
|
||||
continue
|
||||
|
@ -290,7 +290,7 @@ func isBlacklistedResource(src string) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
func isValidIframeSource(src string) bool {
|
||||
func isValidIframeSource(baseURL, src string) bool {
|
||||
whitelist := []string{
|
||||
"https://invidio.us",
|
||||
"//www.youtube.com",
|
||||
|
@ -312,6 +312,11 @@ func isValidIframeSource(src string) bool {
|
|||
"https://cdn.embedly.com",
|
||||
}
|
||||
|
||||
// allow iframe from same origin
|
||||
if url.Domain(baseURL) == url.Domain(src) {
|
||||
return true
|
||||
}
|
||||
|
||||
for _, prefix := range whitelist {
|
||||
if strings.HasPrefix(src, prefix) {
|
||||
return true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue