Skip to content

Commit

Permalink
Merge pull request #525 from uib-ub:fix-#api-make-manifest-valid
Browse files Browse the repository at this point in the history
fix(iiif): update manifest ID format and improve label handling; change URLs to use http for cc licenses
  • Loading branch information
tarjelavik authored Oct 9, 2024
2 parents 4c33900 + 17d65c4 commit 96d728c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions apps/api/src/helpers/mappers/iiif/constructIIIFStructure.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { env } from '@config/env';
import { IIIFBuilder } from '@iiif/builder';
import { getPrimaryName, getRightsStatements } from '@thegetty/linkedart.js';
import { getRightsStatements } from '@thegetty/linkedart.js';
import { getCopyright } from './getCopyright';
import { getThumbnailVisualItem } from './getThumbnailVisualItem';

Expand All @@ -21,7 +21,7 @@ export function constructIIIFStructure(data: any) {
const filesetID = fileset?._source.id

const thumbnail = getThumbnailVisualItem(item._source)
const manifestID = `${env.API_URL}/items/${filesetID}`
const manifestID = `${env.API_URL}/items/${filesetID}?as=iiif`
const homepage = `https://marcus.uib.no/items/${filesetID}`
const rightsStatement = getRightsStatements(item._source)
console.log("🚀 ~ constructIIIFStructure ~ rightsStatement:", rightsStatement)
Expand All @@ -30,7 +30,7 @@ export function constructIIIFStructure(data: any) {
const manifest = builder.createManifest(
manifestID,
(manifest: any) => {
manifest.setLabel(getPrimaryName(item._source) ?? "Mangler tittel");
manifest.setLabel(item._source._label ?? { "no": ["Mangler tittel"], "en": ["Missing title"] });
if (thumbnail) {
manifest.addThumbnail({
id: thumbnail,
Expand Down Expand Up @@ -88,7 +88,7 @@ export function constructIIIFStructure(data: any) {
const annotationPageID = `${root}/canvas/${item.sequenceNr}/annotation-page/1`;
const annotationID = `${root}/canvas/${item.sequenceNr}/annotation/1`;
manifest.createCanvas(canvasID, (canvas: any) => {
canvas.setLabel(item._label.none[0] ?? "Mangler tittel");
canvas.setLabel({ no: [item._label.none[0] ?? "Mangler tittel"] });
canvas.setWidth(1024);
canvas.setHeight(1024);
canvas.addThumbnail({
Expand Down
14 changes: 7 additions & 7 deletions apps/api/src/helpers/mappers/staticMapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ export const aatSiblingsType = {
* Rights and Licenses
*/
export const ccPublicDomainMarkType = {
id: "https://creativecommons.org/publicdomain/zero/1.0/",
id: "http://creativecommons.org/publicdomain/zero/1.0/",
type: "Type",
_label: "CC0 1.0 Universal (CC0 1.0) Public Domain Dedication",
identified_by: [
Expand Down Expand Up @@ -424,7 +424,7 @@ export const rsInCopyrighttype = {
}

export const attributionNonCommercialNoDerivsType = {
id: 'https://creativecommons.org/licenses/by-nc-nd/4.0/',
id: 'http://creativecommons.org/licenses/by-nc-nd/4.0/',
type: 'Type',
_label: 'CC BY-NC-ND 4.0',
identified_by: [
Expand All @@ -450,7 +450,7 @@ export const attributionNonCommercialNoDerivsType = {
]
};
export const attributionType = {
id: 'https://creativecommons.org/licenses/by/4.0/',
id: 'http://creativecommons.org/licenses/by/4.0/',
type: 'Type',
_label: 'CC BY 4.0',
identified_by: [
Expand All @@ -476,7 +476,7 @@ export const attributionType = {
]
};
export const attributionShareAlikeType = {
id: 'https://creativecommons.org/licenses/by-sa/4.0/',
id: 'http://creativecommons.org/licenses/by-sa/4.0/',
type: 'Type',
_label: 'CC BY-SA 4.0',
identified_by: [
Expand All @@ -503,7 +503,7 @@ export const attributionShareAlikeType = {
};

export const attributionNonCommercialType = {
id: 'https://creativecommons.org/licenses/by-nc/4.0/',
id: 'http://creativecommons.org/licenses/by-nc/4.0/',
type: 'Type',
_label: 'CC NC 4.0',
identified_by: [
Expand All @@ -530,7 +530,7 @@ export const attributionNonCommercialType = {
};

export const attributionNoDerivsType = {
id: 'https://creativecommons.org/licenses/by-nd/4.0/',
id: 'http://creativecommons.org/licenses/by-nd/4.0/',
type: 'Type',
_label: 'CC ND 4.0',
identified_by: [
Expand All @@ -557,7 +557,7 @@ export const attributionNoDerivsType = {
};

export const publicDomainType = {
id: 'https://creativecommons.org/publicdomain/mark/1.0',
id: 'http://creativecommons.org/publicdomain/mark/1.0',
type: 'Type',
_label: 'Public Domain Mark',
identified_by: [
Expand Down

0 comments on commit 96d728c

Please sign in to comment.