From eb3112116ae926921fbefd3677ed16a6da65f645 Mon Sep 17 00:00:00 2001 From: Adam Mathes Date: Fri, 27 Apr 2018 08:44:59 -0700 Subject: img proxy as config option --- models/item/item.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'models/item') diff --git a/models/item/item.go b/models/item/item.go index 1e7e86a..8d1d473 100644 --- a/models/item/item.go +++ b/models/item/item.go @@ -1,6 +1,7 @@ package item import ( + "adammathes.com/neko/config" "adammathes.com/neko/models" "adammathes.com/neko/vlog" "encoding/base64" @@ -179,7 +180,9 @@ func Filter(max_id int64, feed_id int64, category string, unread_only bool, star // but still may need to adjust rules i.Title = p.Sanitize(i.Title) i.Description = p.Sanitize(i.Description) - i.Description = rewriteImages(i.Description) + if config.Config.ProxyImages { + i.Description = rewriteImages(i.Description) + } i.Url = p.Sanitize(i.Url) i.FeedTitle = p.Sanitize(i.FeedTitle) i.FeedUrl = p.Sanitize(i.FeedUrl) @@ -201,6 +204,7 @@ func (i *Item) CleanHeaderImage() { } } +// rewrite images to use local proxy func rewriteImages(s string) string { doc, err := goquery.NewDocumentFromReader(strings.NewReader(s)) if err != nil { -- cgit v1.2.3