Commit a3f07aea authored by A. Koch's avatar A. Koch

fix timeline export

parent 5e4cc171
......@@ -9,6 +9,17 @@
"host": "HOST",
"port": "PORT"
},
"assets": {
"host": "ASSETS_HOST",
"client": {
"endPoint": "ASSETS_ENDPOINT",
"port": "ASSETS_PORT",
"useSSL": "ASSETS_SECURE",
"accessKey": "ASSETS_ACCESS_KEY",
"secretKey": "ASSETS_SECRET_KEY"
},
"archivesBucket": "ASSETS_ARCHIVES_BUCKET"
},
"resources": {
"mongodb": {
"url": "MONGODB_RESOURCES_URL",
......
......@@ -9,6 +9,17 @@
"host": "0.0.0.0",
"port": 3030
},
"assets": {
"host": null,
"client": {
"endPoint": "assets.motionbank.org",
"port": 443,
"useSSL": true,
"accessKey": null,
"secretKey": null
},
"archivesBucket": "piecemaker-archives"
},
"resources": {
"mongodb": {
"prefix": "res_",
......
......@@ -9,6 +9,17 @@
"host": "localhost",
"port": 3030
},
"assets": {
"host": null,
"client": {
"endPoint": "assets.motionbank.org",
"port": 443,
"useSSL": true,
"accessKey": null,
"secretKey": null
},
"archivesBucket": "piecemaker-archives-dev"
},
"resources": {
"mongodb": {
"url": "mongodb://localhost:27017/motionbank-api-dev",
......
......@@ -553,6 +553,16 @@
"resolved": "https://registry.npmjs.org/bintrees/-/bintrees-1.0.1.tgz",
"integrity": "sha1-DmVcm5wkNeqraL9AJyJtK1WjRSQ="
},
"block-stream2": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/block-stream2/-/block-stream2-1.1.0.tgz",
"integrity": "sha1-xzjjqRupd+u14f70MeE8oR2GOeI=",
"requires": {
"defined": "^1.0.0",
"inherits": "^2.0.1",
"readable-stream": "^2.0.4"
}
},
"bluebird": {
"version": "3.5.1",
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.1.tgz",
......@@ -933,6 +943,11 @@
"integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=",
"dev": true
},
"defined": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/defined/-/defined-1.0.0.tgz",
"integrity": "sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM="
},
"del": {
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/del/-/del-2.2.2.tgz",
......@@ -1063,9 +1078,14 @@
"is-arrayish": "^0.2.1"
}
},
"es6-error": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/es6-error/-/es6-error-2.1.1.tgz",
"integrity": "sha1-kThDAexe0cmnJH0RKCRyFvA1R80="
},
"es6-promise": {
"version": "3.2.1",
"resolved": "http://registry.npmjs.org/es6-promise/-/es6-promise-3.2.1.tgz",
"resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.2.1.tgz",
"integrity": "sha1-7FYjOGgDKQkgcXDDlEjiREndH8Q="
},
"escape-string-regexp": {
......@@ -1324,7 +1344,7 @@
"dependencies": {
"async": {
"version": "1.5.2",
"resolved": "http://registry.npmjs.org/async/-/async-1.5.2.tgz",
"resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz",
"integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo="
}
}
......@@ -1616,7 +1636,7 @@
},
"http-errors": {
"version": "1.6.3",
"resolved": "http://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz",
"integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=",
"requires": {
"depd": "~1.1.2",
......@@ -1871,6 +1891,11 @@
"integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=",
"dev": true
},
"json-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/json-stream/-/json-stream-1.0.0.tgz",
"integrity": "sha1-GjhU4o0rvuqzHMfd9oPS3cVlJwg="
},
"json-stringify-safe": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
......@@ -2372,6 +2397,33 @@
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0="
},
"minio": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/minio/-/minio-7.0.1.tgz",
"integrity": "sha512-oUpw0wX2sIbfATBeYVglApOokPcjePlBNoRQBKMOmCPA0SXq+sXbuGOHaQJHbdMuhokwVrITwqSEApMtTDGNjA==",
"requires": {
"async": "^1.5.2",
"block-stream2": "^1.0.0",
"concat-stream": "^1.4.8",
"es6-error": "^2.0.2",
"json-stream": "^1.0.0",
"lodash": "^4.14.2",
"mime-types": "^2.1.14",
"mkdirp": "^0.5.1",
"querystring": "0.2.0",
"through2": "^0.6.5",
"uuid": "^3.1.0",
"xml": "^1.0.0",
"xml2js": "^0.4.15"
},
"dependencies": {
"async": {
"version": "1.5.2",
"resolved": "http://registry.npmjs.org/async/-/async-1.5.2.tgz",
"integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo="
}
}
},
"mkdirp": {
"version": "0.5.1",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
......@@ -2797,6 +2849,11 @@
"resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz",
"integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA=="
},
"querystring": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz",
"integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA="
},
"raven": {
"version": "2.6.4",
"resolved": "https://registry.npmjs.org/raven/-/raven-2.6.4.tgz",
......@@ -3046,6 +3103,11 @@
"integrity": "sha512-ntN6SbE3hRqd45PKKadRPgA+xHPWg5lPSj2JWJdJvjTwXDDfkPVtXWvP8jJojvnm+rAsZ2b299C5NwZqq818EA==",
"optional": true
},
"sax": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
"integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw=="
},
"schema-object": {
"version": "4.0.11",
"resolved": "https://registry.npmjs.org/schema-object/-/schema-object-4.0.11.tgz",
......@@ -3381,6 +3443,38 @@
"integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=",
"dev": true
},
"through2": {
"version": "0.6.5",
"resolved": "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz",
"integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=",
"requires": {
"readable-stream": ">=1.0.33-1 <1.1.0-0",
"xtend": ">=4.0.0 <4.1.0-0"
},
"dependencies": {
"isarray": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
"integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8="
},
"readable-stream": {
"version": "1.0.34",
"resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz",
"integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=",
"requires": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.1",
"isarray": "0.0.1",
"string_decoder": "~0.10.x"
}
},
"string_decoder": {
"version": "0.10.31",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
"integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ="
}
}
},
"timed-out": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz",
......@@ -3630,6 +3724,25 @@
"mkdirp": "^0.5.1"
}
},
"xml": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/xml/-/xml-1.0.1.tgz",
"integrity": "sha1-eLpyAgApxbyHuKgaPPzXS0ovweU="
},
"xml2js": {
"version": "0.4.19",
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz",
"integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==",
"requires": {
"sax": ">=0.6.0",
"xmlbuilder": "~9.0.1"
}
},
"xmlbuilder": {
"version": "9.0.7",
"resolved": "http://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz",
"integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0="
},
"xmldom": {
"version": "0.1.19",
"resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.1.19.tgz",
......
......@@ -7,6 +7,8 @@ const
os = require('os'),
multer = require('multer'),
send = require('@polka/send-type'),
config = require('config'),
Minio = require('minio'),
{ Assert, ObjectUtil } = require('mbjs-utils')
module.exports.setupArchives = (api, mapService, annotationService) => {
......@@ -31,8 +33,8 @@ module.exports.setupArchives = (api, mapService, annotationService) => {
await annotationService.findHandler(request, async result => {
if (result.error) return send(res, result.code)
data.annotations = result.data.items
const fileId = await exports.createArchive(data)
send(res, 200, fileId)
const url = await exports.createArchive(data)
send(res, 200, url)
})
})
})
......@@ -166,7 +168,14 @@ module.exports.createArchive = async (data) => {
})
})
return path.basename(data.map.uuid)
const opts = Object.assign({}, config.assets.client)
opts.useSSL = config.assets.client.useSSL && (config.assets.client.useSSL === true || config.assets.client.useSSL === 'true')
opts.port = config.assets.client.port ? parseInt(config.assets.client.port) : undefined
const minioClient = new Minio.Client(opts)
await minioClient.fPutObject(config.assets.archivesBucket, path.basename(archivePath), archivePath, { 'Content-Type': 'application/zip' })
const url = await minioClient.presignedGetObject(config.assets.archivesBucket, path.basename(archivePath))
return url
}
module.exports.readArchive = archivePath => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment