Merge branch 'main' into live

This commit is contained in:
rafapaezbas
2024-07-19 13:03:14 +02:00
2 changed files with 31 additions and 3 deletions

View File

@@ -108,6 +108,15 @@ In development, `pear://dev/<data>`.
* [`pear dev`](./cli.md) * [`pear dev`](./cli.md)
* [`pear run`](./cli.md) * [`pear run`](./cli.md)
### `Pear.config.links <Object|Array>`
Holds trusted Pear application links and domains as specified in the `links` field inside `package.json`.
**References**
* [pear.links](./configuration.md#pearlinks-objectarray)
* [`pear dev`](./cli.md)
* [`pear run`](./cli.md)
### `Pear.config.linkData <String>` ### `Pear.config.linkData <String>`
Holds just the data portion of a Pear link. Holds just the data portion of a Pear link.

View File

@@ -122,11 +122,30 @@ Background color (Hex, RGB, RGBA, HSL, HSLA, CSS color).
### `pear.links <Object|Array>` ### `pear.links <Object|Array>`
An array or object containing trusted Pear application keys. Storing and managing Pear application links and domains.
#### `pear.links.worker <String>` `links` can be an object or an array. If it's an object, naming the key makes it easy to reference from [`Pear.config.links`](./api.md#pearconfiglinks-objectarray)
The key of the Pear application that contains the worker script. For more info, please check the [terminal](https://github.com/holepunchto/pear/blob/main/examples/terminal/index.js#L21) and [desktop](https://github.com/holepunchto/pear/blob/main/examples/desktop/app.js#L27) examples. The links and domains inside need to be trusted. Any pear links that the app trusts to run (eg as a worker) must be added and any http(s) domains that the app wants to access must also be added, including localhost.
```json
{
// ...
"pear": {
// accessed at runtime using Pear.config.links[index] eg. Pear.config.links[0] for pear://somePearKey
"links": [
"pear://somePearKey",
"https://example.com"
]
// OR
// accessed at runtime using Pear.config.links.name eg. Pear.config.links.myWorker for myWorker
"links": {
"myWorker": "pear://somePearKey",
"host": "https://example.com"
}
}
}
```
### `pear.stage <Object>` ### `pear.stage <Object>`