aboutsummaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorAdam Mathes <adam@trenchant.org>2018-04-27 08:44:59 -0700
committerAdam Mathes <adam@trenchant.org>2018-04-27 08:44:59 -0700
commiteb3112116ae926921fbefd3677ed16a6da65f645 (patch)
tree76ee877488c64c7a05737067d838627f63c5a8a5 /models
parent071a352c7553224aa8d3dd3a95fc945488c3d943 (diff)
downloadneko-eb3112116ae926921fbefd3677ed16a6da65f645.tar.gz
neko-eb3112116ae926921fbefd3677ed16a6da65f645.tar.bz2
neko-eb3112116ae926921fbefd3677ed16a6da65f645.zip
img proxy as config option
Diffstat (limited to 'models')
-rw-r--r--models/item/item.go6
1 files changed, 5 insertions, 1 deletions
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 {