1
0
Fork 0
forked from OpenNeo/impress

Delete Camo references & Addressable gem

At one point we piloted a "Camo" service to proxy HTTPS image urls for us, but it doesn't exist anymore.

We already have proxies and stuff for this, so I left `Image` as a placeholder for this, but it's not working yet!

This also deletes our final reference to the Addressable gem, so we can remove it!
This commit is contained in:
Matchu 2023-08-02 13:16:05 -07:00 committed by Matchu
parent fd263ea82f
commit d0616b6dfd
6 changed files with 4 additions and 26 deletions

View file

@ -19,8 +19,6 @@ gem 'RocketAMF', :git => 'https://github.com/rubyamf/rocketamf.git'
gem 'msgpack', '~> 0.5.3'
gem 'openneo-auth-signatory', '~> 0.1.0'
gem 'addressable', :require => ['addressable/template', 'addressable/uri']
gem 'right_aws', '~> 2.1.0'
gem "character-encodings", "~> 0.4.1", :platforms => :ruby_18

View file

@ -226,7 +226,6 @@ PLATFORMS
DEPENDENCIES
RocketAMF!
addressable
capistrano (~> 2.15.5)
character-encodings (~> 0.4.1)
compass-rails (~> 3.1)

View file

@ -235,9 +235,5 @@ module ApplicationHelper
:contributions_link_url => user_contributions_path(user),
:user_points => user.points
end
def camo_image_url(image_url)
Image.from_insecure_url(image_url).secure_url
end
end

View file

@ -7,19 +7,8 @@ class Image
end
def self.from_insecure_url(insecure_url)
Image.new insecure_url, proxy_insecure_url(insecure_url)
end
private
def self.proxy_insecure_url(insecure_url)
if CAMO_HOST && CAMO_KEY
hexdigest = OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), CAMO_KEY, insecure_url)
uri = Addressable::URI.parse("#{CAMO_HOST}/#{hexdigest}")
uri.query_values = { url: insecure_url }
uri.to_s
else
insecure_url
end
# TODO: We used to use a "Camo" server for this, but we don't anymore.
# Replace this with actual logic to actually secure the URLs!
Image.new insecure_url, insecure_url
end
end

View file

@ -80,7 +80,7 @@
%li
= link_to bulk_pets_path do
= image_tag camo_image_url('http://images.neopets.com/items/mall_ac_garland_spotlight.gif')
= image_tag 'http://images.neopets.com/items/mall_ac_garland_spotlight.gif'
%h3= link_to t('modeling_hub'), bulk_pets_path
%div
%h4= t '.modeling_hub.tagline'

View file

@ -1,4 +0,0 @@
# For the openneo-camo.herokuapps.com server, which proxies assets through HTTPS.
# If you have no config, that's okay; we'll just serve the regular URL instead of the Camo URL.
CAMO_HOST = ENV['CAMO_HOST']
CAMO_KEY = ENV['CAMO_KEY']