mirror of
https://github.com/bellingcat/datasheet-server.git
synced 2026-06-13 13:58:32 +03:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
854d744806 | ||
|
|
0155830cad | ||
|
|
96558a0cf7 | ||
|
|
b3d6d08289 | ||
|
|
315adf0653 | ||
|
|
b19664ae33 | ||
|
|
4e748a156a | ||
|
|
14d6fe6db2 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -15,3 +15,4 @@ tags.lock
|
|||||||
tags.temp
|
tags.temp
|
||||||
src/config.js
|
src/config.js
|
||||||
src/local.config.js
|
src/local.config.js
|
||||||
|
src/config.js
|
||||||
|
|||||||
@@ -59,6 +59,11 @@ Clone the repository to your local:
|
|||||||
git clone https://www.github.com/forensic-architecture/datasheet-server
|
git clone https://www.github.com/forensic-architecture/datasheet-server
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Copy [src/example.config.js](src/example.config.js) into `src/config.js` and modify
|
||||||
|
```
|
||||||
|
cp src/example.config.js src/config.js
|
||||||
|
```
|
||||||
|
|
||||||
Follow the steps in the [configuration](#configuration) section of this
|
Follow the steps in the [configuration](#configuration) section of this
|
||||||
document.
|
document.
|
||||||
|
|
||||||
|
|||||||
18
package-lock.json
generated
18
package-lock.json
generated
@@ -1288,7 +1288,7 @@
|
|||||||
"version": "2.6.11",
|
"version": "2.6.11",
|
||||||
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.11.tgz",
|
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.11.tgz",
|
||||||
"integrity": "sha512-5wjnpaT/3dV+XB4borEsnAYQchn00XSgTAWKDkEqv+K8KevjbzmofK6hfJ9TZIlpj2N0xQpazy7PiRQiWHqzWg==",
|
"integrity": "sha512-5wjnpaT/3dV+XB4borEsnAYQchn00XSgTAWKDkEqv+K8KevjbzmofK6hfJ9TZIlpj2N0xQpazy7PiRQiWHqzWg==",
|
||||||
"deprecated": "core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.",
|
"deprecated": "core-js@<3.4 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"hasInstallScript": true
|
"hasInstallScript": true
|
||||||
},
|
},
|
||||||
@@ -1499,7 +1499,7 @@
|
|||||||
"version": "2.1.8",
|
"version": "2.1.8",
|
||||||
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz",
|
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz",
|
||||||
"integrity": "sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg==",
|
"integrity": "sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg==",
|
||||||
"deprecated": "Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.",
|
"deprecated": "Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -1934,7 +1934,7 @@
|
|||||||
"version": "2.1.8",
|
"version": "2.1.8",
|
||||||
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz",
|
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz",
|
||||||
"integrity": "sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg==",
|
"integrity": "sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg==",
|
||||||
"deprecated": "Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.",
|
"deprecated": "Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"anymatch": "^2.0.0",
|
"anymatch": "^2.0.0",
|
||||||
@@ -2081,7 +2081,7 @@
|
|||||||
"version": "2.6.11",
|
"version": "2.6.11",
|
||||||
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.11.tgz",
|
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.11.tgz",
|
||||||
"integrity": "sha512-5wjnpaT/3dV+XB4borEsnAYQchn00XSgTAWKDkEqv+K8KevjbzmofK6hfJ9TZIlpj2N0xQpazy7PiRQiWHqzWg==",
|
"integrity": "sha512-5wjnpaT/3dV+XB4borEsnAYQchn00XSgTAWKDkEqv+K8KevjbzmofK6hfJ9TZIlpj2N0xQpazy7PiRQiWHqzWg==",
|
||||||
"deprecated": "core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.",
|
"deprecated": "core-js@<3.4 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"hasInstallScript": true
|
"hasInstallScript": true
|
||||||
},
|
},
|
||||||
@@ -2392,7 +2392,7 @@
|
|||||||
"version": "2.6.11",
|
"version": "2.6.11",
|
||||||
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.11.tgz",
|
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.11.tgz",
|
||||||
"integrity": "sha512-5wjnpaT/3dV+XB4borEsnAYQchn00XSgTAWKDkEqv+K8KevjbzmofK6hfJ9TZIlpj2N0xQpazy7PiRQiWHqzWg==",
|
"integrity": "sha512-5wjnpaT/3dV+XB4borEsnAYQchn00XSgTAWKDkEqv+K8KevjbzmofK6hfJ9TZIlpj2N0xQpazy7PiRQiWHqzWg==",
|
||||||
"deprecated": "core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.",
|
"deprecated": "core-js@<3.4 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"hasInstallScript": true
|
"hasInstallScript": true
|
||||||
},
|
},
|
||||||
@@ -3469,7 +3469,7 @@
|
|||||||
"version": "2.6.11",
|
"version": "2.6.11",
|
||||||
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.11.tgz",
|
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.11.tgz",
|
||||||
"integrity": "sha512-5wjnpaT/3dV+XB4borEsnAYQchn00XSgTAWKDkEqv+K8KevjbzmofK6hfJ9TZIlpj2N0xQpazy7PiRQiWHqzWg==",
|
"integrity": "sha512-5wjnpaT/3dV+XB4borEsnAYQchn00XSgTAWKDkEqv+K8KevjbzmofK6hfJ9TZIlpj2N0xQpazy7PiRQiWHqzWg==",
|
||||||
"deprecated": "core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.",
|
"deprecated": "core-js@<3.4 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"hasInstallScript": true
|
"hasInstallScript": true
|
||||||
},
|
},
|
||||||
@@ -4162,7 +4162,7 @@
|
|||||||
"version": "2.6.11",
|
"version": "2.6.11",
|
||||||
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.11.tgz",
|
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.11.tgz",
|
||||||
"integrity": "sha512-5wjnpaT/3dV+XB4borEsnAYQchn00XSgTAWKDkEqv+K8KevjbzmofK6hfJ9TZIlpj2N0xQpazy7PiRQiWHqzWg==",
|
"integrity": "sha512-5wjnpaT/3dV+XB4borEsnAYQchn00XSgTAWKDkEqv+K8KevjbzmofK6hfJ9TZIlpj2N0xQpazy7PiRQiWHqzWg==",
|
||||||
"deprecated": "core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.",
|
"deprecated": "core-js@<3.4 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"hasInstallScript": true
|
"hasInstallScript": true
|
||||||
},
|
},
|
||||||
@@ -6649,7 +6649,7 @@
|
|||||||
"version": "2.1.8",
|
"version": "2.1.8",
|
||||||
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz",
|
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz",
|
||||||
"integrity": "sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg==",
|
"integrity": "sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg==",
|
||||||
"deprecated": "Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.",
|
"deprecated": "Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"anymatch": "^2.0.0",
|
"anymatch": "^2.0.0",
|
||||||
@@ -8388,6 +8388,7 @@
|
|||||||
"version": "0.5.3",
|
"version": "0.5.3",
|
||||||
"resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.3.tgz",
|
"resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.3.tgz",
|
||||||
"integrity": "sha512-Htz+RnsXWk5+P2slx5Jh3Q66vhQj1Cllm0zvnaY98+NFx+Dv2CF/f5O/t8x+KaNdrdIAsruNzoh/KpialbqAnw==",
|
"integrity": "sha512-Htz+RnsXWk5+P2slx5Jh3Q66vhQj1Cllm0zvnaY98+NFx+Dv2CF/f5O/t8x+KaNdrdIAsruNzoh/KpialbqAnw==",
|
||||||
|
"deprecated": "See https://github.com/lydell/source-map-resolve#deprecated",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"atob": "^2.1.2",
|
"atob": "^2.1.2",
|
||||||
@@ -8411,6 +8412,7 @@
|
|||||||
"version": "0.4.0",
|
"version": "0.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz",
|
||||||
"integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=",
|
"integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=",
|
||||||
|
"deprecated": "See https://github.com/lydell/source-map-url#deprecated",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/spdx-correct": {
|
"node_modules/spdx-correct": {
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
import { timemap } from './lib'
|
|
||||||
|
|
||||||
export default {
|
|
||||||
gsheets: [],
|
|
||||||
xlsx: [
|
|
||||||
{
|
|
||||||
name: 'timemap_data',
|
|
||||||
path: 'data/timemap_data.xlsx',
|
|
||||||
tabs: timemap.default
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
19
src/example.config.js
Normal file
19
src/example.config.js
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import { timemap } from './lib'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
gsheets: [],
|
||||||
|
xlsx: [
|
||||||
|
{
|
||||||
|
name: 'timemap_data',
|
||||||
|
path: 'data/timemap_data.xlsx',
|
||||||
|
tabs: timemap.default
|
||||||
|
}
|
||||||
|
],
|
||||||
|
cors: {
|
||||||
|
active: false,
|
||||||
|
corsOptions: { // meaningless unless active=true
|
||||||
|
origin: 'http://example.com',
|
||||||
|
optionsSuccessStatus: 200 // some legacy browsers (IE11, various SmartTVs) choke on 204
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
16
src/index.js
16
src/index.js
@@ -7,6 +7,14 @@ import api from './api'
|
|||||||
import dotenv from 'dotenv'
|
import dotenv from 'dotenv'
|
||||||
const hbs = require('express-handlebars')
|
const hbs = require('express-handlebars')
|
||||||
|
|
||||||
|
|
||||||
|
let configJS
|
||||||
|
try {
|
||||||
|
configJS = require('./local.config.js').default
|
||||||
|
} catch (_) {
|
||||||
|
configJS = require('./config.js').default
|
||||||
|
}
|
||||||
|
|
||||||
dotenv.config()
|
dotenv.config()
|
||||||
|
|
||||||
let app = express()
|
let app = express()
|
||||||
@@ -17,13 +25,17 @@ app.engine('.hbs', hbs({
|
|||||||
}))
|
}))
|
||||||
app.set('view engine', '.hbs')
|
app.set('view engine', '.hbs')
|
||||||
|
|
||||||
// enable cross origin requests explicitly in development
|
// enable cross origin requests explicitly in development OR if active in prod
|
||||||
if (process.env.NODE_ENV === 'development') {
|
|
||||||
const cors = require('cors')
|
const cors = require('cors')
|
||||||
|
if (process.env.NODE_ENV === 'development') {
|
||||||
console.log('Enabling CORS in development...')
|
console.log('Enabling CORS in development...')
|
||||||
app.use(cors())
|
app.use(cors())
|
||||||
|
} else if (configJS.cors.active === true) {
|
||||||
|
console.log('Enabling CORS in from config.js in prod...')
|
||||||
|
app.use(cors(configJS.cors.corsOptions))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const config = process.env
|
const config = process.env
|
||||||
|
|
||||||
initialize(controller => {
|
initialize(controller => {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import fetch from 'node-fetch'
|
|||||||
import childProcess from 'child_process'
|
import childProcess from 'child_process'
|
||||||
|
|
||||||
const SERVER_LAUNCH_WAIT_TIME = 10 * 1000
|
const SERVER_LAUNCH_WAIT_TIME = 10 * 1000
|
||||||
const SERVER_ROOT = 'http://localhost:4040'
|
const SERVER_ROOT = ''
|
||||||
let serverProc = null
|
let serverProc = null
|
||||||
let serverExited = false
|
let serverExited = false
|
||||||
function checkStatus (res) {
|
function checkStatus (res) {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<div class="bp-source">{{ source }}</div>
|
<div class="bp-source">{{ source }}</div>
|
||||||
</div>
|
</div>
|
||||||
{{#each urls}}
|
{{#each urls}}
|
||||||
<div><a target="_blank" href="http://localhost:4040{{ this }}">{{ this }}</a></div>
|
<div><a target="_blank" href="{{ this }}">{{ this }}</a></div>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
{{ else }}
|
{{ else }}
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<a class="bp-update-container" target="_blank" href="http://localhost:4040/api/update">
|
<a class="bp-update-container" target="_blank" href="/api/update">
|
||||||
<div class="bp-button">Update</div>
|
<div class="bp-button">Update</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user