hyrax-iiif_av 0.1.0 → 0.3.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 +5 -5
- data/.circleci/config.yml +48 -0
- data/.github/workflows/release.yml +33 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +17 -1
- data/CONTRIBUTING.md +181 -0
- data/README.md +33 -36
- data/app/controllers/concerns/hyrax/iiif_av/auth_controller_behavior.rb +53 -0
- data/app/controllers/concerns/hyrax/iiif_av/controller_behavior.rb +23 -8
- data/app/controllers/hyrax/iiif_av/iiif_av_controller.rb +88 -0
- data/app/presenters/concerns/hyrax/iiif_av/displays_content.rb +90 -33
- data/app/presenters/concerns/hyrax/iiif_av/displays_iiif_av.rb +3 -6
- data/config/locales/en.yml +10 -0
- data/config/routes.rb +6 -0
- data/hyrax-iiif_av.gemspec +5 -4
- data/lib/generators/hyrax/iiif_av/install_generator.rb +32 -1
- data/lib/generators/hyrax/iiif_av/templates/_avalon.html.erb +1 -1
- data/lib/hyrax/iiif_av/configuration.rb +30 -0
- data/lib/hyrax/iiif_av/spec/shared_specs/controller_behavior.rb +1 -1
- data/lib/hyrax/iiif_av/spec/shared_specs/displays_content.rb +39 -11
- data/lib/hyrax/iiif_av/spec/shared_specs/displays_iiif_av.rb +1 -1
- data/lib/hyrax/iiif_av/version.rb +1 -1
- data/lib/hyrax/iiif_av.rb +20 -1
- metadata +45 -21
- data/app/helpers/hyrax/iiif_av/iiif_av_helper.rb +0 -40
- data/app/views/hyrax/base/_representative_media.html.erb +0 -27
- data/app/views/hyrax/base/iiif_viewers/_universal_viewer.html.erb +0 -4
- /data/{lib → app/models}/hyrax/iiif_av/manifest_range.rb +0 -0
@@ -47,11 +47,24 @@ module Hyrax
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def image_content
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
50
|
+
return nil unless latest_file_id
|
51
|
+
|
52
|
+
url_builder = Hyrax.config.iiif_image_url_builder
|
53
|
+
url = if url_builder.arity == 4
|
54
|
+
url_builder.call(
|
55
|
+
latest_file_id,
|
56
|
+
request.base_url,
|
57
|
+
Hyrax.config.iiif_image_size_default,
|
58
|
+
# In Hyrax 3, Hyrax.config.iiif_image_url_builder takes a format argument
|
59
|
+
image_format(alpha_channels)
|
60
|
+
)
|
61
|
+
else
|
62
|
+
url_builder.call(
|
63
|
+
latest_file_id,
|
64
|
+
request.base_url,
|
65
|
+
Hyrax.config.iiif_image_size_default
|
66
|
+
)
|
67
|
+
end
|
55
68
|
|
56
69
|
# Look at the request and target prezi 2 or 3 for images
|
57
70
|
parent.iiif_version == 3 ? image_content_v3(url) : image_content_v2(url)
|
@@ -60,64 +73,108 @@ module Hyrax
|
|
60
73
|
def image_content_v3(url)
|
61
74
|
# @see https://github.com/samvera-labs/iiif_manifest
|
62
75
|
IIIFManifest::V3::DisplayContent.new(url,
|
63
|
-
|
64
|
-
|
76
|
+
format: image_format(alpha_channels),
|
77
|
+
width: width,
|
78
|
+
height: height,
|
65
79
|
type: 'Image',
|
66
|
-
iiif_endpoint: iiif_endpoint(
|
80
|
+
iiif_endpoint: iiif_endpoint(latest_file_id))
|
67
81
|
end
|
68
82
|
|
69
83
|
def image_content_v2(url)
|
70
84
|
# @see https://github.com/samvera-labs/iiif_manifest
|
71
85
|
IIIFManifest::DisplayImage.new(url,
|
72
|
-
|
73
|
-
|
74
|
-
|
86
|
+
format: image_format(alpha_channels),
|
87
|
+
width: width,
|
88
|
+
height: height,
|
89
|
+
iiif_endpoint: iiif_endpoint(latest_file_id))
|
75
90
|
end
|
76
91
|
|
77
92
|
def video_content
|
78
93
|
# @see https://github.com/samvera-labs/iiif_manifest
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
uri = URI(f['external_file_uri'])
|
85
|
-
uri = URI.join(request.base_url, uri) if uri.relative?
|
86
|
-
video_display_content(uri, f['label'])
|
87
|
-
end
|
88
|
-
end
|
94
|
+
streams = stream_urls
|
95
|
+
if streams.present?
|
96
|
+
streams.collect { |label, url| video_display_content(url, label) }
|
97
|
+
else
|
98
|
+
[video_display_content(download_path('mp4'), 'mp4'), video_display_content(download_path('webm'), 'webm')]
|
89
99
|
end
|
90
|
-
[video_display_content(download_path('mp4'), 'mp4'), video_display_content(download_path('webm'), 'webm')]
|
91
100
|
end
|
92
101
|
|
93
|
-
def video_display_content(
|
94
|
-
IIIFManifest::V3::DisplayContent.new(
|
102
|
+
def video_display_content(_url, label = '')
|
103
|
+
IIIFManifest::V3::DisplayContent.new(Hyrax::IiifAv::Engine.routes.url_helpers.iiif_av_content_url(solr_document.id, label: label, host: request.base_url),
|
95
104
|
label: label,
|
96
105
|
width: Array(solr_document.width).first.try(:to_i),
|
97
106
|
height: Array(solr_document.height).first.try(:to_i),
|
98
107
|
duration: Array(solr_document.duration).first.try(:to_i) / 1000.0,
|
99
|
-
type: 'Video'
|
108
|
+
type: 'Video',
|
109
|
+
format: solr_document.mime_type,
|
110
|
+
auth_service: auth_service)
|
100
111
|
end
|
101
112
|
|
102
113
|
def audio_content
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
114
|
+
streams = stream_urls
|
115
|
+
if streams.present?
|
116
|
+
streams.collect { |label, url| audio_display_content(url, label) }
|
117
|
+
else
|
118
|
+
[audio_display_content(download_path('ogg'), 'ogg'), audio_display_content(download_path('mp3'), 'mp3')]
|
107
119
|
end
|
108
|
-
[audio_display_content(download_path('ogg'), 'ogg'), audio_display_content(download_path('mp3'), 'mp3')]
|
109
120
|
end
|
110
121
|
|
111
|
-
def audio_display_content(
|
112
|
-
IIIFManifest::V3::DisplayContent.new(
|
122
|
+
def audio_display_content(_url, label = '')
|
123
|
+
IIIFManifest::V3::DisplayContent.new(Hyrax::IiifAv::Engine.routes.url_helpers.iiif_av_content_url(solr_document.id, label: label, host: request.base_url),
|
113
124
|
label: label,
|
114
125
|
duration: Array(solr_document.duration).first.try(:to_i) / 1000.0,
|
115
|
-
type: 'Sound'
|
126
|
+
type: 'Sound',
|
127
|
+
format: solr_document.mime_type,
|
128
|
+
auth_service: auth_service)
|
116
129
|
end
|
117
130
|
|
118
131
|
def download_path(extension)
|
119
132
|
Hyrax::Engine.routes.url_helpers.download_url(solr_document, file: extension, host: request.base_url)
|
120
133
|
end
|
134
|
+
|
135
|
+
def stream_urls
|
136
|
+
return {} unless solr_document['derivatives_metadata_ssi'].present?
|
137
|
+
files_metadata = JSON.parse(solr_document['derivatives_metadata_ssi'])
|
138
|
+
file_locations = files_metadata.select { |f| f['file_location_uri'].present? }
|
139
|
+
streams = {}
|
140
|
+
if file_locations.present?
|
141
|
+
file_locations.each do |f|
|
142
|
+
streams[f['label']] = Hyrax::IiifAv.config.iiif_av_url_builder.call(
|
143
|
+
f['file_location_uri'],
|
144
|
+
request.base_url
|
145
|
+
)
|
146
|
+
end
|
147
|
+
end
|
148
|
+
streams
|
149
|
+
end
|
150
|
+
|
151
|
+
def auth_service
|
152
|
+
{
|
153
|
+
"context": "http://iiif.io/api/auth/1/context.json",
|
154
|
+
"@id": Rails.application.routes.url_helpers.new_user_session_url(host: request.base_url, iiif_auth_login: true),
|
155
|
+
"@type": "AuthCookieService1",
|
156
|
+
"confirmLabel": I18n.t('iiif_av.auth.confirmLabel'),
|
157
|
+
"description": I18n.t('iiif_av.auth.description'),
|
158
|
+
"failureDescription": I18n.t('iiif_av.auth.failureDescription'),
|
159
|
+
"failureHeader": I18n.t('iiif_av.auth.failureHeader'),
|
160
|
+
"header": I18n.t('iiif_av.auth.header'),
|
161
|
+
"label": I18n.t('iiif_av.auth.label'),
|
162
|
+
"profile": "http://iiif.io/api/auth/1/login",
|
163
|
+
"service": [
|
164
|
+
{
|
165
|
+
"@id": Hyrax::IiifAv::Engine.routes.url_helpers.iiif_av_auth_token_url(id: id, host: request.base_url),
|
166
|
+
"@type": "AuthTokenService1",
|
167
|
+
"profile": "http://iiif.io/api/auth/1/token"
|
168
|
+
},
|
169
|
+
{
|
170
|
+
"@id": Rails.application.routes.url_helpers.destroy_user_session_url(host: request.base_url),
|
171
|
+
"@type": "AuthLogoutService1",
|
172
|
+
"label": I18n.t('iiif_av.auth.logoutLabel'),
|
173
|
+
"profile": "http://iiif.io/api/auth/1/logout"
|
174
|
+
}
|
175
|
+
]
|
176
|
+
}
|
177
|
+
end
|
121
178
|
end
|
122
179
|
end
|
123
180
|
end
|
@@ -36,14 +36,11 @@ module Hyrax
|
|
36
36
|
(representative_presenter.image? && Hyrax.config.iiif_image_server?))
|
37
37
|
end
|
38
38
|
|
39
|
-
alias universal_viewer? iiif_viewer?
|
40
|
-
# deprecation_deprecate universal_viewer?: "use iiif_viewer? instead"
|
41
|
-
|
42
39
|
def iiif_viewer
|
43
40
|
if representative_presenter.video? || representative_presenter.audio?
|
44
|
-
|
45
|
-
|
46
|
-
|
41
|
+
Hyrax::IiifAv.config.iiif_av_viewer
|
42
|
+
else
|
43
|
+
super
|
47
44
|
end
|
48
45
|
end
|
49
46
|
|
@@ -0,0 +1,10 @@
|
|
1
|
+
en:
|
2
|
+
iiif_av:
|
3
|
+
auth:
|
4
|
+
confirmLabel: "Login"
|
5
|
+
description: "You must log in to view this content."
|
6
|
+
failureDescription: "<a href=\"http://example.org/policy\">Access Policy</a>"
|
7
|
+
failureHeader: "Authentication Failed"
|
8
|
+
header: "Please Log In"
|
9
|
+
label: "Login Required"
|
10
|
+
logoutLabel: "Log out"
|
data/config/routes.rb
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
Hyrax::IiifAv::Engine.routes.draw do
|
3
|
+
get '/iiif_av/content/:id/:label', to: 'iiif_av#content', as: :iiif_av_content
|
4
|
+
get '/iiif_av/auth_token/:id', to: 'iiif_av#auth_token', as: :iiif_av_auth_token
|
5
|
+
get '/iiif_av/sign_in', to: 'iiif_av#sign_in', as: :iiif_av_sign_in
|
6
|
+
end
|
data/hyrax-iiif_av.gemspec
CHANGED
@@ -21,13 +21,14 @@ Gem::Specification.new do |s|
|
|
21
21
|
|
22
22
|
s.add_dependency "rails", "~>5.1"
|
23
23
|
s.add_dependency "blacklight"
|
24
|
-
s.add_dependency "hyrax", "
|
25
|
-
s.add_dependency "iiif_manifest", "
|
24
|
+
s.add_dependency "hyrax", ">= 2.9", "< 4.0"
|
25
|
+
s.add_dependency "iiif_manifest", "> 0.5"
|
26
26
|
|
27
27
|
s.add_development_dependency 'bixby'
|
28
28
|
s.add_development_dependency 'coffee-rails'
|
29
|
-
s.add_development_dependency 'engine_cart', '~> 2.
|
30
|
-
s.add_development_dependency '
|
29
|
+
s.add_development_dependency 'engine_cart', '~> 2.2'
|
30
|
+
s.add_development_dependency 'factory_bot'
|
31
31
|
s.add_development_dependency 'rails-controller-testing'
|
32
32
|
s.add_development_dependency 'rspec-rails', '~> 3.8'
|
33
|
+
s.add_development_dependency 'rspec_junit_formatter'
|
33
34
|
end
|
@@ -6,7 +6,38 @@ module Hyrax
|
|
6
6
|
class InstallGenerator < Rails::Generators::Base
|
7
7
|
source_root File.expand_path('../templates', __FILE__)
|
8
8
|
|
9
|
-
|
9
|
+
def install_rack_cors
|
10
|
+
gem 'rack-cors'
|
11
|
+
Bundler.with_clean_env do
|
12
|
+
run "bundle install"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def enable_cors
|
17
|
+
insert_into_file 'config/application.rb', after: 'class Application < Rails::Application' do
|
18
|
+
"\n" \
|
19
|
+
" require 'rack/cors'\n" \
|
20
|
+
" config.middleware.insert_before 0, Rack::Cors do\n" \
|
21
|
+
" allow do\n" \
|
22
|
+
" origins '*'\n" \
|
23
|
+
" resource '/concern/*/*/manifest*', headers: :any, methods: [:head, :get]\n" \
|
24
|
+
" resource '/iiif_av/*', headers: :any, methods: [:head, :get], expose: ['Content-Security-Policy']\n" \
|
25
|
+
" resource '/downloads/*', headers: :any, methods: [:head, :get]\n" \
|
26
|
+
" end\n" \
|
27
|
+
" end\n" \
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def mount_routes
|
32
|
+
route "mount Hyrax::IiifAv::Engine, at: '/'"
|
33
|
+
end
|
34
|
+
|
35
|
+
def override_devise_redirect_path
|
36
|
+
insert_into_file 'app/controllers/application_controller.rb', after: 'include Hyrax::Controller' do
|
37
|
+
"\n" \
|
38
|
+
" include Hyrax::IiifAv::AuthControllerBehavior"
|
39
|
+
end
|
40
|
+
end
|
10
41
|
end
|
11
42
|
end
|
12
43
|
end
|
@@ -20,4 +20,4 @@ limitations under the License.
|
|
20
20
|
<%= javascript_pack_tag 'application' %>
|
21
21
|
<%= stylesheet_pack_tag 'application' %>
|
22
22
|
<% end %>
|
23
|
-
<%= react_component("AvalonIiifPlayer", { manifestUrl: main_app.
|
23
|
+
<%= react_component("AvalonIiifPlayer", { manifestUrl: main_app.polymorphic_url([main_app, :manifest, presenter], { locale: nil }) }) %>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Hyrax
|
3
|
+
module IiifAv
|
4
|
+
class Configuration
|
5
|
+
# URL that resolves to an AV stream provided to a IIIF presentation manifest
|
6
|
+
#
|
7
|
+
# @return [#call] lambda/proc that generates a URL to an AV stream
|
8
|
+
def iiif_av_url_builder
|
9
|
+
@iiif_av_url_builder ||= lambda do |file_location_uri, _base_url|
|
10
|
+
# Reverse engineering Hyrax::DerivativePath
|
11
|
+
path = file_location_uri.sub(/^#{Hyrax.config.derivatives_path}/, '')
|
12
|
+
id_path, file_path = path.split('-', 2)
|
13
|
+
file_set_id = id_path.delete('/')
|
14
|
+
filename = file_path[0, file_path.size / 2]
|
15
|
+
Hyrax::Engine.routes.url_helpers.download_path(file_set_id, file: filename)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
attr_writer :iiif_av_url_builder
|
19
|
+
|
20
|
+
# A symbol that represents the viewer to render for AV items.
|
21
|
+
# Defaults to :avalon. Known to work with :universal_viewer as well
|
22
|
+
|
23
|
+
# @return [:symbol] viewer partial name
|
24
|
+
def iiif_av_viewer
|
25
|
+
@iiif_av_viewer ||= :avalon
|
26
|
+
end
|
27
|
+
attr_writer :iiif_av_viewer
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -30,7 +30,7 @@ RSpec.shared_examples "IiifAv::ControllerBehavior" do
|
|
30
30
|
let(:manifest_factory3) { instance_double("IIIFManifest::V3::ManifestBuilder", to_h: { test: 'manifest3' }) }
|
31
31
|
|
32
32
|
before do
|
33
|
-
allow(controller).to receive(:
|
33
|
+
allow(controller).to receive(:iiif_manifest_presenter).and_return(presenter)
|
34
34
|
allow(IIIFManifest::ManifestFactory).to receive(:new).with(presenter).and_return(manifest_factory2)
|
35
35
|
allow(IIIFManifest::V3::ManifestFactory).to receive(:new).with(presenter).and_return(manifest_factory3)
|
36
36
|
request.headers['Accept'] = mime
|
@@ -15,6 +15,7 @@ RSpec.shared_examples "IiifAv::DisplaysContent" do
|
|
15
15
|
allow(ability).to receive(:can?).with(:read, solr_document.id).and_return(read_permission)
|
16
16
|
allow(presenter).to receive(:parent).and_return(parent_presenter)
|
17
17
|
allow(presenter).to receive(:title).and_return(title)
|
18
|
+
allow(presenter).to receive(:latest_file_id).and_return(id)
|
18
19
|
end
|
19
20
|
|
20
21
|
describe '#display_content' do
|
@@ -40,9 +41,9 @@ RSpec.shared_examples "IiifAv::DisplaysContent" do
|
|
40
41
|
end
|
41
42
|
|
42
43
|
context "when the file is a sound recording" do
|
43
|
-
let(:solr_document) { SolrDocument.new(id: '12345', duration_tesim: 1000) }
|
44
|
-
let(:mp3_url) { "http://test.host/
|
45
|
-
let(:ogg_url) { "http://test.host/
|
44
|
+
let(:solr_document) { SolrDocument.new(id: '12345', duration_tesim: 1000, mime_type_ssi: 'audio/mp3') }
|
45
|
+
let(:mp3_url) { "http://test.host/iiif_av/content/#{solr_document.id}/mp3" }
|
46
|
+
let(:ogg_url) { "http://test.host/iiif_av/content/#{solr_document.id}/ogg" }
|
46
47
|
|
47
48
|
before do
|
48
49
|
allow(solr_document).to receive(:audio?).and_return(true)
|
@@ -52,6 +53,7 @@ RSpec.shared_examples "IiifAv::DisplaysContent" do
|
|
52
53
|
expect(content).to all(be_instance_of IIIFManifest::V3::DisplayContent)
|
53
54
|
expect(content.length).to eq 2
|
54
55
|
expect(content.map(&:type)).to all(eq 'Sound')
|
56
|
+
expect(content.map(&:format)).to all(eq 'audio/mp3')
|
55
57
|
expect(content.map(&:duration)).to all(eq 1.000)
|
56
58
|
expect(content.map(&:label)).to match_array(['mp3', 'ogg'])
|
57
59
|
expect(content.map(&:url)).to match_array([mp3_url, ogg_url])
|
@@ -59,9 +61,9 @@ RSpec.shared_examples "IiifAv::DisplaysContent" do
|
|
59
61
|
end
|
60
62
|
|
61
63
|
context "when the file is a video" do
|
62
|
-
let(:solr_document) { SolrDocument.new(id: '12345', width_is: 640, height_is: 480, duration_tesim: 1000) }
|
63
|
-
let(:mp4_url) { "http://test.host/
|
64
|
-
let(:webm_url) { "http://test.host/
|
64
|
+
let(:solr_document) { SolrDocument.new(id: '12345', width_is: 640, height_is: 480, duration_tesim: 1000, mime_type_ssi: 'video/mp4') }
|
65
|
+
let(:mp4_url) { "http://test.host/iiif_av/content/#{id}/mp4" }
|
66
|
+
let(:webm_url) { "http://test.host/iiif_av/content/#{id}/webm" }
|
65
67
|
|
66
68
|
before do
|
67
69
|
allow(solr_document).to receive(:video?).and_return(true)
|
@@ -71,6 +73,7 @@ RSpec.shared_examples "IiifAv::DisplaysContent" do
|
|
71
73
|
expect(content).to all(be_instance_of IIIFManifest::V3::DisplayContent)
|
72
74
|
expect(content.length).to eq 2
|
73
75
|
expect(content.map(&:type)).to all(eq 'Video')
|
76
|
+
expect(content.map(&:format)).to all(eq 'video/mp4')
|
74
77
|
expect(content.map(&:width)).to all(eq 640)
|
75
78
|
expect(content.map(&:height)).to all(eq 480)
|
76
79
|
expect(content.map(&:duration)).to all(eq 1.000)
|
@@ -80,13 +83,14 @@ RSpec.shared_examples "IiifAv::DisplaysContent" do
|
|
80
83
|
end
|
81
84
|
|
82
85
|
context 'when the file is an audio derivative with metadata' do
|
86
|
+
let(:file_set_id) { 'abcdefg' }
|
83
87
|
let(:derivatives_metadata) do
|
84
88
|
[
|
85
|
-
{ id: '1', label: 'high',
|
86
|
-
{ id: '2', label: 'medium',
|
89
|
+
{ id: '1', label: 'high', file_location_uri: Hyrax::DerivativePath.derivative_path_for_reference(file_set_id, 'high.mp3') },
|
90
|
+
{ id: '2', label: 'medium', file_location_uri: Hyrax::DerivativePath.derivative_path_for_reference(file_set_id, 'medium.mp3') }
|
87
91
|
]
|
88
92
|
end
|
89
|
-
let(:solr_document) { SolrDocument.new(id:
|
93
|
+
let(:solr_document) { SolrDocument.new(id: file_set_id, duration_tesim: 1000, derivatives_metadata_ssi: derivatives_metadata.to_json) }
|
90
94
|
|
91
95
|
before do
|
92
96
|
allow(solr_document).to receive(:audio?).and_return(true)
|
@@ -96,7 +100,8 @@ RSpec.shared_examples "IiifAv::DisplaysContent" do
|
|
96
100
|
expect(content).to all(be_instance_of IIIFManifest::V3::DisplayContent)
|
97
101
|
expect(content.length).to eq 2
|
98
102
|
expect(content.map(&:label)).to match_array(['high', 'medium'])
|
99
|
-
expect(content.map(&:url)).to match_array([
|
103
|
+
expect(content.map(&:url)).to match_array([Hyrax::IiifAv::Engine.routes.url_helpers.iiif_av_content_url(file_set_id, label: 'high', host: request.base_url),
|
104
|
+
Hyrax::IiifAv::Engine.routes.url_helpers.iiif_av_content_url(file_set_id, label: 'medium', host: request.base_url)])
|
100
105
|
end
|
101
106
|
end
|
102
107
|
|
@@ -128,7 +133,7 @@ RSpec.shared_examples "IiifAv::DisplaysContent" do
|
|
128
133
|
|
129
134
|
context 'with custom image url builder' do
|
130
135
|
let(:custom_builder) do
|
131
|
-
->(file_id, base_url, _size) { "#{base_url}/downloads/#{file_id.split('/').first}" }
|
136
|
+
->(file_id, base_url, _size, _format) { "#{base_url}/downloads/#{file_id.split('/').first}" }
|
132
137
|
end
|
133
138
|
|
134
139
|
around do |example|
|
@@ -161,6 +166,29 @@ RSpec.shared_examples "IiifAv::DisplaysContent" do
|
|
161
166
|
end
|
162
167
|
end
|
163
168
|
end
|
169
|
+
|
170
|
+
context 'auth_service' do
|
171
|
+
let(:solr_document) { SolrDocument.new(id: '12345', duration_tesim: 1000) }
|
172
|
+
let(:auth_service) { content.first.auth_service }
|
173
|
+
|
174
|
+
before do
|
175
|
+
allow(solr_document).to receive(:audio?).and_return(true)
|
176
|
+
end
|
177
|
+
|
178
|
+
it 'provides a cookie auth service' do
|
179
|
+
expect(auth_service[:@id]).to eq Rails.application.routes.url_helpers.new_user_session_url(host: request.base_url, iiif_auth_login: true)
|
180
|
+
end
|
181
|
+
|
182
|
+
it 'provides a token service' do
|
183
|
+
token_service = auth_service[:service].find { |s| s[:@type] == "AuthTokenService1" }
|
184
|
+
expect(token_service[:@id]).to eq Hyrax::IiifAv::Engine.routes.url_helpers.iiif_av_auth_token_url(id: solr_document.id, host: request.base_url)
|
185
|
+
end
|
186
|
+
|
187
|
+
it 'provides a logout service' do
|
188
|
+
logout_service = auth_service[:service].find { |s| s[:@type] == "AuthLogoutService1" }
|
189
|
+
expect(logout_service[:@id]).to eq Rails.application.routes.url_helpers.destroy_user_session_url(host: request.base_url)
|
190
|
+
end
|
191
|
+
end
|
164
192
|
end
|
165
193
|
end
|
166
194
|
end
|
@@ -123,7 +123,7 @@ RSpec.shared_examples "IiifAv::DisplaysIiifAv" do
|
|
123
123
|
context 'with no representative_presenter' do
|
124
124
|
let(:representative_presenter) { instance_double('Hyrax::FileSetPresenter', present?: false) }
|
125
125
|
|
126
|
-
it { is_expected.to be
|
126
|
+
it { is_expected.to be :universal_viewer }
|
127
127
|
end
|
128
128
|
end
|
129
129
|
end
|
data/lib/hyrax/iiif_av.rb
CHANGED
@@ -3,6 +3,25 @@ require "hyrax/iiif_av/engine"
|
|
3
3
|
|
4
4
|
module Hyrax
|
5
5
|
module IiifAv
|
6
|
-
|
6
|
+
extend ActiveSupport::Autoload
|
7
|
+
|
8
|
+
eager_autoload do
|
9
|
+
autoload :Configuration
|
10
|
+
end
|
11
|
+
|
12
|
+
# @api public
|
13
|
+
#
|
14
|
+
# Exposes the Hyrax configuration
|
15
|
+
#
|
16
|
+
# @yield [Hyrax::IiifAv::Configuration] if a block is passed
|
17
|
+
# @return [Hyrax::IiifAv::Configuration]
|
18
|
+
# @see Hyrax::IiifAv::Configuration for configuration options
|
19
|
+
def self.config(&block)
|
20
|
+
@config ||= Hyrax::IiifAv::Configuration.new
|
21
|
+
|
22
|
+
yield @config if block
|
23
|
+
|
24
|
+
@config
|
25
|
+
end
|
7
26
|
end
|
8
27
|
end
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hyrax-iiif_av
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Colvard
|
8
8
|
- Brian Keese
|
9
9
|
- Ying Feng
|
10
10
|
- Phuong Dinh
|
11
|
-
autorequire:
|
11
|
+
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2025-10-07 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rails
|
@@ -45,28 +45,34 @@ dependencies:
|
|
45
45
|
name: hyrax
|
46
46
|
requirement: !ruby/object:Gem::Requirement
|
47
47
|
requirements:
|
48
|
-
- - "
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '2.9'
|
51
|
+
- - "<"
|
49
52
|
- !ruby/object:Gem::Version
|
50
|
-
version: '
|
53
|
+
version: '4.0'
|
51
54
|
type: :runtime
|
52
55
|
prerelease: false
|
53
56
|
version_requirements: !ruby/object:Gem::Requirement
|
54
57
|
requirements:
|
55
|
-
- - "
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '2.9'
|
61
|
+
- - "<"
|
56
62
|
- !ruby/object:Gem::Version
|
57
|
-
version: '
|
63
|
+
version: '4.0'
|
58
64
|
- !ruby/object:Gem::Dependency
|
59
65
|
name: iiif_manifest
|
60
66
|
requirement: !ruby/object:Gem::Requirement
|
61
67
|
requirements:
|
62
|
-
- - "
|
68
|
+
- - ">"
|
63
69
|
- !ruby/object:Gem::Version
|
64
70
|
version: '0.5'
|
65
71
|
type: :runtime
|
66
72
|
prerelease: false
|
67
73
|
version_requirements: !ruby/object:Gem::Requirement
|
68
74
|
requirements:
|
69
|
-
- - "
|
75
|
+
- - ">"
|
70
76
|
- !ruby/object:Gem::Version
|
71
77
|
version: '0.5'
|
72
78
|
- !ruby/object:Gem::Dependency
|
@@ -103,16 +109,16 @@ dependencies:
|
|
103
109
|
requirements:
|
104
110
|
- - "~>"
|
105
111
|
- !ruby/object:Gem::Version
|
106
|
-
version: '2.
|
112
|
+
version: '2.2'
|
107
113
|
type: :development
|
108
114
|
prerelease: false
|
109
115
|
version_requirements: !ruby/object:Gem::Requirement
|
110
116
|
requirements:
|
111
117
|
- - "~>"
|
112
118
|
- !ruby/object:Gem::Version
|
113
|
-
version: '2.
|
119
|
+
version: '2.2'
|
114
120
|
- !ruby/object:Gem::Dependency
|
115
|
-
name:
|
121
|
+
name: factory_bot
|
116
122
|
requirement: !ruby/object:Gem::Requirement
|
117
123
|
requirements:
|
118
124
|
- - ">="
|
@@ -153,6 +159,20 @@ dependencies:
|
|
153
159
|
- - "~>"
|
154
160
|
- !ruby/object:Gem::Version
|
155
161
|
version: '3.8'
|
162
|
+
- !ruby/object:Gem::Dependency
|
163
|
+
name: rspec_junit_formatter
|
164
|
+
requirement: !ruby/object:Gem::Requirement
|
165
|
+
requirements:
|
166
|
+
- - ">="
|
167
|
+
- !ruby/object:Gem::Version
|
168
|
+
version: '0'
|
169
|
+
type: :development
|
170
|
+
prerelease: false
|
171
|
+
version_requirements: !ruby/object:Gem::Requirement
|
172
|
+
requirements:
|
173
|
+
- - ">="
|
174
|
+
- !ruby/object:Gem::Version
|
175
|
+
version: '0'
|
156
176
|
description: Hyrax plugin for IIIF Presentation 3.0 audiovisual support
|
157
177
|
email:
|
158
178
|
- cjcolvar@indiana.edu
|
@@ -163,22 +183,27 @@ executables: []
|
|
163
183
|
extensions: []
|
164
184
|
extra_rdoc_files: []
|
165
185
|
files:
|
186
|
+
- ".circleci/config.yml"
|
187
|
+
- ".github/workflows/release.yml"
|
166
188
|
- ".gitignore"
|
167
189
|
- ".rspec"
|
168
190
|
- ".rubocop.yml"
|
169
191
|
- ".travis.yml"
|
192
|
+
- CONTRIBUTING.md
|
170
193
|
- Gemfile
|
171
194
|
- LICENSE
|
172
195
|
- README.md
|
173
196
|
- Rakefile
|
197
|
+
- app/controllers/concerns/hyrax/iiif_av/auth_controller_behavior.rb
|
174
198
|
- app/controllers/concerns/hyrax/iiif_av/controller_behavior.rb
|
175
|
-
- app/
|
199
|
+
- app/controllers/hyrax/iiif_av/iiif_av_controller.rb
|
200
|
+
- app/models/hyrax/iiif_av/manifest_range.rb
|
176
201
|
- app/presenters/concerns/hyrax/iiif_av/displays_content.rb
|
177
202
|
- app/presenters/concerns/hyrax/iiif_av/displays_iiif_av.rb
|
178
203
|
- app/presenters/hyrax/iiif_av/iiif_file_set_presenter.rb
|
179
|
-
- app/views/hyrax/base/_representative_media.html.erb
|
180
|
-
- app/views/hyrax/base/iiif_viewers/_universal_viewer.html.erb
|
181
204
|
- bin/rails
|
205
|
+
- config/locales/en.yml
|
206
|
+
- config/routes.rb
|
182
207
|
- hyrax-iiif_av.gemspec
|
183
208
|
- lib/generators/hyrax/iiif_av/add_to_work_type_generator.rb
|
184
209
|
- lib/generators/hyrax/iiif_av/install_avalon_player_generator.rb
|
@@ -186,19 +211,19 @@ files:
|
|
186
211
|
- lib/generators/hyrax/iiif_av/templates/AvalonIiifPlayer.js
|
187
212
|
- lib/generators/hyrax/iiif_av/templates/_avalon.html.erb
|
188
213
|
- lib/hyrax/iiif_av.rb
|
214
|
+
- lib/hyrax/iiif_av/configuration.rb
|
189
215
|
- lib/hyrax/iiif_av/engine.rb
|
190
|
-
- lib/hyrax/iiif_av/manifest_range.rb
|
191
216
|
- lib/hyrax/iiif_av/spec/shared_specs.rb
|
192
217
|
- lib/hyrax/iiif_av/spec/shared_specs/controller_behavior.rb
|
193
218
|
- lib/hyrax/iiif_av/spec/shared_specs/displays_content.rb
|
194
219
|
- lib/hyrax/iiif_av/spec/shared_specs/displays_iiif_av.rb
|
195
220
|
- lib/hyrax/iiif_av/version.rb
|
196
221
|
- lib/tasks/hyrax/iiif_av_tasks.rake
|
197
|
-
homepage:
|
222
|
+
homepage:
|
198
223
|
licenses:
|
199
224
|
- Apache-2.0
|
200
225
|
metadata: {}
|
201
|
-
post_install_message:
|
226
|
+
post_install_message:
|
202
227
|
rdoc_options: []
|
203
228
|
require_paths:
|
204
229
|
- lib
|
@@ -213,9 +238,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
213
238
|
- !ruby/object:Gem::Version
|
214
239
|
version: '0'
|
215
240
|
requirements: []
|
216
|
-
|
217
|
-
|
218
|
-
signing_key:
|
241
|
+
rubygems_version: 3.3.27
|
242
|
+
signing_key:
|
219
243
|
specification_version: 4
|
220
244
|
summary: Hyrax plugin for IIIF Presentation 3.0 audiovisual support
|
221
245
|
test_files: []
|