Add site setting for domains to never download images from

This commit is contained in:
riking
2014-04-21 13:59:53 -07:00
parent a6b88d1e7e
commit b309deef11
4 changed files with 16 additions and 1 deletions

View File

@ -72,6 +72,16 @@ class SiteSetting < ActiveRecord::Base
.first
end
def self.should_download_images?(src)
setting = disabled_image_download_domains
return true unless setting.present?
host = URI.parse(src).host
return !(setting.split('|').include?(host))
rescue URI::InvalidURIError
return true
end
def self.scheme
use_https? ? "https" : "http"
end