Skip to content

Commit

Permalink
Merge pull request #42 from internetarchive/enable_cors
Browse files Browse the repository at this point in the history
Enable Flask-CORS by default and update Cantaloupe default
  • Loading branch information
hadro authored Nov 2, 2023
2 parents f8a4734 + b7115da commit 6e04d44
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions iiify/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand All @@ -232,7 +234,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

Expand Down
4 changes: 2 additions & 2 deletions iiify/configs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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 = {
Expand Down
2 changes: 1 addition & 1 deletion tests/test_manifests_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 6e04d44

Please sign in to comment.