Skip to content
Snippets Groups Projects
Verified Commit 60642753 authored by Pascal Ernster's avatar Pascal Ernster :mask:
Browse files

Do not merge this commit! This is just a quick and dirty summary of our changes for Anusha.

parent 99964984
No related tags found
No related merge requests found
Pipeline #7782 failed
......@@ -65,6 +65,7 @@ HYRAX_ANALYTICS_PROVIDER=matomo
ANALYTICS_START_DATE=2022-02-18
MATOMO_SITE_ID=
MATOMO_BASE_URL=
MATOMO_BASE_URL_SUFFIX="index.php"
MATOMO_AUTH_TOKEN=
# Hyrax application setting
......
......@@ -68,6 +68,7 @@ HYRAX_ANALYTICS_PROVIDER=
ANALYTICS_START_DATE=
MATOMO_SITE_ID=
MATOMO_BASE_URL=
MATOMO_BASE_URL_SUFFIX="index.php"
MATOMO_AUTH_TOKEN=
# Hyrax application setting
......
......@@ -131,21 +131,10 @@ Hyrax.config do |config|
#
# Default is false
config.iiif_image_server = true
if ENV.fetch('IIIF_TO_SERVE_SSL_URLS', 'false') == 'true'
protocol = 'https'
else
protocol = 'http'
end
if Rails.env.development?
port = ENV.fetch('PORT', 3000)
else
port = nil
end
# Returns a URL that resolves to an image provided by a IIIF image server
config.iiif_image_url_builder = lambda do |file_id, base_url, size, format|
Riiif::Engine.routes.url_helpers.image_url(file_id, host: base_url, size: size, protocol: protocol, port: port)
Riiif::Engine.routes.url_helpers.image_url(file_id, size: size, only_path: true)
end
# config.iiif_image_url_builder = lambda do |file_id, base_url, size, format|
# "#{base_url}/downloads/#{file_id.split('/').first}"
......@@ -153,7 +142,8 @@ Hyrax.config do |config|
# Returns a URL that resolves to an info.json file provided by a IIIF image server
config.iiif_info_url_builder = lambda do |file_id, base_url|
uri = Riiif::Engine.routes.url_helpers.info_url(file_id, host: base_url, protocol: protocol, port: port)
uri = Riiif::Engine.routes.url_helpers.info_url(file_id, only_path: true)
uri.sub(/\Ahttp:/, 'https:')
uri.sub(%r{/info\.json\Z}, '')
end
......
# Make the base URL suffix of the external matomo instance configurable.
# This is required because
# a) by default, Faraday does not follow HTTP redirects, and
# b) the code in the Hyrax 3.5.0 code doesn't work if the Matomo instance's webserver redirects / to /index.php
# See also https://github.com/samvera/hyrax/issues/5593 and https://github.com/samvera/hyrax/issues/5846
Rails.configuration.to_prepare do
Hyrax::Analytics::Matomo::Config.class_eval do
def get(params)
response = Faraday.get(config.base_url+ENV.fetch("MATOMO_BASE_URL_SUFFIX","index.php"), params)
return [] if response.status != 200
JSON.parse(response.body)
end
end
end
......@@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<link rel="icon" href="favicon.ico">
<link rel="stylesheet" type="text/css" href="uv.css">
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
<script src="lib/hls.min.js"></script>
<script type="text/javascript" src="lib/offline.js"></script>
<script type="text/javascript" src="helpers.js"></script>
<style>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment