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

Make image proxy configurable

Adds IMAGE_PROXY configuration setting to change image proxy filter behaviour:

- none = No proxy
- http-only = Proxy only non-HTTPS images (default)
- all = Proxy everything
This commit is contained in:
Dave Z 2018-07-12 20:41:09 -04:00 committed by Frédéric Guillot
parent 6fd6f79daf
commit c926498d3d
4 changed files with 138 additions and 11 deletions

View file

@ -46,14 +46,16 @@ func (f *funcMap) Map() template.FuncMap {
return template.HTML(str)
},
"proxyFilter": func(data string) string {
return filter.ImageProxyFilter(f.router, data)
return filter.ImageProxyFilter(f.router, f.cfg, data)
},
"proxyURL": func(link string) string {
if url.IsHTTPS(link) {
return link
proxyImages := f.cfg.ProxyImages()
if proxyImages == "all" || (proxyImages != "none" && !url.IsHTTPS(link)) {
return filter.Proxify(f.router, link)
}
return filter.Proxify(f.router, link)
return link
},
"domain": func(websiteURL string) string {
return url.Domain(websiteURL)