Skip to content

Commit

Permalink
Merge pull request #4127 from nulib/5044-iiif-3
Browse files Browse the repository at this point in the history
Change IIIF image requests to v3
  • Loading branch information
kdid authored Aug 28, 2024
2 parents 991deaf + 974b71d commit 913ff36
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion app/config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ config :meadow,
iiif_server_url:
aws_secret("meadow",
dig: ["iiif", "base_url"],
default: "https://iiif.dev.rdc.library.northwestern.edu/iiif/2/#{prefix()}"
default: "https://iiif.dev.rdc.library.northwestern.edu/iiif/3/#{prefix()}"
),
iiif_manifest_url_deprecated:
aws_secret("meadow",
Expand Down
2 changes: 1 addition & 1 deletion app/config/test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ config :meadow,
index_interval: 1234,
mediaconvert_client: MediaConvert.Mock,
streaming_url: "https://test-streaming-url/",
iiif_server_url: "http://localhost:8184/iiif/2/",
iiif_server_url: "http://localhost:8184/iiif/3/",
iiif_manifest_url_deprecated: "http://test-pyramids.s3.localhost.localstack.cloud:4566/public/",
digital_collections_url: "https://fen.rdc-staging.library.northwestern.edu/"

Expand Down
12 changes: 6 additions & 6 deletions app/lib/meadow/utils/aws.ex
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ defmodule Meadow.Utils.AWS do
do: MultipartCopy.copy_object(dest_bucket, dest_object, src_bucket, src_object, opts)

def invalidate_cache(file_set, invalidation_type), do: invalidate_cache(file_set, invalidation_type, Config.environment())
def invalidate_cache(file_set, :pyramid, :dev), do: perform_iiif_invalidation("/iiif/2/#{prefix()}/#{file_set.id}/*")
def invalidate_cache(file_set, :pyramid, :test), do: perform_iiif_invalidation("/iiif/2/#{prefix()}/#{file_set.id}/*")
def invalidate_cache(file_set, :pyramid, _), do: perform_iiif_invalidation("/iiif/2/#{file_set.id}/*")
def invalidate_cache(file_set, :poster, :dev), do: perform_iiif_invalidation("/iiif/2/#{prefix()}/posters/#{file_set.id}/*")
def invalidate_cache(file_set, :poster, :test), do: perform_iiif_invalidation("/iiif/2/#{prefix()}/posters/#{file_set.id}/*")
def invalidate_cache(file_set, :poster, _), do: perform_iiif_invalidation("/iiif/2/posters/#{file_set.id}/*")
def invalidate_cache(file_set, :pyramid, :dev), do: perform_iiif_invalidation("/iiif/3/#{prefix()}/#{file_set.id}/*")
def invalidate_cache(file_set, :pyramid, :test), do: perform_iiif_invalidation("/iiif/3/#{prefix()}/#{file_set.id}/*")
def invalidate_cache(file_set, :pyramid, _), do: perform_iiif_invalidation("/iiif/3/#{file_set.id}/*")
def invalidate_cache(file_set, :poster, :dev), do: perform_iiif_invalidation("/iiif/3/#{prefix()}/posters/#{file_set.id}/*")
def invalidate_cache(file_set, :poster, :test), do: perform_iiif_invalidation("/iiif/3/#{prefix()}/posters/#{file_set.id}/*")
def invalidate_cache(file_set, :poster, _), do: perform_iiif_invalidation("/iiif/3/posters/#{file_set.id}/*")
def invalidate_cache(_file_set, :streaming, :dev), do: :ok
def invalidate_cache(_file_set, :streaming, :test), do: :ok
def invalidate_cache(file_set, :streaming, _), do: perform_streaming_invalidation("/#{Pairtree.generate!(file_set.id)}/*")
Expand Down
4 changes: 2 additions & 2 deletions app/test/meadow/config_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,15 @@ defmodule Meadow.ConfigTest do
end

test "trailing slashes/0" do
Application.put_env(:meadow, :iiif_server_url, "http://no-slash-test/iiif/2")
Application.put_env(:meadow, :iiif_server_url, "http://no-slash-test/iiif/3")

Application.put_env(
:meadow,
:iiif_manifest_url_deprecated,
"http://no-slash-test/minio/test-pyramids/public"
)

assert Config.iiif_server_url() == "http://no-slash-test/iiif/2/"
assert Config.iiif_server_url() == "http://no-slash-test/iiif/3/"

assert Config.iiif_manifest_url_deprecated() ==
"http://no-slash-test/minio/test-pyramids/public/"
Expand Down
4 changes: 2 additions & 2 deletions app/test/meadow/data/file_sets_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ defmodule Meadow.Data.FileSetsTest do

with uri <- file_set |> FileSets.representative_image_url_for() |> URI.parse() do
assert uri.host == "localhost"
assert uri.path == "/iiif/2/posters/#{file_set.id}"
assert uri.path == "/iiif/3/posters/#{file_set.id}"
end
end

Expand All @@ -230,7 +230,7 @@ defmodule Meadow.Data.FileSetsTest do

with uri <- file_set |> FileSets.representative_image_url_for() |> URI.parse() do
assert uri.host == "localhost"
assert uri.path == "/iiif/2/#{file_set.id}"
assert uri.path == "/iiif/3/#{file_set.id}"
end
end

Expand Down
2 changes: 1 addition & 1 deletion app/test/pipeline/actions/generate_poster_image_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ defmodule Meadow.Pipeline.Actions.GeneratePosterImageTest do

assert log
|> String.contains?(
"Skipping cache invalidation for: /iiif/2/#{prefix()}/posters/#{file_set_id}/*. No distribution id found."
"Skipping cache invalidation for: /iiif/3/#{prefix()}/posters/#{file_set_id}/*. No distribution id found."
)
end
end
Expand Down

0 comments on commit 913ff36

Please sign in to comment.