db-vendo-client/p/pkp/index.js

42 lines
1 KiB
JavaScript
Raw Permalink Normal View History

2020-03-11 20:00:54 +01:00
'use strict'
2020-03-18 21:43:19 +01:00
const {parseHook} = require('../../lib/profile-hooks')
const parseLocation = require('../../parse/location')
2020-03-11 20:00:54 +01:00
const products = require('./products')
const transformReqBody = (ctx, body) => {
body.client = {type: 'AND', id: 'HAFAS', name: 'Rozklad-PKP', v: '1000110'}
body.ver = '1.18' // 1.24 is used by the app, but that version doesn't support getPassList for departures/arrivals
body.auth = {type: 'AID', aid: 'DrxJYtYZQpEBCtcb'}
return body
}
2020-03-18 21:43:19 +01:00
const trimStopName = ({parsed}, l) => {
if (parsed.type === 'stop' || parsed.type === 'station' && parsed.name) {
parsed.name = parsed.name.replace(/(^-|-$)/g, '')
}
return parsed
}
2020-03-11 20:00:54 +01:00
const pkpProfile = {
locale: 'pl-PL',
timezone: 'Europe/Warsaw',
endpoint: 'https://mobil.rozklad-pkp.pl:8019/bin/mgate.exe',
transformReqBody,
products,
2020-03-18 21:43:19 +01:00
parseLocation: parseHook(parseLocation, trimStopName),
2020-03-11 20:00:54 +01:00
trip: true,
radar: true,
refreshJourney: false,
2020-09-16 17:21:59 +02:00
reachableFrom: true,
remarks: false, // seems like ver >= 1.20 is required
2020-03-11 20:00:54 +01:00
}
module.exports = pkpProfile