Skip to content
Snippets Groups Projects
Commit d4504d25 authored by Anthony's avatar Anthony
Browse files

Remove old stuff

parent 68c7873d
Branches
No related tags found
No related merge requests found
[submodule "mirador-video-annotation"]
path = mirador-video-annotation
url = gitlab@gitlab.tetras-libre.fr:iiif/mirador-video-annotation.git
[submodule "annotations-plugin"]
path = annotations-plugin
url = gitlab@gitlab.tetras-libre.fr:iiif/mirador-annotations.git
:80 {
root * /srv
file_server browse
header Access-Control-Allow-Origin "{env.CORS_ALLOWED_HOSTS}"
}
FROM debian:stable-slim
RUN apt-get update && apt-get install -y git npm
RUN useradd --home-dir /opt node
RUN chown node:node /opt
EXPOSE 9000
WORKDIR /opt
USER node
CMD npm run serve
Subproject commit ed51af7660816416b9b5b2df73b2648fa0fbcb4f
#!/bin/bash
cd mirador-video-annotation
docker run --rm -v $PWD:/opt -it node:12 /bin/sh -c "cd /opt && npm install && npm run build:es"
cd ../annotations-plugin
docker run --rm -v $PWD:/opt -it node:12 /bin/sh -c "cd /opt && npm install && npm run build"
version: "3.3"
services:
devserver:
build:
context: .
dockerfile: Dockerfile.devserver
restart: $DEV_RESTART
ports:
- $DEV_PORT:9000
environment:
- CORS_ALLOWED_HOSTS
- WEBPACK_MODE=development
- HTTP_FOLDER
- DEV_PORT
volumes:
- ./:/opt
httpd:
ports:
- $PORT:80
annotot:
ports:
- ${ANNOTOT_PORT}:3000
Subproject commit 735afa7d4b0155be1d40e3c3707cd5e034777d24
This diff is collapsed.
{
"name": "mirador-integration",
"version": "0.0.0",
"description": "",
"private": true,
"scripts": {
"build": "webpack --config webpack.config.js",
"serve": "npm install && webpack serve --config webpack.config.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"css-loader": "^3.6.0",
"dotenv-webpack": "^8.0.1",
"mirador": "file:mirador-video-annotation",
"mirador-annotations": "file:annotations-plugin",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"style-loader": "^1.2.1"
},
"devDependencies": {
"webpack": "^4.43.0",
"webpack-cli": "^4.3.12",
"webpack-dev-server": "^4.11.1"
}
}
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Mirador Video Annotations</title>
</head>
<body>
<div id="demo"></div>
<script src="/dist/main.js"></script>
</body>
</html>
/*
* List .json files found in root or first subdirectory level and
* return them as a mirador catalog
* This code works for webpack dev server and caddy (as file server), and is not expected
* to function for other webservers
*/
export default {
// url: relative or absolute path
// depth: maximum depth for search of .json (use 0 to search only at root, 1 for first-level folders, etc)
// subfolder: only for internal usage
get_initial_catalog: function(url = '/data', depth=1, subfolder='') {
if (depth < 0) {
return;
}
const req_init = {headers: {'Accept': 'application/json'}};
return fetch(`${url}/${subfolder}`, req_init)
.then(response => {
if (!response.ok) {
throw new Error(`failed to list manifests from ${url}, http response code: ${reponse.status}`);
}
return response.json();
})
.then(async (response_json) => {
// handling caddy response, which is like
// [{name: "first.json", ...}, {name: "second.json", ...}, ...]
if (response_json.length >= 1 && response_json[0].hasOwnProperty('name')) {
response_json = response_json.map(e => e.name.replace(/\/$/, ''));
}
// assume all files which don't end in .json are folder
let subfolders_content = await Promise.allSettled(response_json
.filter(e => !e.endsWith('.json'))
.map(folder => this.get_initial_catalog(url, depth - 1, folder))
);
// filter files from current folder
// & append files from subfolders
let items = response_json
.filter(e => e.endsWith('.json'))
.concat(subfolders_content
// get only successfull queries & with a content
.filter(p => p.status === "fulfilled" && p.value != null)
.map(p => p.value)
).flat();
// prepend with original url only if we are at the root folder,
// else prepend only with current folder
return items
.map(e => subfolder == '' ? `${url}/${e}` : `${subfolder}/${e}`);
});
}
}
import Mirador from 'mirador/dist/es/src/index';
import LocalCatalog from './catalog.js';
import * as actions from 'mirador/dist/es/src/state/actions';
import annotationPlugins from 'mirador-annotations/es/index';
import LocalStorageAdapter from 'mirador-annotations/es/LocalStorageAdapter';
import AnnototAdapter from 'mirador-annotations/es/AnnototAdapter';
const endpointUrl = `${process.env.ANNOTOT_PROTO}://${process.env.ANNOTOT_HOST}:${process.env.ANNOTOT_PORT}/annotations`;
const config = {
annotation: {
adapter: (canvasId) => new AnnototAdapter(canvasId, endpointUrl),
exportLocalStorageAnnotations: false, // display annotation JSON export button
},
id: 'demo',
window: {
defaultSideBarPanel: 'annotations',
sideBarOpenByDefault: true,
},
windows: [{
loadedManifest: 'https://iiif.harvardartmuseums.org/manifests/object/299843',
}],
catalog: [
{ manifestId: 'https://dzkimgs.l.u-tokyo.ac.jp/videos/iiif_in_japan_2017/manifest.json' },
{ manifestId: 'https://iiif.bodleian.ox.ac.uk/iiif/manifest/e32a277e-91e2-4a6d-8ba6-cc4bad230410.json' },
{ manifestId: 'https://iiif.harvardartmuseums.org/manifests/object/299843' }
]
};
let viewer = Mirador.viewer(config, [...annotationPlugins]);
var store = viewer.store;
console.info('store: ', store);
LocalCatalog.get_initial_catalog()
.then(catalog => {
console.debug('loading local catalog: ', catalog);
catalog.forEach(manifest =>
// setTimeout avoid UI freeze
setTimeout(() => store.dispatch(actions.addResource(manifest)), 0)
);
})
const path = require('path');
const webpack = require('webpack');
const Dotenv = require('dotenv-webpack');
module.exports = {
mode: process.env.WEBPACK_MODE,
entry: './src/index.js',
output: {
filename: 'main.js',
path: path.resolve(__dirname, 'public/dist'),
publicPath: '/dist/',
},
devServer: {
hot: true,
watchFiles: ['src/**/*'],
client: {
logging: 'verbose',
overlay: true,
progress: true,
webSocketURL: 'ws://0.0.0.0:' + process.env.DEV_PORT + '/ws'
},
static: [
{
directory: path.join(__dirname, 'public'),
watch: true
},
{
directory: path.join(__dirname, process.env.HTTP_FOLDER ? process.env.HTTP_FOLDER : 'www'),
watch: false,
publicPath: '/data'
},
],
port: 9000
},
plugins: [
new webpack.IgnorePlugin({
/* cf https://gitlab.tetras-libre.fr/iiif/mirador-video-annotation/-/blob/annotation-on-video/webpack.config.js#L42 */
resourceRegExp: /@blueprintjs\/(core|icons)/, // ignore optional UI framework dependencies
}),
new Dotenv()
]
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment