sncf-wifi-portal-client
Advanced tools
Comparing version 1.0.0 to 1.1.0
22
index.js
@@ -13,3 +13,3 @@ 'use strict' | ||
const request = async (route) => { | ||
const request = async (route, opt = {}) => { | ||
if ('string' !== typeof route) throw new Error('route must be a string') | ||
@@ -20,3 +20,5 @@ | ||
redirect: 'follow', | ||
headers: {'User-Agent': userAgent} | ||
headers: {'User-Agent': userAgent}, | ||
timeout: 2500, | ||
...opt, | ||
}) | ||
@@ -31,13 +33,13 @@ if (!res.ok) { | ||
const trip = () => request('train/details') | ||
const tripPolyline = () => request('train/graph') | ||
const gps = () => request('train/gps') | ||
const trip = request.bind(null, 'train/details') | ||
const tripPolyline = request.bind(null, 'train/graph') | ||
const gps = request.bind(null, 'train/gps') | ||
const coverage = () => request('train/coverage') | ||
const coverage = request.bind(null, 'train/coverage') | ||
const connectionStatus = () => request('connection/status') | ||
const connectionStatistics = () => request('connection/statistics') | ||
const connectionStatus = request.bind(null, 'connection/status') | ||
const connectionStatistics = request.bind(null, 'connection/statistics') | ||
const bar = () => request('bar/attendance') | ||
const food = () => request('food/catalog') | ||
const bar = request.bind(null, 'bar/attendance') | ||
const food = request.bind(null, 'food/catalog') | ||
@@ -44,0 +46,0 @@ module.exports = { |
{ | ||
"name": "sncf-wifi-portal-client", | ||
"description": "Query information from the SNCF WiFi portal in French TGV trains.", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"main": "index.js", | ||
@@ -29,2 +29,3 @@ "files": [ | ||
"devDependencies": { | ||
"eslint": "^7.24.0", | ||
"tap-min": "^2.0.0", | ||
@@ -35,4 +36,5 @@ "tape": "^4.10.1" | ||
"test": "env NODE_ENV=dev node test.js | tap-min", | ||
"prepublishOnly": "npm test" | ||
"lint": "eslint .", | ||
"prepublishOnly": "npm run lint" | ||
} | ||
} |
@@ -8,4 +8,4 @@ # sncf-wifi-portal-client | ||
![minimum Node.js version](https://img.shields.io/node/v/berlin-postal-code-areas.svg) | ||
[![chat with me on Gitter](https://img.shields.io/badge/chat%20with%20me-on%20gitter-512e92.svg)](https://gitter.im/derhuerst) | ||
[![support me on Patreon](https://img.shields.io/badge/support%20me-on%20patreon-fa7664.svg)](https://patreon.com/derhuerst) | ||
[![support me via GitHub Sponsors](https://img.shields.io/badge/support%20me-donate-fa7664.svg)](https://github.com/sponsors/derhuerst) | ||
[![chat with me on Twitter](https://img.shields.io/badge/chat%20with%20me-on%20Twitter-1da1f2.svg)](https://twitter.com/derhuerst) | ||
@@ -44,4 +44,12 @@ | ||
## Related | ||
- [`record-tgv-movement`](https://github.com/derhuerst/record-tgv-movement) – Record the movement of any TGV using the on-board WiFi. | ||
- [`wifi-on-ice-portal-client`](https://github.com/derhuerst/wifi-on-ice-portal-client) – Query information from the WifiOnICE portal in German ICE trains. | ||
- [`digital-im-regio-portal-client`](https://github.com/derhuerst/digital-im-regio-portal-client) – Query information from the Digital im Regio portal in German Regio trains. | ||
- [`cd-wifi-client`](https://github.com/derhuerst/cd-wifi-client) – A client for the onboard WiFi portal of České dráhy (Czech Railways) trains. | ||
## Contributing | ||
If you have a question or need support using `sncf-wifi-portal-client`, please double-check your code and setup first. If you think you have found a bug or want to propose a feature, refer to [the issues page](https://github.com/derhuerst/sncf-wifi-portal-client/issues). |
5128
50
54
3