From d0616b6dfdd240efa1b2da6e530d180bcf284b7b Mon Sep 17 00:00:00 2001 From: Matchu Date: Wed, 2 Aug 2023 13:16:05 -0700 Subject: [PATCH] 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! --- Gemfile | 2 -- Gemfile.lock | 1 - app/helpers/application_helper.rb | 4 ---- app/models/image.rb | 17 +++-------------- app/views/outfits/new.html.haml | 2 +- config/initializers/camo.rb | 4 ---- 6 files changed, 4 insertions(+), 26 deletions(-) delete mode 100644 config/initializers/camo.rb diff --git a/Gemfile b/Gemfile index d172d4d4..8f8d8f9a 100644 --- a/Gemfile +++ b/Gemfile @@ -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 diff --git a/Gemfile.lock b/Gemfile.lock index 3f7c0a09..0f639350 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -226,7 +226,6 @@ PLATFORMS DEPENDENCIES RocketAMF! - addressable capistrano (~> 2.15.5) character-encodings (~> 0.4.1) compass-rails (~> 3.1) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 522ac307..b431bd17 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -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 diff --git a/app/models/image.rb b/app/models/image.rb index 6fd60660..75f027aa 100644 --- a/app/models/image.rb +++ b/app/models/image.rb @@ -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 diff --git a/app/views/outfits/new.html.haml b/app/views/outfits/new.html.haml index 4cc0acc8..722d9c09 100644 --- a/app/views/outfits/new.html.haml +++ b/app/views/outfits/new.html.haml @@ -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' diff --git a/config/initializers/camo.rb b/config/initializers/camo.rb deleted file mode 100644 index 40f6cbef..00000000 --- a/config/initializers/camo.rb +++ /dev/null @@ -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']