iiif_print 3.0.12 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a4551ae83d8bd370109a2532c3bd4cbeab4e97b8cc33f6044ece488eb2e3788c
4
- data.tar.gz: 33ca8e19b35d2b25b3bca1a032a711079313646115988e56eae71945ba7e9f04
3
+ metadata.gz: 4050e3e2e6c79d5d93bc63e2801f75bb13a7a1985dc2729ead3c0a15c4855075
4
+ data.tar.gz: b0d627fa5b6d190d0fbdae66e2db116e77eb74bf3473630c008a61dd794ed600
5
5
  SHA512:
6
- metadata.gz: 7f38d9d98db8f547d5fb9af63e44cfb1ef5e616cc7e513d70ccee194f830668a2f259923fe7be7ba5fe19be834a46d56494e3988ac1f20fe219d6b5a0b589b94
7
- data.tar.gz: 3630e05021abcc8dc82788c1dc88bdc7ecfbfa21214280ea291e89c3d8f23fe03740a9dcc19baa8c8c527c10b931b0256f03b762776cc53caf2c6fd45a0a0d8e
6
+ metadata.gz: c9f52bc069331756409eae5f67b878b2801c46d14e44fa36804faed750cfb2c07c5159015e5e236c084b0dcf8e0d2412d2d907905c43a07feba068c475761160
7
+ data.tar.gz: 7f58c71b8f933df6cec597f766494091a3c33fcd4734a14118ee7213d80262d52ebd3196b452267136913dfcba3a614fbc81dfbf7399edacb44687a6defa7876
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /app/samvera/hyrax-webapp
3
3
  specs:
4
- iiif_print (3.0.12)
4
+ iiif_print (3.1.0)
5
5
  blacklight_iiif_search (>= 1.0, < 3.0)
6
6
  derivative-rodeo (~> 0.5)
7
7
  hyrax (>= 2.5, < 6)
data/README.md CHANGED
@@ -121,7 +121,17 @@ We created IiifPrint with an assumption of ActiveFedora. However, as Hyrax now
121
121
 
122
122
  ### IIIF URL configuration
123
123
 
124
- If you set EXTERNAL_IIIF_URL in your environment, then IiifPrint will use that URL as the root for your IIIF URLs. It will also switch from using the file set ID to using the SHA1 of the file as the identifier. This enables using serverless_iiif or Cantaloupe (refered to as the service) by pointing the service to the same S3 bucket that FCREPO writes the uploaded files to. By setting it up that way you do not need the service to connect to FCREPO or Hyrax at all, both natively support connecting to an S3 bucket to get their data.
124
+ If you set `EXTERNAL_IIIF_URL` in your environment, IiifPrint will use that URL as the root for your IIIF URLs. It will also switch from using the file set ID to using the file's checksum hex digest as the identifier. In Wings/Fedora mode the digest is stored as a `urn:sha1:HEX` string; in Valkyrie mode it is stored as a plain hex string IiifPrint handles both automatically.
125
+
126
+ This enables using serverless_iiif or Cantaloupe (referred to as the service) by pointing the service to the same S3 bucket that the repository writes uploaded files to. By setting it up that way you do not need the service to connect to Fedora or Hyrax at all — both natively support connecting to an S3 bucket to retrieve file content.
127
+
128
+ If your S3 bucket organises files under a folder prefix (e.g. a `staging/` or `production/` subfolder), set `IIIF_S3_FOLDER_PREFIX` to that prefix. IiifPrint will prepend it to the digest identifier and percent-encode the separator so the combined value is a single IIIF path segment:
129
+
130
+ ```
131
+ EXTERNAL_IIIF_URL=https://iiif.example.org
132
+ IIIF_S3_FOLDER_PREFIX=staging
133
+ # → identifier used: staging%2F<hex-digest>
134
+ ```
125
135
 
126
136
  ### Model level configurations
127
137
 
@@ -2,8 +2,17 @@
2
2
 
3
3
  module IiifPrint
4
4
  module SolrDocumentDecorator
5
+ def digest_hex
6
+ raw = digest
7
+ return nil if raw.blank?
8
+ # Wings/Fedora stores "urn:sha1:HEX" or "urn:md5:HEX"; Valkyrie stores a plain hex string.
9
+ raw[/\Aurn:[^:]+:([\w]+)\z/, 1] || raw
10
+ end
11
+
5
12
  def digest_sha1
6
- digest[/urn:sha1:([\w]+)/, 1]
13
+ Deprecation.warn(self, "#digest_sha1 is deprecated; use #digest_hex instead. " \
14
+ "#digest_sha1 will be removed in the next major version.")
15
+ digest_hex
7
16
  end
8
17
 
9
18
  def method_missing(method_name, *args, &block)
@@ -1,3 +1,5 @@
1
+ require 'cgi'
2
+
1
3
  # mixin to provide URL for IIIF Content Search service
2
4
  module IiifPrint
3
5
  module IiifManifestPresenter
@@ -82,7 +84,13 @@ module IiifPrint
82
84
  end
83
85
 
84
86
  def external_latest_file_id
85
- @latest_file_id ||= digest_sha1
87
+ hex = digest_hex
88
+ return nil if hex.blank?
89
+
90
+ prefix = ENV['IIIF_S3_FOLDER_PREFIX'].presence
91
+ return hex unless prefix
92
+
93
+ CGI.escape("#{prefix}/#{hex}")
86
94
  end
87
95
 
88
96
  def iiif_image_url_builder(url_builder:)
@@ -1,5 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ begin
4
+ require 'dry/container'
5
+ rescue LoadError
6
+ nil
7
+ end
8
+
9
+ # dry-transaction >= 0.15 dropped dry-container, so Dry::Container::Mixin is unavailable in those
10
+ # environments. Guard the entire decorator so iiif_print still boots in Hyrax 2.x / newer dry-rb.
11
+ return unless defined?(Dry::Container)
12
+
3
13
  module Hyrax
4
14
  module Transactions
5
15
  ##
@@ -1,3 +1,3 @@
1
1
  module IiifPrint
2
- VERSION = '3.0.12'.freeze
2
+ VERSION = '3.1.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iiif_print
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.12
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Upton
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2026-03-06 00:00:00.000000000 Z
17
+ date: 2026-06-16 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: blacklight_iiif_search
@@ -511,7 +511,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
511
511
  - !ruby/object:Gem::Version
512
512
  version: '0'
513
513
  requirements: []
514
- rubygems_version: 3.1.6
514
+ rubygems_version: 3.3.20
515
515
  signing_key:
516
516
  specification_version: 4
517
517
  summary: IiifPrint is a gem (Rails "engine") for Hyrax-based digital repository applications