mirror of
https://github.com/bellingcat/datasheet-server.git
synced 2026-06-09 20:08:32 +03:00
Compare commits
18 Commits
grenfell
...
project/ye
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fdee3fa581 | ||
|
|
f093253d87 | ||
|
|
011c667805 | ||
|
|
66d7d42497 | ||
|
|
71a8687003 | ||
|
|
63d168a964 | ||
|
|
4d310270d5 | ||
|
|
a6cc9491c6 | ||
|
|
0ee207dc75 | ||
|
|
7e97c5c227 | ||
|
|
978d572660 | ||
|
|
8bd5f38ac4 | ||
|
|
6ab37ccb70 | ||
|
|
4976bfd985 | ||
|
|
d713a15879 | ||
|
|
679407f421 | ||
|
|
3eebf811fb | ||
|
|
be03a3983a |
7
.github/workflows/ci.yml
vendored
7
.github/workflows/ci.yml
vendored
@@ -10,11 +10,16 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
ref: ${{ github.head_ref }}
|
||||
- uses: actions/setup-node@v2-beta
|
||||
with:
|
||||
node-version: '12'
|
||||
|
||||
- run: npm install
|
||||
- run: npm test
|
||||
env:
|
||||
CI: true
|
||||
- run: npm run lint
|
||||
|
||||
env:
|
||||
CI: true
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { version } from '../../package.json'
|
||||
import fetch from 'node-fetch'
|
||||
import { Router } from 'express'
|
||||
import { getParameterByName } from '../lib/util'
|
||||
import copy from '../copy/en'
|
||||
|
||||
export default ({ config, controller }) => {
|
||||
@@ -22,6 +24,21 @@ export default ({ config, controller }) => {
|
||||
})
|
||||
})
|
||||
|
||||
api.get('/media/:code', (req, res) => {
|
||||
const { code } = req.params
|
||||
fetch(`${process.env.MEDIA_API_ENDPOINT}/${code}`, {
|
||||
method: 'get',
|
||||
headers: {
|
||||
'Authorization': 'Basic ' + new Buffer(process.env.MEDIA_AUTH_USER + ":" + process.env.MEDIA_AUTH_PWORD).toString("base64")
|
||||
}
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => res.send(data))
|
||||
.catch(err => {
|
||||
res.status(err.status || 404).send({ error: err.message })
|
||||
});
|
||||
})
|
||||
|
||||
api.get('/update', (req, res) => {
|
||||
controller
|
||||
.update()
|
||||
@@ -30,10 +47,10 @@ export default ({ config, controller }) => {
|
||||
success: msg
|
||||
})
|
||||
)
|
||||
.catch(err =>
|
||||
.catch(err => {
|
||||
res.status(404)
|
||||
.send({ error: err.message, err })
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
api.get('/:sheet/:tab/:resource/:frag', (req, res) => {
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
CONFIG=../configs/timemap/grenfell/datasheet.config.js
|
||||
@@ -7,6 +7,7 @@ function prefixedTabs (prefix, cfg) {
|
||||
[`${prf('events')}export_events`]: BP.deeprows,
|
||||
[`${prf('associations')}export_associations`]: BP.deeprows,
|
||||
[`${prf('sources')}export_sources`]: BP.deepids,
|
||||
[`${prf('shapes')}export_shapes`]: BP.deeprows,
|
||||
[`${prf('sites')}export_sites`]: BP.rows
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import copy from '../copy/en'
|
||||
|
||||
/**
|
||||
* Controller
|
||||
* Controller class
|
||||
*
|
||||
*/
|
||||
class Controller {
|
||||
|
||||
@@ -217,7 +217,10 @@ class GsheetFetcher extends Fetcher {
|
||||
})
|
||||
.then(this._buildBlueprintsAsync())
|
||||
.then(() => true)
|
||||
.catch(() => false)
|
||||
.catch((err) => {
|
||||
console.log(`Error fetching gsheets: ${err.message} `)
|
||||
return false
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@ class StoreJson {
|
||||
|
||||
save (url, data) {
|
||||
const parts = url.split('/')
|
||||
|
||||
return fs.writeFile(
|
||||
`${STORAGE_DIRNAME}/${parts[0]}__${parts[1]}__${parts[2]}.json`,
|
||||
JSON.stringify(data)
|
||||
|
||||
@@ -12,6 +12,8 @@ const egInput1 = [
|
||||
[4, 5, 6]
|
||||
]
|
||||
|
||||
// Test default blueprint exports
|
||||
// Smoke tests
|
||||
test('defaultBlueprint exports', t => {
|
||||
const expected = {
|
||||
sheet: {
|
||||
|
||||
Reference in New Issue
Block a user