From 53b668d2426f1354e4db109c9534b0cd3d2a354f Mon Sep 17 00:00:00 2001 From: Mike Bennett Date: Thu, 2 Nov 2023 19:11:45 +0000 Subject: [PATCH 1/4] Enable Flask-CORS by default and remove the CORS headers being manually set in `ldjsonify` to prevent double headers --- iiify/app.py | 2 +- iiify/configs/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/iiify/app.py b/iiify/app.py index d6ad424..8049f9e 100755 --- a/iiify/app.py +++ b/iiify/app.py @@ -232,7 +232,7 @@ def add_header(response): def ldjsonify(data): j = jsonify(data) - j.headers.set('Access-Control-Allow-Origin', '*') + # j.headers.set('Access-Control-Allow-Origin', '*') j.mimetype = "application/ld+json" return j diff --git a/iiify/configs/__init__.py b/iiify/configs/__init__.py index 07c5f6d..0e4e2e0 100644 --- a/iiify/configs/__init__.py +++ b/iiify/configs/__init__.py @@ -41,7 +41,7 @@ def getdef(self, section, option, default_value): # Enable CORS to allow cross-domain loading of tilesets from this server # Especially useful for SeaDragon viewers running locally -cors = bool(int(config.getdef('server', 'cors', 0))) +cors = bool(int(config.getdef('server', 'cors', 1))) iiif_domain = config.getdef('server', 'domain', 'https://iiif.archivelab.org') media_root = config.getdef('media', 'root', 'media') From a336cd3fff99dfb99ec8906ff3accbecbf637751 Mon Sep 17 00:00:00 2001 From: Mike Bennett Date: Thu, 2 Nov 2023 19:12:51 +0000 Subject: [PATCH 2/4] Update the default Cantaloupe address to be the correct production URL --- iiify/configs/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iiify/configs/__init__.py b/iiify/configs/__init__.py index 0e4e2e0..ef4bce7 100644 --- a/iiify/configs/__init__.py +++ b/iiify/configs/__init__.py @@ -66,7 +66,7 @@ def getdef(self, section, option, default_value): s3secret = config.getdef('url2iiif', 's3secret', '') # cantaloupe server -image_server = config.getdef('cantaloupe', 'url', 'https://iiif.prod.archive.org/image/iiif') +image_server = config.getdef('cantaloupe', 'url', 'https://iiif.archive.org/image/iiif') # caching cache_timeouts = { From e2e62ced75837161597fec0e36636798df338587 Mon Sep 17 00:00:00 2001 From: Mike Bennett Date: Thu, 2 Nov 2023 19:24:16 +0000 Subject: [PATCH 3/4] Update test to use the same text manifest for v2 as v3 --- tests/test_manifests_v2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_manifests_v2.py b/tests/test_manifests_v2.py index e445e58..2380259 100644 --- a/tests/test_manifests_v2.py +++ b/tests/test_manifests_v2.py @@ -19,6 +19,6 @@ def test_v2_image_manifest(self): def test_text_which_is_image(self): - resp = self.test_app.get("/iiif/2/z-2-2-18-14-9/manifest.json") + resp = self.test_app.get("/iiif/2/fbf_3chords_1_/manifest.json") self.assertEqual(resp.status_code, 200) \ No newline at end of file From b7115dafbe0aec2ccf3eb4ae065cd01d5d29ce88 Mon Sep 17 00:00:00 2001 From: Mike Bennett Date: Thu, 2 Nov 2023 19:32:35 +0000 Subject: [PATCH 4/4] Add code to log errors in v2 manifest generation --- iiify/app.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/iiify/app.py b/iiify/app.py index 8049f9e..8f8a041 100755 --- a/iiify/app.py +++ b/iiify/app.py @@ -206,7 +206,9 @@ def manifest2(identifier): page = int(page) try: return ldjsonify(create_manifest(identifier, domain=domain, page=page)) - except: + except Exception as excpt: + print("Exception occurred in manifest2:") + print(excpt) abort(404)