From e21d1125a53108fa6e4d6ce4c79599a3264e6e5b Mon Sep 17 00:00:00 2001 From: Eric O Date: Tue, 20 Feb 2024 19:05:15 -0500 Subject: [PATCH] Switch image requests to Hyacinth image proxy endpoint --- .../digital_objects_app/models/digital_object/asset.js | 2 +- .../digital_objects_app/models/digital_object/base.js | 2 +- .../digital_objects_app/models/digital_object/item.js | 2 +- .../models/digital_object_search_result.js | 4 ++-- app/assets/javascripts/general/hyacinth.js.erb | 1 + app/views/digital_objects/media_view.html.erb | 2 +- 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/digital_objects_app/models/digital_object/asset.js b/app/assets/javascripts/digital_objects_app/models/digital_object/asset.js index 52734540e..7f28f34f2 100644 --- a/app/assets/javascripts/digital_objects_app/models/digital_object/asset.js +++ b/app/assets/javascripts/digital_objects_app/models/digital_object/asset.js @@ -87,7 +87,7 @@ Hyacinth.DigitalObjectsApp.DigitalObject.Asset.prototype.getOriginalFilePath = f }; Hyacinth.DigitalObjectsApp.DigitalObject.Asset.prototype.hasImage = function () { - return Hyacinth.imageServerUrl && this.getDcType() == 'StillImage'; + return Hyacinth.imageServerProxyPath && this.getDcType() == 'StillImage'; }; Hyacinth.DigitalObjectsApp.DigitalObject.Asset.prototype.isRestrictedSizeImage = function () { diff --git a/app/assets/javascripts/digital_objects_app/models/digital_object/base.js b/app/assets/javascripts/digital_objects_app/models/digital_object/base.js index 8c94364d8..0c630fd91 100644 --- a/app/assets/javascripts/digital_objects_app/models/digital_object/base.js +++ b/app/assets/javascripts/digital_objects_app/models/digital_object/base.js @@ -24,7 +24,7 @@ Hyacinth.DigitalObjectsApp.DigitalObject.Base.getImageUrl = function (pid, type, if (type == 'scaled') { type = 'full'; } if (type == 'square') { type = 'featured'; } - return Hyacinth.imageServerUrl + '/iiif/2/standard/' + pid + '/' + type + '/!' + size + ',' + size + '/0/default.jpg'; + return Hyacinth.imageServerProxyPath + '/iiif/2/standard/' + pid + '/' + type + '/!' + size + ',' + size + '/0/default.jpg'; }; Hyacinth.DigitalObjectsApp.DigitalObject.Base.showMediaViewModal = function (pid) { diff --git a/app/assets/javascripts/digital_objects_app/models/digital_object/item.js b/app/assets/javascripts/digital_objects_app/models/digital_object/item.js index cce6a5b77..415ace5b8 100644 --- a/app/assets/javascripts/digital_objects_app/models/digital_object/item.js +++ b/app/assets/javascripts/digital_objects_app/models/digital_object/item.js @@ -5,5 +5,5 @@ Hyacinth.DigitalObjectsApp.DigitalObject.Item = function(digital_object_data){ Hyacinth.extendClass(Hyacinth.DigitalObjectsApp.DigitalObject.Item, Hyacinth.DigitalObjectsApp.DigitalObject.Base); //Extend Hyacinth.DigitalObjectsApp.DigitalObject.Item.prototype.hasImage = function (){ - return Hyacinth.imageServerUrl && this.ordered_child_digital_object_pids.length > 0; + return Hyacinth.imageServerProxyPath && this.ordered_child_digital_object_pids.length > 0; }; diff --git a/app/assets/javascripts/digital_objects_app/models/digital_object_search_result.js b/app/assets/javascripts/digital_objects_app/models/digital_object_search_result.js index 73fdb5ea0..f3eed099e 100644 --- a/app/assets/javascripts/digital_objects_app/models/digital_object_search_result.js +++ b/app/assets/javascripts/digital_objects_app/models/digital_object_search_result.js @@ -57,9 +57,9 @@ Hyacinth.DigitalObjectsApp.DigitalObjectSearchResult.prototype.getImageUrl = fun if(type == 'square') { type = 'featured'; } if(this.getHyacinthType() == 'asset') { - return Hyacinth.imageServerUrl + '/iiif/2/standard/' + this.getPid() + '/' + type + '/!' + size + ',' + size + '/0/default.jpg'; + return Hyacinth.imageServerProxyPath + '/iiif/2/standard/' + this.getPid() + '/' + type + '/!' + size + ',' + size + '/0/default.jpg'; } else if (this.getHyacinthType() == 'item' && this.getOrderedChildDigitalObjectPids().length > 0) { - return Hyacinth.imageServerUrl + '/iiif/2/standard/' + this.getOrderedChildDigitalObjectPids()[0] + '/' + type + '/!' + size + ',' + size + '/0/default.jpg'; + return Hyacinth.imageServerProxyPath + '/iiif/2/standard/' + this.getOrderedChildDigitalObjectPids()[0] + '/' + type + '/!' + size + ',' + size + '/0/default.jpg'; } else { return null; } diff --git a/app/assets/javascripts/general/hyacinth.js.erb b/app/assets/javascripts/general/hyacinth.js.erb index d08179707..c8c4095fc 100644 --- a/app/assets/javascripts/general/hyacinth.js.erb +++ b/app/assets/javascripts/general/hyacinth.js.erb @@ -8,6 +8,7 @@ Hyacinth.unexpectedAjaxErrorMessage = 'An unexpected error occurred while connec <% else %> Hyacinth.imageServerUrl = null; <% end %> +Hyacinth.imageServerProxyPath = '/image_proxy'; //Hyacinth.AssignmentTaskTypes = <%#= Assignment.tasks.keys.map{|task| [task, task] }.to_h.to_json %>; diff --git a/app/views/digital_objects/media_view.html.erb b/app/views/digital_objects/media_view.html.erb index f8bc8c1a5..ca1ea0c70 100644 --- a/app/views/digital_objects/media_view.html.erb +++ b/app/views/digital_objects/media_view.html.erb @@ -2,7 +2,7 @@