mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 21:55:25 +08:00
Add site setting for domains to never download images from
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user