# cd-wifi-client

> A client for the WiFi portal of Czech Railways trains.

Latest version **1.1.0** (published 2023-09-19) · ISC license · 0 weekly downloads

## Install

```sh
npm install cd-wifi-client
pnpm add cd-wifi-client
yarn add cd-wifi-client
bun add cd-wifi-client
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2023-09-19 |
| First published | 2018-10-22 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8 |
| Dependencies | 5 |
| Unpacked size | 8.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Author | Jannis R |
| Maintainers | derhuerst |
| Keywords | cd, České dráhy, ceske drahy, czech, railways, wifi, portal, cdwifi.cz |

## Links

- npm: https://www.npmjs.com/package/cd-wifi-client
- Repository: https://github.com/derhuerst/cd-wifi-client
- Issues: https://github.com/derhuerst/cd-wifi-client/issues
- npm.io page: https://npm.io/package/cd-wifi-client

## Dependencies (5)

- [parse-jsonp](https://npm.io/package/parse-jsonp.md) ^2.0.0
- [query-string](https://npm.io/package/query-string.md) ^7.1.3
- [fetch-ponyfill](https://npm.io/package/fetch-ponyfill.md) ^6.0.2
- [pinkie-promise](https://npm.io/package/pinkie-promise.md) ^2.0.1
- [abort-controller](https://npm.io/package/abort-controller.md) ^3.0.0

## Recent versions

- 1.1.0 (latest) — 2023-09-19
- 1.0.2 — 2020-08-22
- 1.0.1 — 2019-07-13
- 1.0.0 — 2018-10-22

## README

# cd-wifi-client

**A client for the onboard WiFi portal of *České dráhy* (Czech Railways) trains.**

[![npm version](https://img.shields.io/npm/v/cd-wifi-client.svg)](https://www.npmjs.com/package/cd-wifi-client)
![ISC-licensed](https://img.shields.io/github/license/derhuerst/cd-wifi-client.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)


## Installation

```shell
npm install cd-wifi-client
```


## Usage

### Acknowledging the captive portal

```js
const {acknowledgeCaptivePortal} = require('cd-wifi-client')

const acknowledgeLegalTerms = (msg) => {
	console.log(msg)
	return Promise.resolve() // we always accept
}

acknowledgeCaptivePortal(acknowledgeLegalTerms)
.then(successMsg => console.info(successMsg))
.catch(console.error)
```

### Getting the current position

```js
const {fetchTrainStatus} = require('cd-wifi-client')

console.log(await fetchTrainStatus())
```

```js
{
	latitude: 50.252175,
	longitude: 14.30227,
	altitude: 185.5,
	speed: 85,
	delay: null,
}
```

### Getting the WiFi data limit & connectivity

```js
const {
	fetchWifiStatus,
	fetchWifiConnectivity,
} = require('cd-wifi-client')

console.log(await fetchWifiStatus())
console.log(await fetchWifiConnectivity())
```

```js
// WiFi status
{
	authenticated: true,
	id: null,
	clientIpAddress: '10.0.0.105',
	clientMacAddress: null,
	dataUsage: {used: 0, limit: -1, speedLimit: false, region: 'CZ'},
}
// WiFi connectivity
{
	version: '1.9',
	online: '1',
	bundleid: '84105699258',
	bundleip: '10.3.2.1',
	links: [
		{
			index: '1',
			device_type: 'ethernet',
			device_state: 'down',
			link_state: 'disconnected',
			ethernet_info: {ip: '0.0.0.0', netmask: '0.0.0.0', mode: 'dhcp'},
		},
		{
			index: '102',
			device_type: 'modem',
			device_subtype: 'sierra-7710',
			device_state: 'up',
			link_state: 'available',
			rssi: '-75',
			technology: 'lte',
			operator_id: '23002',
			apninfo: 'cd-internet,-1,-1',
			umts_info: {net_status: '1', lac: 'FFFE', cellid: '03F3FF01'},
		},
		// …
	]
}
```


## Related

- [`sncf-wifi-portal-client`](https://github.com/derhuerst/sncf-wifi-portal-client) – Query information from the SNCF WiFi portal in French TGV trains.
- [`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.
- [`live-cd-wifi-position`](https://github.com/derhuerst/live-cd-wifi-position) – Live vehicle geolocation of České dráhy (Czech Railways) trains taken from the on-board Icomera WiFi system.


## Contributing

If you have a question or need support using `cd-wifi-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/cd-wifi-client/issues).

---
_Source: https://npm.io/package/cd-wifi-client · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
