mirror of
https://github.com/bellingcat/datasheet-server.git
synced 2026-06-12 05:18:31 +03:00
Compare commits
17 Commits
grenfell
...
feature/ad
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
ref: ${{ github.head_ref }}
|
||||||
- uses: actions/setup-node@v2-beta
|
- uses: actions/setup-node@v2-beta
|
||||||
with:
|
with:
|
||||||
node-version: '12'
|
node-version: '12'
|
||||||
|
|
||||||
- run: npm install
|
- run: npm install
|
||||||
- run: npm test
|
- run: npm test
|
||||||
|
env:
|
||||||
|
CI: true
|
||||||
- run: npm run lint
|
- run: npm run lint
|
||||||
|
env:
|
||||||
|
CI: true
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import { version } from '../../package.json'
|
import { version } from '../../package.json'
|
||||||
|
import fetch from 'node-fetch'
|
||||||
import { Router } from 'express'
|
import { Router } from 'express'
|
||||||
|
import { getParameterByName } from '../lib/util'
|
||||||
import copy from '../copy/en'
|
import copy from '../copy/en'
|
||||||
|
|
||||||
export default ({ config, controller }) => {
|
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.data))
|
||||||
|
.catch(err => {
|
||||||
|
res.status(err.status || 404).send({ error: err.message })
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
api.get('/update', (req, res) => {
|
api.get('/update', (req, res) => {
|
||||||
controller
|
controller
|
||||||
.update()
|
.update()
|
||||||
@@ -30,10 +47,10 @@ export default ({ config, controller }) => {
|
|||||||
success: msg
|
success: msg
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
.catch(err =>
|
.catch(err => {
|
||||||
res.status(404)
|
res.status(404)
|
||||||
.send({ error: err.message, err })
|
.send({ error: err.message, err })
|
||||||
)
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
api.get('/:sheet/:tab/:resource/:frag', (req, res) => {
|
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('events')}export_events`]: BP.deeprows,
|
||||||
[`${prf('associations')}export_associations`]: BP.deeprows,
|
[`${prf('associations')}export_associations`]: BP.deeprows,
|
||||||
[`${prf('sources')}export_sources`]: BP.deepids,
|
[`${prf('sources')}export_sources`]: BP.deepids,
|
||||||
|
[`${prf('shapes')}export_shapes`]: BP.deeprows,
|
||||||
[`${prf('sites')}export_sites`]: BP.rows
|
[`${prf('sites')}export_sites`]: BP.rows
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import copy from '../copy/en'
|
import copy from '../copy/en'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controller
|
* Controller class
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class Controller {
|
class Controller {
|
||||||
|
|||||||
@@ -217,7 +217,10 @@ class GsheetFetcher extends Fetcher {
|
|||||||
})
|
})
|
||||||
.then(this._buildBlueprintsAsync())
|
.then(this._buildBlueprintsAsync())
|
||||||
.then(() => true)
|
.then(() => true)
|
||||||
.catch(() => false)
|
.catch((err) => {
|
||||||
|
console.log(`Error fetching gsheets: ${err.message} `)
|
||||||
|
return false
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ class StoreJson {
|
|||||||
|
|
||||||
save (url, data) {
|
save (url, data) {
|
||||||
const parts = url.split('/')
|
const parts = url.split('/')
|
||||||
|
|
||||||
return fs.writeFile(
|
return fs.writeFile(
|
||||||
`${STORAGE_DIRNAME}/${parts[0]}__${parts[1]}__${parts[2]}.json`,
|
`${STORAGE_DIRNAME}/${parts[0]}__${parts[1]}__${parts[2]}.json`,
|
||||||
JSON.stringify(data)
|
JSON.stringify(data)
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ const egInput1 = [
|
|||||||
[4, 5, 6]
|
[4, 5, 6]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
// Test default blueprint exports
|
||||||
|
// Smoke tests
|
||||||
test('defaultBlueprint exports', t => {
|
test('defaultBlueprint exports', t => {
|
||||||
const expected = {
|
const expected = {
|
||||||
sheet: {
|
sheet: {
|
||||||
|
|||||||
Reference in New Issue
Block a user