100 lines
2.9 KiB
TypeScript
100 lines
2.9 KiB
TypeScript
import type {
|
|
ToolboxAppManifest,
|
|
ToolboxCatalog,
|
|
} from '@add-ideas/toolbox-contract';
|
|
|
|
export const pdfManifest: ToolboxAppManifest = {
|
|
schemaVersion: 1,
|
|
id: 'de.add-ideas.pdf-tools',
|
|
name: 'PDF Workbench',
|
|
version: '0.4.3',
|
|
description: 'Page-level PDF operations performed locally in the browser.',
|
|
entry: './',
|
|
icon: './favicon.svg',
|
|
categories: ['documents', 'pdf'],
|
|
tags: ['merge', 'split'],
|
|
integration: {
|
|
contextVersion: 1,
|
|
launchModes: ['navigate', 'new-tab'],
|
|
embedding: 'unsupported',
|
|
},
|
|
requirements: {
|
|
secureContext: true,
|
|
workers: true,
|
|
indexedDb: true,
|
|
crossOriginIsolated: false,
|
|
},
|
|
privacy: {
|
|
processing: 'local',
|
|
fileUploads: false,
|
|
telemetry: false,
|
|
},
|
|
source: {
|
|
repository: 'https://git.add-ideas.de/zemion/pdf-tools',
|
|
license: 'AGPL-3.0-only',
|
|
},
|
|
};
|
|
|
|
export const xsltManifest: ToolboxAppManifest = {
|
|
...pdfManifest,
|
|
id: 'de.add-ideas.xslt-tools',
|
|
name: 'XSLT Workbench',
|
|
version: '0.4.2',
|
|
description: 'Transform XML locally with XSLT in the browser.',
|
|
icon: './xslt.svg',
|
|
categories: ['documents', 'developer'],
|
|
tags: ['transform', 'xml'],
|
|
source: {
|
|
repository: 'https://git.add-ideas.de/zemion/xslt-tools',
|
|
license: 'AGPL-3.0-only',
|
|
},
|
|
};
|
|
|
|
export const onenoteManifest: ToolboxAppManifest = {
|
|
...pdfManifest,
|
|
id: 'de.add-ideas.onenote-tools',
|
|
name: 'OneNote Reader',
|
|
version: '0.3.3',
|
|
description: 'Inspect OneNote packages locally in the browser.',
|
|
icon: './onenote.svg',
|
|
categories: ['documents', 'notes'],
|
|
tags: ['onepkg', 'import'],
|
|
source: {
|
|
repository: 'https://git.add-ideas.de/zemion/onenote-tools',
|
|
license: 'AGPL-3.0-only',
|
|
},
|
|
};
|
|
|
|
export const catalogue: ToolboxCatalog = {
|
|
schemaVersion: 1,
|
|
id: 'de.add-ideas.toolbox',
|
|
name: 'add·ideas Toolbox',
|
|
home: './',
|
|
theme: { mode: 'system', brand: 'add·ideas' },
|
|
apps: [
|
|
{ manifest: './apps/pdf/toolbox-app.json', enabled: true },
|
|
{ manifest: './apps/xslt/toolbox-app.json', enabled: true },
|
|
{ manifest: './apps/onenote/toolbox-app.json', enabled: true },
|
|
],
|
|
};
|
|
|
|
export function catalogueFetch(overrides: Record<string, Response> = {}) {
|
|
return async (input: string | URL | Request): Promise<Response> => {
|
|
const url = new URL(
|
|
input instanceof Request ? input.url : String(input),
|
|
document.baseURI
|
|
);
|
|
const custom = overrides[url.pathname];
|
|
if (custom) return custom.clone();
|
|
if (url.pathname.endsWith('/toolbox.catalog.json'))
|
|
return Response.json(catalogue);
|
|
if (url.pathname.endsWith('/apps/pdf/toolbox-app.json'))
|
|
return Response.json(pdfManifest);
|
|
if (url.pathname.endsWith('/apps/xslt/toolbox-app.json'))
|
|
return Response.json(xsltManifest);
|
|
if (url.pathname.endsWith('/apps/onenote/toolbox-app.json'))
|
|
return Response.json(onenoteManifest);
|
|
return new Response('Not found', { status: 404 });
|
|
};
|
|
}
|