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

pull/385/head
Lucas Fernandes Nogueira 2 years ago committed by GitHub
parent d677f73495
commit f4069f5588
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,4 +1,4 @@
# App plugin
# App
This plugin provides APIs to read application metadata and macOS app visibility functions.
@ -18,6 +18,8 @@ Install the Core plugin by adding the following to your `Cargo.toml` file:
```toml
[dependencies]
tauri-plugin-app = "2.0.0-alpha"
# alternatively with Git:
tauri-plugin-app = { 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-app
# or
npm add @tauri-apps/plugin-app
# or
yarn add @tauri-apps/plugin-app
# alternatively with Git:
pnpm add https://github.com/tauri-apps/tauri-plugin-app#v2
# or
npm add https://github.com/tauri-apps/tauri-plugin-app#v2
@ -51,7 +60,9 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript
import * as app from "@tauri-apps/plugin-app";
import { getVersion, hide } from "@tauri-apps/plugin-app";
const appVersion = await getVersion();
await hide();
```
## Contributing

@ -5,22 +5,6 @@
/**
* Get application metadata.
*
* The APIs must be added to [`tauri.allowlist.app`](https://tauri.app/v1/api/config/#allowlistconfig.app) in `tauri.conf.json`:
* ```json
* {
* "tauri": {
* "allowlist": {
* "app": {
* "all": true, // enable all app APIs
* "show": true,
* "hide": true
* }
* }
* }
* }
* ```
* It is recommended to allowlist only the APIs you use for optimal bundle size and security.
*
* @module
*/

@ -2,6 +2,8 @@
Use hardware security-keys in your Tauri App.
- Supported platforms: Windows, Linux, FreeBSD, NetBSD, OpenBSD, and macOS.
## Install
_This plugin requires a Rust version of at least **1.65**_
@ -17,9 +19,10 @@ Install the Core plugin by adding the following to your `Cargo.toml` file:
`src-tauri/Cargo.toml`
```toml
[dependencies]
tauri-plugin-authenticator = "0.1"
# or through git
# you can add the dependencies on the `[dependencies]` section if you do not target mobile
[target."cfg(not(any(target_os = \"android\", target_os = \"ios\")))".dependencies]
tauri-plugin-authenticator = "2.0.0-alpha"
# alternatively with Git:
tauri-plugin-authenticator = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
```
@ -27,6 +30,16 @@ 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-authenticator
# or
npm add @tauri-apps/plugin-authenticator
# or
yarn add @tauri-apps/plugin-authenticator
```
Alternatively with Git:
```sh
pnpm add https://github.com/tauri-apps/tauri-plugin-authenticator#v2
# or
@ -44,7 +57,11 @@ First you need to register the core plugin with Tauri:
```rust
fn main() {
tauri::Builder::default()
.plugin(tauri_plugin_authenticator::init())
.setup(|app| {
#[cfg(desktop)]
app.handle().plugin(tauri_plugin_authenticator::init())?;
Ok(())
})
.run(tauri::generate_context!())
.expect("error while running tauri application");
}

@ -18,6 +18,8 @@ Install the Core plugin by adding the following to your `Cargo.toml` file:
```toml
[dependencies]
tauri-plugin-autostart = "2.0.0-alpha"
# alternatively with Git:
tauri-plugin-autostart = { 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-autostart
# or
npm add @tauri-apps/plugin-autostart
# or
yarn add @tauri-apps/plugin-autostart
# alternatively with Git:
pnpm add https://github.com/tauri-apps/tauri-plugin-autostart#v2
# or
npm add https://github.com/tauri-apps/tauri-plugin-autostart#v2

@ -1,6 +1,8 @@
![plugin-cli](banner.jpg)
# CLI
<!-- description -->
Parse arguments from your Command Line Interface.
- Supported platforms: Windows, Linux and macOS.
## Install
@ -17,7 +19,10 @@ Install the Core plugin by adding the following to your `Cargo.toml` file:
`src-tauri/Cargo.toml`
```toml
[dependencies]
# you can add the dependencies on the `[dependencies]` section if you do not target mobile
[target."cfg(not(any(target_os = \"android\", target_os = \"ios\")))".dependencies]
tauri-plugin-cli = "2.0.0-alpha"
# alternatively with Git:
tauri-plugin-cli = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
```
@ -26,6 +31,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-cli
# or
npm add @tauri-apps/plugin-cli
# or
yarn add @tauri-apps/plugin-cli
# alternatively with Git:
pnpm add https://github.com/tauri-apps/tauri-plugin-cli#v2
# or
npm add https://github.com/tauri-apps/tauri-plugin-cli#v2
@ -42,7 +54,11 @@ First you need to register the core plugin with Tauri:
```rust
fn main() {
tauri::Builder::default()
.plugin(tauri_plugin_cli::init())
.setup(|app| {
#[cfg(desktop)]
app.handle().plugin(tauri_plugin_cli::init())?;
Ok(())
})
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
@ -51,7 +67,18 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript
import { getMatches } from "@tauri-apps/plugin-cli";
const matches = await getMatches();
if (matches.subcommand?.name === "run") {
// `./your-app run $ARGS` was executed
const args = matches.subcommand?.matches.args;
if ("debug" in args) {
// `./your-app run --debug` was executed
}
} else {
const args = matches.args;
// `./your-app $ARGS` was executed
}
```
## Contributing

@ -1,6 +1,6 @@
![plugin-clipboard](banner.jpg)
# Clipboard
<!-- description -->
Read and write to the system clipboard.
## Install
@ -18,6 +18,8 @@ Install the Core plugin by adding the following to your `Cargo.toml` file:
```toml
[dependencies]
tauri-plugin-clipboard = "2.0.0-alpha"
# alternatively with Git:
tauri-plugin-clipboard = { 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-clipboard
# or
npm add @tauri-apps/plugin-clipboard
# or
yarn add @tauri-apps/plugin-clipboard
# alternatively with Git:
pnpm add https://github.com/tauri-apps/tauri-plugin-clipboard#v2
# or
npm add https://github.com/tauri-apps/tauri-plugin-clipboard#v2
@ -51,7 +60,9 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript
import { writeText, readText } from "@tauri-apps/plugin-clipboard";
await writeText("Tauri is awesome!");
assert(await readText(), "Tauri is awesome!");
```
## Contributing

@ -5,22 +5,6 @@
/**
* Read and write to the system clipboard.
*
* The APIs must be added to [`tauri.allowlist.clipboard`](https://tauri.app/v1/api/config/#allowlistconfig.clipboard) in `tauri.conf.json`:
* ```json
* {
* "tauri": {
* "allowlist": {
* "clipboard": {
* "all": true, // enable all Clipboard APIs
* "writeText": true,
* "readText": true
* }
* }
* }
* }
* ```
* It is recommended to allowlist only the APIs you use for optimal bundle size and security.
*
* @module
*/

@ -1,6 +1,6 @@
![Dialog](banner.jpg)
# Dialog
<!-- description -->
Native system dialogs for opening and saving files along with message dialogs.
## Install
@ -18,6 +18,8 @@ Install the Core plugin by adding the following to your `Cargo.toml` file:
```toml
[dependencies]
tauri-plugin-dialog = "2.0.0-alpha"
# alternatively with Git:
tauri-plugin-dialog = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
```
@ -31,6 +33,13 @@ pnpm add @tauri-apps/plugin-dialog
npm add @tauri-apps/plugin-dialog
# or
yarn add @tauri-apps/plugin-dialog
# alternatively with Git:
pnpm add https://github.com/tauri-apps/tauri-plugin-dialog#v2
# or
npm add https://github.com/tauri-apps/tauri-plugin-dialog#v2
# or
yarn add https://github.com/tauri-apps/tauri-plugin-dialog#v2
```
## Usage

@ -113,11 +113,11 @@ async function open(
/**
* Open a file/directory selection dialog.
*
* The selected paths are added to the filesystem and asset protocol allowlist scopes.
* The selected paths are added to the filesystem and asset protocol scopes.
* When security is more important than the easy of use of this API,
* prefer writing a dedicated command instead.
*
* Note that the allowlist scope change is not persisted, so the values are cleared when the application is restarted.
* Note that the scope change is not persisted, so the values are cleared when the application is restarted.
* You can save it to the filesystem using [tauri-plugin-persisted-scope](https://github.com/tauri-apps/tauri-plugin-persisted-scope).
* @example
* ```typescript
@ -175,11 +175,11 @@ async function open(
/**
* Open a file/directory save dialog.
*
* The selected path is added to the filesystem and asset protocol allowlist scopes.
* The selected path is added to the filesystem and asset protocol scopes.
* When security is more important than the easy of use of this API,
* prefer writing a dedicated command instead.
*
* Note that the allowlist scope change is not persisted, so the values are cleared when the application is restarted.
* Note that the scope change is not persisted, so the values are cleared when the application is restarted.
* You can save it to the filesystem using [tauri-plugin-persisted-scope](https://github.com/tauri-apps/tauri-plugin-persisted-scope).
* @example
* ```typescript

@ -1,4 +1,4 @@
![tauri-plugin-fs](banner.png)
# File System
Access the file system.
@ -18,6 +18,8 @@ Install the Core plugin by adding the following to your `Cargo.toml` file:
```toml
[dependencies]
tauri-plugin-fs = "2.0.0-alpha"
# alternatively with Git:
tauri-plugin-fs = { 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-fs
# or
npm add @tauri-apps/plugin-fs
# or
yarn add @tauri-apps/plugin-fs
# alternatively with Git:
pnpm add https://github.com/tauri-apps/tauri-plugin-fs#v2
# or
npm add https://github.com/tauri-apps/tauri-plugin-fs#v2

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

@ -5,32 +5,6 @@
/**
* Access the file system.
*
* This package is also accessible with `window.__TAURI__.fs` when [`build.withGlobalTauri`](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in `tauri.conf.json` is set to `true`.
*
* The APIs must be added to [`tauri.allowlist.fs`](https://tauri.app/v1/api/config/#allowlistconfig.fs) in `tauri.conf.json`:
* ```json
* {
* "tauri": {
* "allowlist": {
* "fs": {
* "all": true, // enable all FS APIs
* "readFile": true,
* "writeFile": true,
* "readDir": true,
* "copyFile": true,
* "createDir": true,
* "removeDir": true,
* "removeFile": true,
* "renameFile": true,
* "metadata": true,
* "exists": true
* }
* }
* }
* }
* ```
* It is recommended to allowlist only the APIs you use for optimal bundle size and security.
*
* ## Security
*
* This module prevents path traversal, not allowing absolute paths or parent dir components
@ -45,11 +19,9 @@
* *databases* folder of the {@link path.appDataDir | $APPDATA directory}:
* ```json
* {
* "tauri": {
* "allowlist": {
* "fs": {
* "scope": ["$APPDATA/databases/*"]
* }
* "plugins": {
* "fs": {
* "scope": ["$APPDATA/databases/*"]
* }
* }
* }

@ -80,7 +80,7 @@ fn push_pattern<P: AsRef<Path>, F: Fn(&str) -> Result<Pattern, glob::PatternErro
}
impl Scope {
/// Creates a new scope from a `FsAllowlistScope` configuration.
/// Creates a new scope from a `FsScope` configuration.
pub(crate) fn new<R: Runtime, M: Manager<R>>(
manager: &M,
scope: &FsScope,

@ -1,6 +1,8 @@
![plugin-shortcut](banner.jpg)
# Global Shortcut
<!-- description -->
Register global shortcuts.
- Supported platforms: Windows, Linux and macOS.
## Install
@ -17,7 +19,10 @@ Install the Core plugin by adding the following to your `Cargo.toml` file:
`src-tauri/Cargo.toml`
```toml
[dependencies]
# you can add the dependencies on the `[dependencies]` section if you do not target mobile
[target."cfg(not(any(target_os = \"android\", target_os = \"ios\")))".dependencies]
tauri-plugin-global-shortcut = "2.0.0-alpha"
# alternatively with Git:
tauri-plugin-shortcut = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
```
@ -26,11 +31,18 @@ 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 https://github.com/tauri-apps/tauri-plugin-shortcut#v2
pnpm add @tauri-apps/plugin-global-shortcut
# or
npm add @tauri-apps/plugin-global-shortcut
# or
yarn add @tauri-apps/plugin-global-shortcut
# alternatively with Git:
pnpm add https://github.com/tauri-apps/tauri-plugin-global-shortcut#v2
# or
npm add https://github.com/tauri-apps/tauri-plugin-shortcut#v2
npm add https://github.com/tauri-apps/tauri-plugin-global-shortcut#v2
# or
yarn add https://github.com/tauri-apps/tauri-plugin-shortcut#v2
yarn add https://github.com/tauri-apps/tauri-plugin-global-shortcut#v2
```
## Usage
@ -42,7 +54,11 @@ First you need to register the core plugin with Tauri:
```rust
fn main() {
tauri::Builder::default()
.plugin(tauri_plugin_shortcut::init())
.setup(|app| {
#[cfg(desktop)]
app.handle().plugin(tauri_plugin_shortcut::init())?;
Ok(())
})
.run(tauri::generate_context!())
.expect("error while running tauri application");
}

@ -5,19 +5,6 @@
/**
* Register global shortcuts.
*
* The APIs must be added to [`tauri.allowlist.globalShortcut`](https://tauri.app/v1/api/config/#allowlistconfig.globalshortcut) in `tauri.conf.json`:
* ```json
* {
* "tauri": {
* "allowlist": {
* "globalShortcut": {
* "all": true // enable all global shortcut APIs
* }
* }
* }
* }
* ```
* It is recommended to allowlist only the APIs you use for optimal bundle size and security.
* @module
*/

@ -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

@ -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"

@ -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

@ -20,8 +20,10 @@ Install the Core plugin by adding the following to your `Cargo.toml` file:
```toml
[dependencies]
tauri-plugin-localhost = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
portpicker = "0.1" # used in the example to pick a random free port
tauri-plugin-localhost = "2.0.0-alpha"
# alternatively with Git:
tauri-plugin-localhost = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
```
## Usage
@ -31,27 +33,26 @@ First you need to register the core plugin with Tauri:
`src-tauri/src/main.rs`
```rust
use tauri::{utils::config::AppUrl, window::WindowBuilder, WindowUrl};
use tauri::{Manager, window::WindowBuilder, WindowUrl};
fn main() {
let port = portpicker::pick_unused_port().expect("failed to find unused port");
let mut context = tauri::generate_context!();
let url = format!("http://localhost:{}", port).parse().unwrap();
let window_url = WindowUrl::External(url);
// rewrite the config so the IPC is enabled on this URL
context.config_mut().build.dist_dir = AppUrl::Url(window_url.clone());
context.config_mut().build.dev_path = AppUrl::Url(window_url.clone());
tauri::Builder::default()
.plugin(tauri_plugin_localhost::Builder::new(port).build())
.setup(move |app| {
WindowBuilder::new(app, "main".to_string(), window_url)
app.ipc_scope().configure_remote_access(
RemoteDomainAccessScope::new(format!("localhost:{}", port))
.add_window("main")
);
let url = format!("http://localhost:{}", port).parse().unwrap();
WindowBuilder::new(app, "main".to_string(), WindowUrl::External(url))
.title("Localhost Example")
.build()?;
Ok(())
})
.run(context)
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
```

@ -18,6 +18,8 @@ Install the Core plugin by adding the following to your `Cargo.toml` file:
```toml
[dependencies]
tauri-plugin-log = "2.0.0-alpha"
# alternatively with Git:
tauri-plugin-log = { 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-log
# or
npm add @tauri-apps/plugin-log
# or
yarn add @tauri-apps/plugin-log
# alternatively with Git:
pnpm add https://github.com/tauri-apps/tauri-plugin-log#v2
# or
npm add https://github.com/tauri-apps/tauri-plugin-log#v2

@ -1,6 +1,6 @@
![{{plugin name}}](banner.jpg)
# Notification
<!-- description -->
Send message notifications (brief auto-expiring OS window element) to your user. Can also be used with the Notification Web API.
## Install
@ -18,7 +18,9 @@ Install the Core plugin by adding the following to your `Cargo.toml` file:
```toml
[dependencies]
<!-- plugin here --> = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" }
tauri-plugin-notification = "2.0.0-alpha"
# alternatively with Git:
tauri-plugin-notification = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
```
You can install the JavaScript Guest bindings using your preferred JavaScript package manager:
@ -26,11 +28,18 @@ 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 <!-- plugin here -->
pnpm add @tauri-apps/plugin-notification
# or
npm add <!-- plugin here -->
npm add @tauri-apps/plugin-notification
# or
yarn add <!-- plugin here -->
yarn add @tauri-apps/plugin-notification
# alternatively with Git:
pnpm add https://github.com/tauri-apps/tauri-plugin-notification#v2
# or
npm add https://github.com/tauri-apps/tauri-plugin-notification#v2
# or
yarn add https://github.com/tauri-apps/tauri-plugin-notification#v2
```
## Usage
@ -42,7 +51,7 @@ First you need to register the core plugin with Tauri:
```rust
fn main() {
tauri::Builder::default()
.plugin(<!-- plugin here -->)
.plugin(tauri_plugin_notification::init())
.run(tauri::generate_context!())
.expect("error while running tauri application");
}

@ -6,21 +6,6 @@
* Send toast notifications (brief auto-expiring OS window element) to your user.
* Can also be used with the Notification Web API.
*
* This package is also accessible with `window.__TAURI__.notification` when [`build.withGlobalTauri`](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in `tauri.conf.json` is set to `true`.
*
* The APIs must be added to [`tauri.allowlist.notification`](https://tauri.app/v1/api/config/#allowlistconfig.notification) in `tauri.conf.json`:
* ```json
* {
* "tauri": {
* "allowlist": {
* "notification": {
* "all": true // enable all notification APIs
* }
* }
* }
* }
* ```
* It is recommended to allowlist only the APIs you use for optimal bundle size and security.
* @module
*/

@ -1,4 +1,4 @@
# Operating system plugin
# Operating System
Read information about the operating system.
@ -18,6 +18,8 @@ Install the Core plugin by adding the following to your `Cargo.toml` file:
```toml
[dependencies]
tauri-plugin-os = "2.0.0-alpha"
# alternatively with Git:
tauri-plugin-os = { 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-os
# or
npm add @tauri-apps/plugin-os
# or
yarn add @tauri-apps/plugin-os
# alternatively with Git:
pnpm add https://github.com/tauri-apps/tauri-plugin-os#v2
# or
npm add https://github.com/tauri-apps/tauri-plugin-os#v2
@ -51,7 +60,8 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript
import * as os from "@tauri-apps/plugin-os";
import { version } from "@tauri-apps/plugin-os";
const osVersion = await version();
```
## Contributing

@ -5,19 +5,6 @@
/**
* Provides operating system-related utility methods and properties.
*
* The APIs must be added to [`tauri.allowlist.os`](https://tauri.app/v1/api/config/#allowlistconfig.os) in `tauri.conf.json`:
* ```json
* {
* "tauri": {
* "allowlist": {
* "os": {
* "all": true, // enable all Os APIs
* }
* }
* }
* }
* ```
* It is recommended to allowlist only the APIs you use for optimal bundle size and security.
* @module
*/

@ -18,6 +18,8 @@ Install the Core plugin by adding the following to your `Cargo.toml` file:
```toml
[dependencies]
tauri-plugin-persisted-scope = "2.0.0-alpha"
# alternatively with Git:
tauri-plugin-persisted-scope = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
```

@ -20,8 +20,8 @@ Install the Core plugin by adding the following to your `Cargo.toml` file:
```toml
[dependencies]
tauri-plugin-positioner = "1.0"
# or through git
tauri-plugin-positioner = "2.0.0-alpha"
# alternatively with Git:
tauri-plugin-positioner = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
```
@ -35,11 +35,8 @@ pnpm add @tauri-apps/plugin-positioner
npm add @tauri-apps/plugin-positioner
# or
yarn add @tauri-apps/plugin-positioner
```
Or through git:
```sh
# alternatively with Git:
pnpm add https://github.com/tauri-apps/tauri-plugin-positioner#v2
# or
npm add https://github.com/tauri-apps/tauri-plugin-positioner#v2

@ -1,4 +1,4 @@
# Process plugin
# Process
This plugin provides APIs to access the current process. To spawn child processes, see the [`shell`](https://github.com/tauri-apps/tauri-plugin-shell) plugin.
@ -18,6 +18,8 @@ Install the Core plugin by adding the following to your `Cargo.toml` file:
```toml
[dependencies]
tauri-plugin-process = "2.0.0-alpha"
# alternatively with Git:
tauri-plugin-process = { 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-process
# or
npm add @tauri-apps/plugin-process
# or
yarn add @tauri-apps/plugin-process
# alternatively with Git:
pnpm add https://github.com/tauri-apps/tauri-plugin-process#v2
# or
npm add https://github.com/tauri-apps/tauri-plugin-process#v2
@ -51,7 +60,11 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript
import * as process from "@tauri-apps/plugin-process";
import { exit, relaunch } from "@tauri-apps/plugin-process";
// exit the app with the given status code
await exit(0);
// restart the app
await relaunch();
```
## Contributing

@ -1,6 +1,6 @@
![plugin-shell](banner.jpg)
# Shell
<!-- description -->
Access the system shell. Allows you to spawn child processes and manage files and URLs using their default application.
## Install
@ -18,6 +18,8 @@ Install the Core plugin by adding the following to your `Cargo.toml` file:
```toml
[dependencies]
tauri-plugin-shell = "2.0.0-alpha"
# alternatively with Git:
tauri-plugin-shell = { 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-shell
# or
npm add @tauri-apps/plugin-shell
# or
yarn add @tauri-apps/plugin-shell
# alternatively with Git:
pnpm add https://github.com/tauri-apps/tauri-plugin-shell#v2
# or
npm add https://github.com/tauri-apps/tauri-plugin-shell#v2
@ -51,7 +60,8 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript
import { Command } from "@tauri-apps/plugin-shell";
Command.create("git", ["commit", "-m", "the commit message"]);
```
## Contributing

@ -6,36 +6,19 @@
* Access the system shell.
* Allows you to spawn child processes and manage files and URLs using their default application.
*
* The APIs must be added to [`tauri.allowlist.shell`](https://tauri.app/v1/api/config/#allowlistconfig.shell) in `tauri.conf.json`:
* ```json
* {
* "tauri": {
* "allowlist": {
* "shell": {
* "all": true, // enable all shell APIs
* "execute": true, // enable process spawn APIs
* "sidecar": true, // enable spawning sidecars
* "open": true // enable opening files/URLs using the default program
* }
* }
* }
* }
* ```
* 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 programs and arguments that can be used.
*
* ### Restricting access to the {@link open | `open`} API
*
* On the allowlist, `open: true` means that the {@link open} API can be used with any URL,
* On the configuration object, `open: true` means that the {@link open} API can be used with any URL,
* as the argument is validated with the `^((mailto:\w+)|(tel:\w+)|(https?://\w+)).+` regex.
* You can change that regex by changing the boolean value to a string, e.g. `open: ^https://github.com/`.
*
* ### Restricting access to the {@link Command | `Command`} APIs
*
* The `shell` allowlist object has a `scope` field that defines an array of CLIs that can be used.
* The plugin configuration object has a `scope` field that defines an array of CLIs that can be used.
* Each CLI is a configuration object `{ name: string, cmd: string, sidecar?: bool, args?: boolean | Arg[] }`.
*
* - `name`: the unique identifier of the command, passed to the {@link Command.create | Command.create function}.
@ -55,13 +38,17 @@
* Configuration:
* ```json
* {
* "scope": [
* {
* "name": "run-git-commit",
* "cmd": "git",
* "args": ["commit", "-m", { "validator": "\\S+" }]
* "plugins": {
* "shell": {
* "scope": [
* {
* "name": "run-git-commit",
* "cmd": "git",
* "args": ["commit", "-m", { "validator": "\\S+" }]
* }
* ]
* }
* ]
* }
* }
* ```
* Usage:
@ -425,7 +412,7 @@ class Command<O extends IOPayload> extends EventEmitter<CommandEvents> {
* Creates a new `Command` instance.
*
* @param program The program name to execute.
* It must be configured on `tauri.conf.json > tauri > allowlist > shell > scope`.
* It must be configured on `tauri.conf.json > plugins > shell > scope`.
* @param args Program arguments.
* @param options Spawn options.
*/
@ -462,7 +449,7 @@ class Command<O extends IOPayload> extends EventEmitter<CommandEvents> {
* ```
*
* @param program The program to execute.
* It must be configured on `tauri.conf.json > tauri > allowlist > shell > scope`.
* It must be configured on `tauri.conf.json > plugins > shell > scope`.
*/
static create<O extends IOPayload>(
program: string,
@ -494,7 +481,7 @@ class Command<O extends IOPayload> extends EventEmitter<CommandEvents> {
* ```
*
* @param program The program to execute.
* It must be configured on `tauri.conf.json > tauri > allowlist > shell > scope`.
* It must be configured on `tauri.conf.json > plugins > shell > scope`.
*/
static sidecar<O extends IOPayload>(
program: string,
@ -634,7 +621,7 @@ type CommandEvent<O extends IOPayload> =
* ```
*
* @param path The path or URL to open.
* This value is matched against the string regex defined on `tauri.conf.json > tauri > allowlist > shell > open`,
* This value is matched against the string regex defined on `tauri.conf.json > plugins > shell > open`,
* which defaults to `^((mailto:\w+)|(tel:\w+)|(https?://\w+)).+`.
* @param openWith The app to open the file or URL with.
* Defaults to the system default application for the specified path type.

@ -2,9 +2,7 @@ use std::path::PathBuf;
use serde::{de::Error as DeError, Deserialize, Deserializer};
/// Allowlist for the shell APIs.
///
/// See more: https://tauri.app/v1/api/config#shellallowlistconfig
/// Configuration for the shell plugin.
#[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize)]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
pub struct Config {

@ -104,7 +104,7 @@ impl Program {
/// Opens path or URL with the program specified in `with`, or system default if `None`.
///
/// The path will be matched against the shell open validation regex, defaulting to `^((mailto:\w+)|(tel:\w+)|(https?://\w+)).+`.
/// A custom validation regex may be supplied in the config in `tauri > allowlist > scope > open`.
/// A custom validation regex may be supplied in the config in `plugins > shell > scope > open`.
///
/// # Examples
///

@ -248,7 +248,7 @@ impl Scope {
/// Open a path in the default (or specified) browser.
///
/// The path is validated against the `tauri > allowlist > shell > open` validation regex, which
/// The path is validated against the `plugins > shell > open` validation regex, which
/// defaults to `^((mailto:\w+)|(tel:\w+)|(https?://\w+)).+`.
pub fn open(&self, path: &str, with: Option<Program>) -> Result<(), Error> {
// ensure we pass validation if the configuration has one

@ -18,6 +18,8 @@ Install the Core plugin by adding the following to your `Cargo.toml` file:
```toml
[dependencies]
tauri-plugin-single-instance = "2.0.0-alpha"
# alternatively with Git:
tauri-plugin-single-instance = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
```

@ -18,9 +18,11 @@ Install the Core plugin by adding the following to your `Cargo.toml` file:
```toml
[dependencies.tauri-plugin-sql]
features = ["sqlite"] # or "postgres", or "mysql"
version = "2.0.0-alpha"
# alternatively with Git
git = "https://github.com/tauri-apps/plugins-workspace"
branch = "v2"
features = ["sqlite"] # or "postgres", or "mysql"
```
You can install the JavaScript Guest bindings using your preferred JavaScript package manager:
@ -28,6 +30,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-sql
# or
npm add @tauri-apps/plugin-sql
# or
yarn add @tauri-apps/plugin-sql
# alternatively with Git:
pnpm add https://github.com/tauri-apps/tauri-plugin-sql#v2
# or
npm add https://github.com/tauri-apps/tauri-plugin-sql#v2

@ -18,6 +18,8 @@ Install the Core plugin by adding the following to your `Cargo.toml` file:
```toml
[dependencies]
tauri-plugin-store = "2.0.0-alpha"
# alternatively with Git:
tauri-plugin-store = { 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-store
# or
npm add @tauri-apps/plugin-store
# or
yarn add @tauri-apps/plugin-store
# alternatively with Git:
pnpm add https://github.com/tauri-apps/tauri-plugin-store#v2
# or
npm add https://github.com/tauri-apps/tauri-plugin-store#v2

@ -18,6 +18,8 @@ Install the Core plugin by adding the following to your `Cargo.toml` file:
```toml
[dependencies]
tauri-plugin-stronghold = "2.0.0-alpha"
# alternatively with Git:
tauri-plugin-stronghold = { 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-stronghold
# or
npm add @tauri-apps/plugin-stronghold
# or
yarn add @tauri-apps/plugin-stronghold
# alternatively with Git:
pnpm add https://github.com/tauri-apps/tauri-plugin-stronghold#v2
# or
npm add https://github.com/tauri-apps/tauri-plugin-stronghold#v2

@ -1,7 +1,9 @@
# Updater plugin
# Updater
In-app updates for Tauri applications.
- Supported platforms: Windows, Linux and macOS.
## Install
_This plugin requires a Rust version of at least **1.65**_
@ -17,7 +19,10 @@ Install the Core plugin by adding the following to your `Cargo.toml` file:
`src-tauri/Cargo.toml`
```toml
[dependencies]
# you can add the dependencies on the `[dependencies]` section if you do not target mobile
[target."cfg(not(any(target_os = \"android\", target_os = \"ios\")))".dependencies]
tauri-plugin-updater = "2.0.0-alpha"
# alternatively with Git:
tauri-plugin-updater = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
```
@ -26,6 +31,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-updater
# or
npm add @tauri-apps/plugin-updater
# or
yarn add @tauri-apps/plugin-updater
# alternatively with Git:
pnpm add https://github.com/tauri-apps/tauri-plugin-updater#v2
# or
npm add https://github.com/tauri-apps/tauri-plugin-updater#v2
@ -42,7 +54,11 @@ First you need to register the core plugin with Tauri:
```rust
fn main() {
tauri::Builder::default()
.plugin(tauri_plugin_updater::Builder::new().build())
.setup(|app| {
#[cfg(desktop)]
app.handle().plugin(tauri_plugin_updater::Builder::new().build())?;
Ok(())
})
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
@ -51,7 +67,13 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript
import * as updater from "@tauri-apps/plugin-updater";
import { check } from "@tauri-apps/plugin-updater";
import { relaunch } from "@tauri-apps/plugin-process";
const update = await check();
if (update.response.available) {
await update.downloadAndInstall();
await relaunch();
}
```
## Contributing

@ -18,6 +18,8 @@ Install the Core plugin by adding the following to your `Cargo.toml` file:
```toml
[dependencies]
tauri-plugin-upload = "2.0.0-alpha"
# alternatively with Git:
tauri-plugin-upload = { 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-upload
# or
npm add @tauri-apps/plugin-upload
# or
yarn add @tauri-apps/plugin-upload
# alternatively with Git:
pnpm add https://github.com/tauri-apps/tauri-plugin-upload#v2
# or
npm add https://github.com/tauri-apps/tauri-plugin-upload#v2

@ -1,6 +1,6 @@
![plugin-websocket](banner.png)
<!-- description -->
Expose a WebSocket server to your Tauri frontend.
## Install
@ -18,6 +18,8 @@ Install the Core plugin by adding the following to your `Cargo.toml` file:
```toml
[dependencies]
tauri-plugin-websocket = "2.0.0-alpha"
# alternatively with Git:
tauri-plugin-websocket = { 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-websocket
# or
npm add @tauri-apps/plugin-websocket
# or
yarn add @tauri-apps/plugin-websocket
# alternatively with Git:
pnpm add https://github.com/tauri-apps/tauri-plugin-websocket#v2
# or
npm add https://github.com/tauri-apps/tauri-plugin-websocket#v2

@ -18,6 +18,8 @@ Install the Core plugin by adding the following to your `Cargo.toml` file:
```toml
[dependencies]
tauri-plugin-window-state = "2.0.0-alpha"
# alternatively with Git:
tauri-plugin-window-state = { 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-window-state
# or
npm add @tauri-apps/plugin-window-state
# or
yarn add @tauri-apps/plugin-window-state
# alternatively with Git:
pnpm add https://github.com/tauri-apps/tauri-plugin-window-state#v2
# or
npm add https://github.com/tauri-apps/tauri-plugin-window-state#v2

@ -1,4 +1,4 @@
# Window plugin
# Window
Interact with the Tauri window.
@ -18,6 +18,8 @@ Install the Core plugin by adding the following to your `Cargo.toml` file:
```toml
[dependencies]
tauri-plugin-window = "2.0.0-alpha"
# alternatively with Git:
tauri-plugin-window = { 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-window
# or
npm add @tauri-apps/plugin-window
# or
yarn add @tauri-apps/plugin-window
# alternatively with Git:
pnpm add https://github.com/tauri-apps/tauri-plugin-window#v2
# or
npm add https://github.com/tauri-apps/tauri-plugin-window#v2
@ -51,7 +60,20 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript
import * as tauriWindow from "@tauri-apps/plugin-window";
import { appWindow, WebviewWindow } from "@tauri-apps/plugin-window";
// manipulating this window
await appWindow.setResizable(false);
// Creating new windows:
// loading embedded asset:
const webview = new WebviewWindow("theUniqueLabel", {
url: "path/to/page.html",
});
// alternatively, load a remote URL:
const webview = new WebviewWindow("theUniqueLabel", {
url: "https://github.com/tauri-apps/tauri",
});
```
## Contributing

@ -5,51 +5,6 @@
/**
* Provides APIs to create windows, communicate with other windows and manipulate the current window.
*
* The APIs must be added to [`tauri.allowlist.window`](https://tauri.app/v1/api/config/#allowlistconfig.window) in `tauri.conf.json`:
* ```json
* {
* "tauri": {
* "allowlist": {
* "window": {
* "all": true, // enable all window APIs
* "create": true, // enable window creation
* "center": true,
* "requestUserAttention": true,
* "setResizable": true,
* "setTitle": true,
* "maximize": true,
* "unmaximize": true,
* "minimize": true,
* "unminimize": true,
* "show": true,
* "hide": true,
* "close": true,
* "setDecorations": true,
* "setShadow": true,
* "setAlwaysOnTop": true,
* "setContentProtected": true,
* "setSize": true,
* "setMinSize": true,
* "setMaxSize": true,
* "setPosition": true,
* "setFullscreen": true,
* "setFocus": true,
* "setIcon": true,
* "setSkipTaskbar": true,
* "setCursorGrab": true,
* "setCursorVisible": true,
* "setCursorIcon": true,
* "setCursorPosition": true,
* "setIgnoreCursorEvents": true,
* "startDragging": true,
* "print": true
* }
* }
* }
* }
* ```
* It is recommended to allowlist only the APIs you use for optimal bundle size and security.
*
* ## Window events
*
* Events can be listened to using `appWindow.listen`:

@ -1,4 +1,4 @@
![{{plugin name}}](banner.jpg)
![{{plugin-name}}](banner.png)
<!-- description -->
@ -18,7 +18,9 @@ Install the Core plugin by adding the following to your `Cargo.toml` file:
```toml
[dependencies]
<!-- plugin here --> = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
tauri-plugin-{{plugin-name}} = "2.0.0-alpha"
# alternatively with Git:
tauri-plugin-{{plugin-name}} = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
```
You can install the JavaScript Guest bindings using your preferred JavaScript package manager:
@ -26,11 +28,18 @@ 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 <!-- plugin here -->
pnpm add @tauri-apps/plugin-{{plugin-name}}
# or
npm add <!-- plugin here -->
npm add @tauri-apps/plugin-{{plugin-name}}
# or
yarn add <!-- plugin here -->
yarn add @tauri-apps/plugin-{{plugin-name}}
# alternatively with Git:
pnpm add https://github.com/tauri-apps/tauri-plugin-{{plugin-name}}#v2
# or
npm add https://github.com/tauri-apps/tauri-plugin-{{plugin-name}}#v2
# or
yarn add https://github.com/tauri-apps/tauri-plugin-{{plugin-name}}#v2
```
## Usage
@ -42,7 +51,7 @@ First you need to register the core plugin with Tauri:
```rust
fn main() {
tauri::Builder::default()
.plugin(<!-- plugin here -->)
.plugin(tauri_plugin_{{plugin-name}}::init())
.run(tauri::generate_context!())
.expect("error while running tauri application");
}

Loading…
Cancel
Save