diff options
author | Dave Z <dzaikos@users.noreply.github.com> | 2018-07-12 20:41:09 -0400 |
---|---|---|
committer | Frédéric Guillot <fred@miniflux.net> | 2018-07-12 17:41:09 -0700 |
commit | c926498d3d12f4e59c5fe0cd40a77c42d15c30b9 (patch) | |
tree | 2bf52c7baa69ff8a7f1223826405147fbe615f94 /template | |
parent | 6fd6f79daf8a55eb97345f377d136cc320637580 (diff) |
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
Diffstat (limited to 'template')
-rw-r--r-- | template/functions.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/template/functions.go b/template/functions.go index e80a4a5..f68d6fb 100644 --- a/template/functions.go +++ b/template/functions.go @@ -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) |