Add Camo for OpenGraph images

This commit is contained in:
Dennis Schubert 2014-11-09 01:36:16 +01:00
parent 89ad5b96ad
commit db2560d7fc

View file

@ -15,6 +15,14 @@ class OpenGraphCache < ActiveRecord::Base
t.add :url
end
def image
if AppConfig.privacy.camo.proxy_opengraph_thumbnails?
Diaspora::Camo::image_url(self[:image])
else
self[:image]
end
end
def self.find_or_create_by(opts)
cache = OpenGraphCache.find_or_initialize_by(opts)
cache.fetch_and_save_opengraph_data! unless cache.persisted?