Don't hard-code IIIF version; prepare for v. 3

This commit is contained in:
Nicolò P 2024-04-18 12:42:42 +02:00
parent 1e6e8989e1
commit 1aed11cf2e

View File

@ -42,8 +42,9 @@ function splitDNO(filename) {
* @implements IIIFResource
*/
class Image {
#IIIF_API_VERSION = process.env.IIIF_API_VERSION;
id = '';
#context = `https://iiif.io/api/presentation/${process.env.IIIF_API_VERSION}/context.json`;
#context = `https://iiif.io/api/presentation/${this.#IIIF_API_VERSION}/context.json`;
#type = 'oa:Annotation';
#motivation = 'sc:painting';
#resType = 'dctypes:Image';
@ -53,7 +54,7 @@ class Image {
service = {
"@context" : this.#context,
"@id" : '',
profile : 'https://iiif.io/api/image/2/level2.json',
profile : `https://iiif.io/api/image/${this.#IIIF_API_VERSION}/level2.json`,
};
canvasId = '';
/**
@ -82,7 +83,7 @@ class Image {
const {baseFolder, subfolder} = splitFn(filename);
this.id = `${serviceURL}/2/${baseFolder}%2F${subfolder}%2F${filename}/full/full/0/default.jpg`;
this.id = `${serviceURL}/${this.#IIIF_API_VERSION}/${baseFolder}%2F${subfolder}%2F${filename}/full/max/0/default.jpg`;
this.service['@id'] = this.id.replace(/\/full.*$/,'');
}
/**