Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
barmintor committed Nov 19, 2024
1 parent 19c0552 commit 73c38d0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/controllers/concerns/iiif/authz/v2/bytestreams.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def probe
response.headers["Cache-Control"] = "no-cache, no-store"
@response, @document = fetch(params[:catalog_id])
resource_doc = resources_for_document(@document, false).detect {|x| x[:id].split('/')[-1] == params[:bytestream_id]}
resource_doc = true if @document && (@document.fetch('dc_type_ssm',[]) & ['StillImage', 'Image']).present?
if @document.nil? || resource_doc.nil?
render status: :not_found, plain: "resource not found"
return
Expand Down
7 changes: 7 additions & 0 deletions app/models/iiif/authz/v2/probe_service/response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ def redirect_location_properties(ability_helper=@ability_helper)
format: 'application/vnd.apple.mpegurl'
}
end
if (@document.fetch('dc_type_ssm',[]) & ['StillImage', 'Image']).present?
return {
status: 302,
location: Dcv::Utils::CdnUtils.info_url(id: @document['fedora_pid_uri_ssi']&.split('/').last),
format: 'application/json+ld'
}
end
preferred_bytestream_id = Dcv::Utils::UrlUtils.preferred_content_bytestream(@document)
return { status: 302, location: route_helper.bytestream_content_url(catalog_id: @document.id, bytestream_id: preferred_bytestream_id) }
end
Expand Down
3 changes: 3 additions & 0 deletions app/models/iiif/painting_annotation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ def annotation_body(routing_opts)
body['format'] = 'image/jpeg'
iiif_id = Dcv::Utils::CdnUtils.info_url(id: canvas.fedora_pid).sub(/\/info.json$/,'')
body['service'].first['@id'] = iiif_id
unless ability_helper.can_access_asset?(canvas.solr_document, Ability.new) # public
body['service'].first['service'] = [Iiif::Authz::V2::ProbeService.new(canvas, route_helper: route_helper, ability_helper: ability_helper)]
end
elsif body['type'] == Iiif::Type::V3::TEXT
body.merge!(IIIF_TEMPLATES['text_annotation_body'].deep_dup)
catalog_id = canvas.solr_document.id
Expand Down

0 comments on commit 73c38d0

Please sign in to comment.