iiif_print 3.0.11 → 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: 653b6bcf6d9120cbdfa3f0fd05d4034497a9147611d275e5d3111cf75edacc67
4
- data.tar.gz: a565d045ce46175b631091b94e99160ccd8b77bccc72faf6d9c298f47dc2d8e5
3
+ metadata.gz: 4050e3e2e6c79d5d93bc63e2801f75bb13a7a1985dc2729ead3c0a15c4855075
4
+ data.tar.gz: b0d627fa5b6d190d0fbdae66e2db116e77eb74bf3473630c008a61dd794ed600
5
5
  SHA512:
6
- metadata.gz: 005d431cee41520be5fd6035d1446e099d05efb5a756a159d941372a911d325e033b2643fe78a0ab7da1d1b8b43b31b5d43cc303b32854191e5c369cf8277635
7
- data.tar.gz: 1a3073d0662f1f7c9734cc14a3aa110d26a9ca0dde6a75b84bc953ccaac57ba9773364bcd18e925797c9d6278578812390ecf378b67dd7936b9edcebd7cc7ba3
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.11)
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)
@@ -87,8 +87,8 @@ GEM
87
87
  awesome_nested_set (3.9.0)
88
88
  activerecord (>= 4.0.0, < 8.2)
89
89
  aws-eventstream (1.4.0)
90
- aws-partitions (1.1221.0)
91
- aws-sdk-core (3.242.0)
90
+ aws-partitions (1.1222.0)
91
+ aws-sdk-core (3.243.0)
92
92
  aws-eventstream (~> 1, >= 1.3.0)
93
93
  aws-partitions (~> 1, >= 1.992.0)
94
94
  aws-sigv4 (~> 1.9)
@@ -99,8 +99,8 @@ GEM
99
99
  aws-sdk-kms (1.122.0)
100
100
  aws-sdk-core (~> 3, >= 3.241.4)
101
101
  aws-sigv4 (~> 1.5)
102
- aws-sdk-s3 (1.214.0)
103
- aws-sdk-core (~> 3, >= 3.241.4)
102
+ aws-sdk-s3 (1.215.0)
103
+ aws-sdk-core (~> 3, >= 3.243.0)
104
104
  aws-sdk-kms (~> 1)
105
105
  aws-sigv4 (~> 1.5)
106
106
  aws-sdk-sqs (1.111.0)
@@ -118,7 +118,7 @@ GEM
118
118
  i18n
119
119
  bcrypt (3.1.21)
120
120
  benchmark (0.3.0)
121
- bigdecimal (3.3.1)
121
+ bigdecimal (4.0.1)
122
122
  bindex (0.8.1)
123
123
  bixby (5.0.2)
124
124
  rubocop (= 1.28.2)
@@ -492,9 +492,9 @@ GEM
492
492
  json-ld-preloaded (3.1.6)
493
493
  json-ld (~> 3.1)
494
494
  rdf (~> 3.1)
495
- json-schema (5.2.2)
495
+ json-schema (6.2.0)
496
496
  addressable (~> 2.8)
497
- bigdecimal (~> 3.1)
497
+ bigdecimal (>= 3.1, < 5)
498
498
  jwt (2.10.2)
499
499
  base64
500
500
  kaminari (1.2.2)
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
  ##
@@ -34,9 +34,14 @@ module IiifPrint
34
34
  # @param work_type [Class<ActiveFedora::Base>]
35
35
  # @return form for the given :work_type
36
36
  def self.decorate_form_with_adapter_logic(work_type:)
37
+ # In Hyrax flexible metadata mode, `Hyrax::FormFields(:child_works_from_pdf_splitting)`
38
+ # is a no-op but calling `"#{work_type}Form".constantize` unconditionally causes a
39
+ # circular autoload error when a model is loaded before its form.
40
+ return if Hyrax.config.try(:flexible?)
41
+
37
42
  form = "#{work_type}Form".constantize
38
43
  form.send(:include, Hyrax::FormFields(:child_works_from_pdf_splitting)) if
39
- Hyrax.config.try(:work_include_metadata?) && !Hyrax.config.try(:flexible?) && !form.included_modules.include?(Hyrax::FormFields(:child_works_from_pdf_splitting))
44
+ Hyrax.config.try(:work_include_metadata?) && !form.included_modules.include?(Hyrax::FormFields(:child_works_from_pdf_splitting))
40
45
  form
41
46
  end
42
47
 
@@ -1,3 +1,3 @@
1
1
  module IiifPrint
2
- VERSION = '3.0.11'.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.11
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-05 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