docs: update README.md and remove allowlist information (#381)

Committed via a GitHub action: https://github.com/tauri-apps/plugins-workspace/actions/runs/5034660288

Co-authored-by: lucasfernog <lucasfernog@users.noreply.github.com>
This commit is contained in:
Lucas Fernandes Nogueira
2023-05-20 23:30:06 +00:00
committed by tauri-bot
parent 02245e2a54
commit b9fc6628b4
8 changed files with 26 additions and 30 deletions

View File

@@ -1,6 +1,6 @@
![plugin-http](banner.jpg)
# HTTP
<!-- description -->
Access the HTTP client written in Rust.
## Install
@@ -18,6 +18,8 @@ Install the Core plugin by adding the following to your `Cargo.toml` file:
```toml
[dependencies]
tauri-plugin-http = "2.0.0-alpha"
# alternatively with Git:
tauri-plugin-http = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
```
@@ -26,6 +28,13 @@ You can install the JavaScript Guest bindings using your preferred JavaScript pa
> Note: Since most JavaScript package managers are unable to install packages from git monorepos we provide read-only mirrors of each plugin. This makes installation option 2 more ergonomic to use.
```sh
pnpm add @tauri-apps/plugin-http
# or
npm add @tauri-apps/plugin-http
# or
yarn add @tauri-apps/plugin-http
# alternatively with Git:
pnpm add https://github.com/tauri-apps/tauri-plugin-http#v2
# or
npm add https://github.com/tauri-apps/tauri-plugin-http#v2
@@ -51,7 +60,11 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript
import { fetch } from "@tauri-apps/plugin-http";
const response = await fetch("http://localhost:3003/users/2", {
method: "GET",
timeout: 30,
});
```
## Contributing

2
dist-js/index.d.ts vendored
View File

@@ -50,7 +50,7 @@ declare class Body {
* By default it sets the `application/x-www-form-urlencoded` Content-Type header,
* but you can set it to `multipart/form-data` if the Cargo feature `multipart` is enabled.
*
* Note that a file path must be allowed in the `fs` allowlist scope.
* Note that a file path must be allowed in the `fs` scope.
* @example
* ```typescript
* import { Body } from "@tauri-apps/plugin-http"

View File

@@ -30,7 +30,7 @@ class Body {
* By default it sets the `application/x-www-form-urlencoded` Content-Type header,
* but you can set it to `multipart/form-data` if the Cargo feature `multipart` is enabled.
*
* Note that a file path must be allowed in the `fs` allowlist scope.
* Note that a file path must be allowed in the `fs` scope.
* @example
* ```typescript
* import { Body } from "@tauri-apps/plugin-http"

File diff suppressed because one or more lines are too long

View File

@@ -28,7 +28,7 @@ class Body {
* By default it sets the `application/x-www-form-urlencoded` Content-Type header,
* but you can set it to `multipart/form-data` if the Cargo feature `multipart` is enabled.
*
* Note that a file path must be allowed in the `fs` allowlist scope.
* Note that a file path must be allowed in the `fs` scope.
* @example
* ```typescript
* import { Body } from "@tauri-apps/plugin-http"

File diff suppressed because one or more lines are too long

View File

@@ -5,21 +5,6 @@
/**
* Access the HTTP client written in Rust.
*
* The APIs must be allowlisted on `tauri.conf.json`:
* ```json
* {
* "tauri": {
* "allowlist": {
* "http": {
* "all": true, // enable all http APIs
* "request": true // enable HTTP request API
* }
* }
* }
* }
* ```
* It is recommended to allowlist only the APIs you use for optimal bundle size and security.
*
* ## Security
*
* This API has a scope configuration that forces you to restrict the URLs and paths that can be accessed using glob patterns.
@@ -27,11 +12,9 @@
* For instance, this scope configuration only allows making HTTP requests to the GitHub API for the `tauri-apps` organization:
* ```json
* {
* "tauri": {
* "allowlist": {
* "http": {
* "scope": ["https://api.github.com/repos/tauri-apps/*"]
* }
* "plugins": {
* "http": {
* "scope": ["https://api.github.com/repos/tauri-apps/*"]
* }
* }
* }
@@ -105,7 +88,7 @@ class Body {
* By default it sets the `application/x-www-form-urlencoded` Content-Type header,
* but you can set it to `multipart/form-data` if the Cargo feature `multipart` is enabled.
*
* Note that a file path must be allowed in the `fs` allowlist scope.
* Note that a file path must be allowed in the `fs` scope.
* @example
* ```typescript
* import { Body } from "@tauri-apps/plugin-http"

View File

@@ -13,7 +13,7 @@ pub struct Scope {
}
impl Scope {
/// Creates a new scope from the allowlist's `http` scope configuration.
/// Creates a new scope from the scope configuration.
pub(crate) fn new(scope: &HttpAllowlistScope) -> Self {
Self {
allowed_urls: scope