From c794dec34f7393dea23c14b2187f007989a23e8b Mon Sep 17 00:00:00 2001 From: Beatrycze Volk Date: Mon, 6 Feb 2023 19:11:32 +0100 Subject: [PATCH] Move nonProxyMimeTypes to config --- Classes/Common/Doc.php | 19 ++++--------------- Resources/Private/Language/Labels.xml | 2 ++ ext_conf_template.txt | 2 ++ 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/Classes/Common/Doc.php b/Classes/Common/Doc.php index a9a7a0ebb0..edb42aa73d 100644 --- a/Classes/Common/Doc.php +++ b/Classes/Common/Doc.php @@ -75,20 +75,6 @@ abstract class Doc */ public static $extKey = 'dlf'; - /** - * MIME types that are excluded from PageViewProxy. - * - * TODO: Consider moving this to extension configuration - * - * @var string[] - * @access public - */ - public static $nonProxyMimeTypes = [ - 'application/vnd.kitodo.iiif', - 'application/vnd.netfpx', - 'application/vnd.kitodo.zoomify', - ]; - /** * This holds the configuration for all supported metadata encodings * @see loadFormats() @@ -1388,9 +1374,12 @@ public function toArray($uriBuilder, array $config = []) } } + $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); + $nonProxyMimeTypes = GeneralUtility::trimExplode(',', $extConf['nonProxyMimeTypes']); + // Only deliver static images via the internal PageViewProxy. // (For IIP and IIIF, the viewer needs to build and access a separate metadata URL, see `getMetadataURL`.) - if (in_array($fileGrp, $proxyFileGroups) && !in_array($file['mimetype'], self::$nonProxyMimeTypes)) { + if (in_array($fileGrp, $proxyFileGroups) && !in_array($file['mimetype'], $nonProxyMimeTypes)) { // Configure @action URL for form. $file['url'] = $uriBuilder ->reset() diff --git a/Resources/Private/Language/Labels.xml b/Resources/Private/Language/Labels.xml index 66ba9bfe0f..6656b26941 100644 --- a/Resources/Private/Language/Labels.xml +++ b/Resources/Private/Language/Labels.xml @@ -180,6 +180,7 @@ + @@ -391,6 +392,7 @@ + diff --git a/ext_conf_template.txt b/ext_conf_template.txt index e73111d28b..0f656dc461 100644 --- a/ext_conf_template.txt +++ b/ext_conf_template.txt @@ -12,6 +12,8 @@ caching = 0 publishNewCollections = 1 # cat=Basic; type=boolean; label=LLL:EXT:dlf/Resources/Private/Language/Labels.xml:config.unhideOnIndex unhideOnIndex = 0 +# cat=Basic; type=string; label=LLL:EXT:dlf/Resources/Private/Language/Labels.xml:config.nonProxyMimeType +nonProxyMimeType = application/vnd.kitodo.iiif,application/vnd.netfpx,application/vnd.kitodo.zoomify # cat=Basic; type=boolean; label=LLL:EXT:dlf/Resources/Private/Language/Labels.xml:config.useExternalApisForMetadata useExternalApisForMetadata = 0 # cat=Files; type=string; label=LLL:EXT:dlf/Resources/Private/Language/Labels.xml:config.fileGrpImages