From c926498d3d12f4e59c5fe0cd40a77c42d15c30b9 Mon Sep 17 00:00:00 2001 From: Dave Z Date: Thu, 12 Jul 2018 20:41:09 -0400 Subject: 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 --- template/functions.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'template') 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) -- cgit v1.2.3