-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6470512
commit 0707bb7
Showing
12 changed files
with
780 additions
and
172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# API Usage - JointSpace API | ||
|
||
::: warning | ||
You must have the `user` and `password` from the pairing process to use the JointSpace API. See the Pairing section for more information. | ||
::: | ||
|
||
To create an instance of the `PhilTVApi` class, you need to provide an object of type [`PhilTVApiParams`](./lib/type-aliases/PhilTVApiParams.md) as a parameter to the constructor. | ||
|
||
If `cacheStructure` is set to `true`, the class will store the retrieved menu structure locally in a file using the [unstorage](https://unstorage.unjs.io/) library. | ||
On subsequent requests for the menu structure, it will check for an existing cached version before making a network call, which can greatly enhance performance by reducing unnecessary API requests. | ||
If caching is not required, you can simply omit the `options` parameter or set `cacheStructure` to `false`. | ||
|
||
|
||
```typescript | ||
const apiClient = new PhilTVApi({ | ||
apiUrl: 'https://192.168.0.22:1926/6', | ||
password: '5bewertrewref6968be556667552a49da5bf5fce3b379127cf74af2a3951026c2b', | ||
user: 'd1443b9fdeecd187277as5464564565e6315', | ||
options: { | ||
cacheStructure: true, | ||
}, | ||
}); | ||
``` | ||
|
||
Please see the all available methods in the [API documentation](./lib/classes/PhilTVApi.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# philtv-js | ||
|
||
**philtv-js** is a TypeScript library for pairing a Philips Android TV with the latest versions (6) using the **JointSpace** protocol. | ||
|
||
This library simplifies the pairing process, allowing you to interact with your Philips television securely and efficiently. | ||
|
||
With full TypeScript support, `philtv-js` provides type safety, helping to prevent runtime errors and improve code quality. | ||
|
||
This library leverages the lightweight [ky](https://github.com/sindresorhus/ky) HTTP client, which is built on top of Fetch API, for making secure and intuitive HTTP requests. | ||
|
||
::: warning | ||
**Works only in secure environments (HTTPS) and with versions 6 of the JointSpace protocol.** | ||
::: | ||
|
||
## Installation | ||
|
||
To install `philtv-js`, you can use npm: | ||
|
||
```bash | ||
npm install philtv-js | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Pairing TV | ||
|
||
To use `philtv-js`, you need to import the PhilTVPairing class from the library: | ||
|
||
```typescript | ||
import { PhilTVPairing } from 'philtv-js'; | ||
|
||
// @ts-ignore | ||
process.env.NODE_TLS_REJECT_UNAUTHORIZED = 0; // Disable TLS certificate verification | ||
|
||
const pjs = new PhilTVPairing({ tvIp: '192.168.0.22', apiPort: 1926 }); | ||
|
||
// `startPairing` returns a function to prompt for the pin, can be useful | ||
const { promptForPin } = await pjs.startPairing(); | ||
const pin = await promptForPin(); | ||
|
||
// `completePairing` returns the configuration object, or an error | ||
const [error, config] = await pjs.completePairing(pin); | ||
|
||
if (!error) { | ||
console.log('Pairing successful:', config); | ||
} else { | ||
console.error('Error:', error.message); | ||
} | ||
``` | ||
Result example of `config`: | ||
```json | ||
{ | ||
"user": "d1443b9fdeecd187277as5464564565e6315", | ||
"password": "5bewertrewref6968be556667552a49da5bf5fce3b379127cf74af2a3951026c2b", | ||
"apiUrl": "https://192.168.0.22:1926", | ||
"apiVersion": 6, | ||
"fullApiUrl": "https://192.168.0.22:1926/6" | ||
} | ||
``` | ||
You can store the `user` and `password` in a secure location and use them to interact with your TV. | ||
|
||
::: info | ||
Usage of `NODE_TLS_REJECT_UNAUTHORIZED`: | ||
Setting `NODE_TLS_REJECT_UNAUTHORIZED = 0` disables TLS certificate verification, which can expose your application to "man-in-the-middle" attacks. Use it with caution and only in development environments. | ||
|
||
For more information on managing TLS certificates, refer to the Node.js documentation. | ||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.