Remove no-op item.thumbnail.secure_url

There was a time when I used an old proxy server to try to fix mixed
content issues, and I eventually removed it but never took the tendrils
out from the code.

We probably _should_ figure out how to secure these URLs! But until
then, we may as well simplify the code.
This commit is contained in:
Emi Matchu 2023-11-11 08:24:08 -08:00
parent 5e25e0bda6
commit c6cb61ef38
6 changed files with 5 additions and 29 deletions

View file

@ -19,7 +19,7 @@ module ContributionHelper
:item_link => link)
output = translate("contributions.contributed_description.main.#{main_key}_html",
:item_description => description)
output << image_tag(item.thumbnail.secure_url) if show_image
output << image_tag(item.thumbnail_url) if show_image
output
else
translate('contributions.contributed_description.parents.item.blank')

View file

@ -1,14 +0,0 @@
class Image
attr_reader :insecure_url, :secure_url
def initialize(insecure_url, secure_url)
@insecure_url = insecure_url
@secure_url = secure_url
end
def self.from_insecure_url(insecure_url)
# 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

@ -413,16 +413,6 @@ class Item < ApplicationRecord
modeled_body_ids.size.to_f / predicted_body_ids.size
end
def thumbnail
if thumbnail_url.present?
url = thumbnail_url
else
url = ActionController::Base.helpers.asset_path(
"broken_item_thumbnail.gif")
end
@thumbnail ||= Image.from_insecure_url(url)
end
def as_json(options={})
json = {
:description => description,

View file

@ -1,4 +1,4 @@
= link_to item_path(item) do
= image_tag item.thumbnail.secure_url, :alt => item.description, :title => item.description
= image_tag item.thumbnail_url, :alt => item.description, :title => item.description
%span.name= item.name
= nc_icon_for(item)

View file

@ -2,7 +2,7 @@
- canonical_path @item
%header#item-header
= image_tag @item.thumbnail.secure_url, :id => 'item-thumbnail'
= image_tag @item.thumbnail_url, :id => 'item-thumbnail'
%div
%h2#item-name= @item.name
= nc_icon_for(@item)

View file

@ -88,7 +88,7 @@
- @newest_unmodeled_items.each do |item|
- localized_cache "items/#{item.id} modeling_progress updated_at=#{item.updated_at.to_i}" do
%li{'data-item-id' => item.id}
= link_to image_tag(item.thumbnail.secure_url), item, :class => 'image-link'
= link_to image_tag(item.thumbnail_url), item, :class => 'image-link'
= link_to item, :class => 'header' do
%h2= item.name
%span.meter{style: "width: #{@newest_unmodeled_items_predicted_modeled_ratio[item]*100}%"}
@ -101,7 +101,7 @@
- @newest_modeled_items.each do |item|
%li.object
= link_to item, title: item.name, alt: item.name do
= image_tag item.thumbnail.secure_url
= image_tag item.thumbnail_url
= nc_icon_for(item)