DB: use JSON base profile

This commit is contained in:
Jannis R 2021-01-14 20:31:31 +01:00
parent 51af991e38
commit 6c4785b05b
No known key found for this signature in database
GPG key ID: 0FE83946296A88A5
3 changed files with 19 additions and 8 deletions

16
p/db/base.json Normal file
View file

@ -0,0 +1,16 @@
{
"auth": {
"type": "AID",
"aid": "n91dB8Z77MLdoR0K"
},
"salt": "6264493855566A34304B356676787766",
"client": {
"id": "DB",
"v": "16040000",
"type": "IPH",
"name": "DB Navigator"
},
"endpoint": "https://reiseauskunft.bahn.de/bin/mgate.exe",
"ext": "DB.R19.04.a",
"ver": "1.15"
}

View file

@ -17,6 +17,7 @@ const _formatStation = require('../../format/station')
const {bike} = require('../../format/filters')
const products = require('./products')
const baseProfile = require('./base.json')
const formatLoyaltyCard = require('./loyalty-cards').format
const transformReqBody = (ctx, body) => {
@ -25,11 +26,6 @@ const transformReqBody = (ctx, body) => {
// see https://pastebin.com/qZ9WS3Cx
req.cfg = {...req.cfg, rtMode: 'HYBRID'} // todo: use `REALTIME`?
body.client = {id: 'DB', v: '16040000', type: 'IPH', name: 'DB Navigator'}
body.ext = 'DB.R19.04.a'
body.ver = '1.15'
body.auth = {type: 'AID', aid: 'n91dB8Z77MLdoR0K'}
return body
}
@ -447,11 +443,9 @@ const formatStation = (id) => {
// todo: find option for absolute number of results
const dbProfile = {
...baseProfile,
locale: 'de-DE',
timezone: 'Europe/Berlin',
endpoint: 'https://reiseauskunft.bahn.de/bin/mgate.exe',
salt: Buffer.from('bdI8UVj40K5fvxwf', 'utf8'),
addChecksum: true,
transformReqBody,

View file

@ -22,3 +22,4 @@ ext: .options.ext, \
ver: .options.version, \
}"
jq -r --tab "$query" <"$src/de/db-hafas-mgate.json" >../p/db/base.json