pull/60/head
Jonas Kruckenberg 2 years ago
parent b7325b5d1d
commit a2f0e2eb73

@ -13,6 +13,7 @@ There are three general methods of installation that we can recommend.
Install the Core plugin by adding the following to your `Cargo.toml` file: Install the Core plugin by adding the following to your `Cargo.toml` file:
`src-tauri/Cargo.toml` `src-tauri/Cargo.toml`
```toml ```toml
[dependencies] [dependencies]
tauri-plugin-authenticator = "0.1" tauri-plugin-authenticator = "0.1"
@ -28,7 +29,7 @@ You can install the JavaScript Guest bindings using your preferred JavaScript pa
pnpm add https://github.com/tauri-apps/tauri-plugin-authenticator pnpm add https://github.com/tauri-apps/tauri-plugin-authenticator
# or # or
npm add https://github.com/tauri-apps/tauri-plugin-authenticator npm add https://github.com/tauri-apps/tauri-plugin-authenticator
# or # or
yarn add https://github.com/tauri-apps/tauri-plugin-authenticator yarn add https://github.com/tauri-apps/tauri-plugin-authenticator
``` ```
@ -37,6 +38,7 @@ yarn add https://github.com/tauri-apps/tauri-plugin-authenticator
First you need to register the core plugin with Tauri: First you need to register the core plugin with Tauri:
`src-tauri/src/main.rs` `src-tauri/src/main.rs`
```rust ```rust
fn main() { fn main() {
tauri::Builder::default() tauri::Builder::default()
@ -49,37 +51,49 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings: Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript ```javascript
import { Authenticator } from 'tauri-plugin-authenticator-api' import { Authenticator } from "tauri-plugin-authenticator-api";
const auth = new Authenticator() const auth = new Authenticator();
auth.init() // initialize transports auth.init(); // initialize transports
// generate a 32-bytes long random challenge // generate a 32-bytes long random challenge
const arr = new Uint32Array(32) const arr = new Uint32Array(32);
window.crypto.getRandomValues(arr) window.crypto.getRandomValues(arr);
const b64 = btoa(String.fromCharCode.apply(null, arr)) const b64 = btoa(String.fromCharCode.apply(null, arr));
// web-safe base64 // web-safe base64
const challenge = b64.replace(/\+/g, '-').replace(/\//g, '_') const challenge = b64.replace(/\+/g, "-").replace(/\//g, "_");
const domain = 'https://tauri.app' const domain = "https://tauri.app";
// attempt to register with the security key // attempt to register with the security key
const json = await auth.register(challenge, domain) const json = await auth.register(challenge, domain);
const registerResult = JSON.parse(json) const registerResult = JSON.parse(json);
// verify te registration was successfull // verify te registration was successfull
const r2 = await auth.verifyRegistration(challenge, app, registerResult.registerData, registerResult.clientData) const r2 = await auth.verifyRegistration(
const j2 = JSON.parse(r2) challenge,
app,
registerResult.registerData,
registerResult.clientData
);
const j2 = JSON.parse(r2);
// sign some data // sign some data
const json = await auth.sign(challenge, app, keyHandle) const json = await auth.sign(challenge, app, keyHandle);
const signData = JSON.parse(json) const signData = JSON.parse(json);
// verify the signature again // verify the signature again
const counter = await auth.verifySignature(challenge, app, signData.signData, clientData, keyHandle, pubkey) const counter = await auth.verifySignature(
challenge,
if(counter && counter>0) { app,
console.log('SUCCESS!') signData.signData,
clientData,
keyHandle,
pubkey
);
if (counter && counter > 0) {
console.log("SUCCESS!");
} }
``` ```

@ -13,6 +13,7 @@ There are three general methods of installation that we can recommend.
Install the Core plugin by adding the following to your `Cargo.toml` file: Install the Core plugin by adding the following to your `Cargo.toml` file:
`src-tauri/Cargo.toml` `src-tauri/Cargo.toml`
```toml ```toml
[dependencies] [dependencies]
tauri-plugin-autostart = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" } tauri-plugin-autostart = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" }
@ -26,7 +27,7 @@ You can install the JavaScript Guest bindings using your preferred JavaScript pa
pnpm add https://github.com/tauri-apps/tauri-plugin-autostart pnpm add https://github.com/tauri-apps/tauri-plugin-autostart
# or # or
npm add https://github.com/tauri-apps/tauri-plugin-autostart npm add https://github.com/tauri-apps/tauri-plugin-autostart
# or # or
yarn add https://github.com/tauri-apps/tauri-plugin-autostart yarn add https://github.com/tauri-apps/tauri-plugin-autostart
``` ```
@ -35,6 +36,7 @@ yarn add https://github.com/tauri-apps/tauri-plugin-autostart
First you need to register the core plugin with Tauri: First you need to register the core plugin with Tauri:
`src-tauri/src/main.rs` `src-tauri/src/main.rs`
```rust ```rust
fn main() { fn main() {
tauri::Builder::default() tauri::Builder::default()
@ -47,13 +49,13 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings: Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript ```javascript
import { enable, isEnabled, disable } from 'tauri-plugin-autostart-api' import { enable, isEnabled, disable } from "tauri-plugin-autostart-api";
await enable() await enable();
console.log(`registered for autostart? ${await isEnabled()}`) console.log(`registered for autostart? ${await isEnabled()}`);
disable() disable();
``` ```
## Contributing ## Contributing

@ -13,6 +13,7 @@ There are three general methods of installation that we can recommend.
Install the Core plugin by adding the following to your `Cargo.toml` file: Install the Core plugin by adding the following to your `Cargo.toml` file:
`src-tauri/Cargo.toml` `src-tauri/Cargo.toml`
```toml ```toml
[dependencies] [dependencies]
tauri-plugin-fs-extra = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" } tauri-plugin-fs-extra = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" }
@ -26,7 +27,7 @@ You can install the JavaScript Guest bindings using your preferred JavaScript pa
pnpm add https://github.com/tauri-apps/tauri-plugin-fs-extra pnpm add https://github.com/tauri-apps/tauri-plugin-fs-extra
# or # or
npm add https://github.com/tauri-apps/tauri-plugin-fs-extra npm add https://github.com/tauri-apps/tauri-plugin-fs-extra
# or # or
yarn add https://github.com/tauri-apps/tauri-plugin-fs-extra yarn add https://github.com/tauri-apps/tauri-plugin-fs-extra
``` ```
@ -35,6 +36,7 @@ yarn add https://github.com/tauri-apps/tauri-plugin-fs-extra
First you need to register the core plugin with Tauri: First you need to register the core plugin with Tauri:
`src-tauri/src/main.rs` `src-tauri/src/main.rs`
```rust ```rust
fn main() { fn main() {
tauri::Builder::default() tauri::Builder::default()
@ -47,9 +49,9 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings: Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript ```javascript
import { metadata } from 'tauri-plugin-fs-extra-api' import { metadata } from "tauri-plugin-fs-extra-api";
await metadata('/path/to/file') await metadata("/path/to/file");
``` ```
## Contributing ## Contributing
@ -60,4 +62,4 @@ PRs accepted. Please make sure to read the Contributing Guide before making a pu
Code: (c) 2015 - Present - The Tauri Programme within The Commons Conservancy. Code: (c) 2015 - Present - The Tauri Programme within The Commons Conservancy.
MIT or MIT/Apache 2.0 where applicable. MIT or MIT/Apache 2.0 where applicable.

@ -13,6 +13,7 @@ There are three general methods of installation that we can recommend.
Install the Core plugin by adding the following to your `Cargo.toml` file: Install the Core plugin by adding the following to your `Cargo.toml` file:
`src-tauri/Cargo.toml` `src-tauri/Cargo.toml`
```toml ```toml
[dependencies] [dependencies]
tauri-plugin-fs-watch = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" } tauri-plugin-fs-watch = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" }
@ -26,7 +27,7 @@ You can install the JavaScript Guest bindings using your preferred JavaScript pa
pnpm add https://github.com/tauri-apps/tauri-plugin-fs-watch pnpm add https://github.com/tauri-apps/tauri-plugin-fs-watch
# or # or
npm add https://github.com/tauri-apps/tauri-plugin-fs-watch npm add https://github.com/tauri-apps/tauri-plugin-fs-watch
# or # or
yarn add https://github.com/tauri-apps/tauri-plugin-fs-watch yarn add https://github.com/tauri-apps/tauri-plugin-fs-watch
``` ```
@ -35,6 +36,7 @@ yarn add https://github.com/tauri-apps/tauri-plugin-fs-watch
First you need to register the core plugin with Tauri: First you need to register the core plugin with Tauri:
`src-tauri/src/main.rs` `src-tauri/src/main.rs`
```rust ```rust
fn main() { fn main() {
tauri::Builder::default() tauri::Builder::default()
@ -47,16 +49,24 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings: Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript ```javascript
import { watch, watchImmediate } from 'tauri-plugin-fs-watch-api' import { watch, watchImmediate } from "tauri-plugin-fs-watch-api";
// can also watch an array of paths // can also watch an array of paths
const stopWatching = await watch('/path/to/something', { recursive: true }, event => { const stopWatching = await watch(
const { type, payload } = event "/path/to/something",
}) { recursive: true },
(event) => {
const stopRawWatcher = await watchImmediate(['/path/a', '/path/b'], {}, event => { const { type, payload } = event;
const { path, operation, cookie } = event }
}) );
const stopRawWatcher = await watchImmediate(
["/path/a", "/path/b"],
{},
(event) => {
const { path, operation, cookie } = event;
}
);
``` ```
## Contributing ## Contributing

@ -15,6 +15,7 @@ There are three general methods of installation that we can recommend.
Install the Core plugin by adding the following to your `Cargo.toml` file: Install the Core plugin by adding the following to your `Cargo.toml` file:
`src-tauri/Cargo.toml` `src-tauri/Cargo.toml`
```toml ```toml
[dependencies] [dependencies]
tauri-plugin-localhost = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" } tauri-plugin-localhost = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" }
@ -26,6 +27,7 @@ portpicker = "0.1" # used in the example to pick a random free port
First you need to register the core plugin with Tauri: First you need to register the core plugin with Tauri:
`src-tauri/src/main.rs` `src-tauri/src/main.rs`
```rust ```rust
use tauri::{utils::config::AppUrl, window::WindowBuilder, WindowUrl}; use tauri::{utils::config::AppUrl, window::WindowBuilder, WindowUrl};

@ -13,6 +13,7 @@ There are three general methods of installation that we can recommend.
Install the Core plugin by adding the following to your `Cargo.toml` file: Install the Core plugin by adding the following to your `Cargo.toml` file:
`src-tauri/Cargo.toml` `src-tauri/Cargo.toml`
```toml ```toml
[dependencies] [dependencies]
tauri-plugin-log = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" } tauri-plugin-log = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" }
@ -26,7 +27,7 @@ You can install the JavaScript Guest bindings using your preferred JavaScript pa
pnpm add https://github.com/tauri-apps/tauri-plugin-log pnpm add https://github.com/tauri-apps/tauri-plugin-log
# or # or
npm add https://github.com/tauri-apps/tauri-plugin-log npm add https://github.com/tauri-apps/tauri-plugin-log
# or # or
yarn add https://github.com/tauri-apps/tauri-plugin-log yarn add https://github.com/tauri-apps/tauri-plugin-log
``` ```
@ -35,6 +36,7 @@ yarn add https://github.com/tauri-apps/tauri-plugin-log
First you need to register the core plugin with Tauri: First you need to register the core plugin with Tauri:
`src-tauri/src/main.rs` `src-tauri/src/main.rs`
```rust ```rust
use tauri_plugin_log::{LogTarget}; use tauri_plugin_log::{LogTarget};
@ -53,17 +55,17 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings: Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript ```javascript
import { trace, info, error, attachConsole } from 'tauri-plugin-log-api' import { trace, info, error, attachConsole } from "tauri-plugin-log-api";
// with LogTarget::Webview enabled this function will print logs to the browser console // with LogTarget::Webview enabled this function will print logs to the browser console
const detach = await attachConsole() const detach = await attachConsole();
trace("Trace") trace("Trace");
info("Info") info("Info");
error("Error") error("Error");
// detach the browser console from the log stream // detach the browser console from the log stream
detach() detach();
``` ```
To log from rust code, add the log crate to your `Cargo.toml`: To log from rust code, add the log crate to your `Cargo.toml`:

@ -13,6 +13,7 @@ There are three general methods of installation that we can recommend.
Install the Core plugin by adding the following to your `Cargo.toml` file: Install the Core plugin by adding the following to your `Cargo.toml` file:
`src-tauri/Cargo.toml` `src-tauri/Cargo.toml`
```toml ```toml
[dependencies] [dependencies]
tauri-plugin-persisted-scope = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" } tauri-plugin-persisted-scope = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" }
@ -23,6 +24,7 @@ tauri-plugin-persisted-scope = { git = "https://github.com/tauri-apps/plugins-wo
First you need to register the core plugin with Tauri: First you need to register the core plugin with Tauri:
`src-tauri/src/main.rs` `src-tauri/src/main.rs`
```rust ```rust
fn main() { fn main() {
tauri::Builder::default() tauri::Builder::default()

@ -15,6 +15,7 @@ There are three general methods of installation that we can recommend.
Install the Core plugin by adding the following to your `Cargo.toml` file: Install the Core plugin by adding the following to your `Cargo.toml` file:
`src-tauri/Cargo.toml` `src-tauri/Cargo.toml`
```toml ```toml
[dependencies] [dependencies]
tauri-plugin-positioner = "1.0" tauri-plugin-positioner = "1.0"
@ -30,7 +31,7 @@ You can install the JavaScript Guest bindings using your preferred JavaScript pa
pnpm add tauri-plugin-positioner pnpm add tauri-plugin-positioner
# or # or
npm add tauri-plugin-positioner npm add tauri-plugin-positioner
# or # or
yarn add tauri-plugin-positioner yarn add tauri-plugin-positioner
``` ```
@ -40,7 +41,7 @@ Or through git:
pnpm add https://github.com/tauri-apps/tauri-plugin-positioner pnpm add https://github.com/tauri-apps/tauri-plugin-positioner
# or # or
npm add https://github.com/tauri-apps/tauri-plugin-positioner npm add https://github.com/tauri-apps/tauri-plugin-positioner
# or # or
yarn add https://github.com/tauri-apps/tauri-plugin-positioner yarn add https://github.com/tauri-apps/tauri-plugin-positioner
``` ```
@ -49,6 +50,7 @@ yarn add https://github.com/tauri-apps/tauri-plugin-positioner
First you need to register the core plugin with Tauri: First you need to register the core plugin with Tauri:
`src-tauri/src/main.rs` `src-tauri/src/main.rs`
```rust ```rust
fn main() { fn main() {
tauri::Builder::default() tauri::Builder::default()
@ -65,9 +67,9 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings: Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript ```javascript
import { move_window, Position } from 'tauri-plugin-positioner-api' import { move_window, Position } from "tauri-plugin-positioner-api";
move_window(Position.TopRight) move_window(Position.TopRight);
``` ```
If you only intend on moving the window from rust code, you can import the Window trait extension instead of registering the plugin: If you only intend on moving the window from rust code, you can import the Window trait extension instead of registering the plugin:
@ -88,4 +90,3 @@ PRs accepted. Please make sure to read the Contributing Guide before making a pu
Code: (c) 2021 - Jonas Kruckenberg. 2021 - Present - The Tauri Programme within The Commons Conservancy. Code: (c) 2021 - Jonas Kruckenberg. 2021 - Present - The Tauri Programme within The Commons Conservancy.
MIT or MIT/Apache 2.0 where applicable. MIT or MIT/Apache 2.0 where applicable.

@ -13,6 +13,7 @@ There are three general methods of installation that we can recommend.
Install the Core plugin by adding the following to your `Cargo.toml` file: Install the Core plugin by adding the following to your `Cargo.toml` file:
`src-tauri/Cargo.toml` `src-tauri/Cargo.toml`
```toml ```toml
[dependencies.tauri-plugin-sql] [dependencies.tauri-plugin-sql]
git = "https://github.com/tauri-apps/plugins-workspace" git = "https://github.com/tauri-apps/plugins-workspace"
@ -28,7 +29,7 @@ You can install the JavaScript Guest bindings using your preferred JavaScript pa
pnpm add https://github.com/tauri-apps/tauri-plugin-sql pnpm add https://github.com/tauri-apps/tauri-plugin-sql
# or # or
npm add https://github.com/tauri-apps/tauri-plugin-sql npm add https://github.com/tauri-apps/tauri-plugin-sql
# or # or
yarn add https://github.com/tauri-apps/tauri-plugin-sql yarn add https://github.com/tauri-apps/tauri-plugin-sql
``` ```
@ -37,6 +38,7 @@ yarn add https://github.com/tauri-apps/tauri-plugin-sql
First you need to register the core plugin with Tauri: First you need to register the core plugin with Tauri:
`src-tauri/src/main.rs` `src-tauri/src/main.rs`
```rust ```rust
fn main() { fn main() {
tauri::Builder::default() tauri::Builder::default()
@ -49,16 +51,16 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings: Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript ```javascript
import Database from 'tauri-plugin-sql-api' import Database from "tauri-plugin-sql-api";
// sqlite. The path is relative to `tauri::api::path::BaseDirectory::App`. // sqlite. The path is relative to `tauri::api::path::BaseDirectory::App`.
const db = await Database.load('sqlite:test.db') const db = await Database.load("sqlite:test.db");
// mysql // mysql
const db = await Database.load('mysql://user:pass@host/database') const db = await Database.load("mysql://user:pass@host/database");
// postgres // postgres
const db = await Database.load('postgres://postgres:password@localhost/test') const db = await Database.load("postgres://postgres:password@localhost/test");
await db.execute('INSERT INTO ...') await db.execute("INSERT INTO ...");
``` ```
## Contributing ## Contributing

@ -13,6 +13,7 @@ There are three general methods of installation that we can recommend.
Install the Core plugin by adding the following to your `Cargo.toml` file: Install the Core plugin by adding the following to your `Cargo.toml` file:
`src-tauri/Cargo.toml` `src-tauri/Cargo.toml`
```toml ```toml
[dependencies] [dependencies]
tauri-plugin-store = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" } tauri-plugin-store = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" }
@ -26,7 +27,7 @@ You can install the JavaScript Guest bindings using your preferred JavaScript pa
pnpm add https://github.com/tauri-apps/tauri-plugin-store pnpm add https://github.com/tauri-apps/tauri-plugin-store
# or # or
npm add https://github.com/tauri-apps/tauri-plugin-store npm add https://github.com/tauri-apps/tauri-plugin-store
# or # or
yarn add https://github.com/tauri-apps/tauri-plugin-store yarn add https://github.com/tauri-apps/tauri-plugin-store
``` ```
@ -35,6 +36,7 @@ yarn add https://github.com/tauri-apps/tauri-plugin-store
First you need to register the core plugin with Tauri: First you need to register the core plugin with Tauri:
`src-tauri/src/main.rs` `src-tauri/src/main.rs`
```rust ```rust
fn main() { fn main() {
tauri::Builder::default() tauri::Builder::default()
@ -47,13 +49,13 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings: Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript ```javascript
import { Store } from 'tauri-plugin-store-api'; import { Store } from "tauri-plugin-store-api";
const store = new Store('.settings.dat'); const store = new Store(".settings.dat");
await store.set('some-key', { value: 5 }); await store.set("some-key", { value: 5 });
const val = await store.get('some-key'); const val = await store.get("some-key");
assert(val, { value: 5 }); assert(val, { value: 5 });
``` ```

@ -13,6 +13,7 @@ There are three general methods of installation that we can recommend.
Install the Core plugin by adding the following to your `Cargo.toml` file: Install the Core plugin by adding the following to your `Cargo.toml` file:
`src-tauri/Cargo.toml` `src-tauri/Cargo.toml`
```toml ```toml
[dependencies] [dependencies]
tauri-plugin-stronghold = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" } tauri-plugin-stronghold = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" }
@ -26,7 +27,7 @@ You can install the JavaScript Guest bindings using your preferred JavaScript pa
pnpm add https://github.com/tauri-apps/tauri-plugin-stronghold pnpm add https://github.com/tauri-apps/tauri-plugin-stronghold
# or # or
npm add https://github.com/tauri-apps/tauri-plugin-stronghold npm add https://github.com/tauri-apps/tauri-plugin-stronghold
# or # or
yarn add https://github.com/tauri-apps/tauri-plugin-stronghold yarn add https://github.com/tauri-apps/tauri-plugin-stronghold
``` ```
@ -35,6 +36,7 @@ yarn add https://github.com/tauri-apps/tauri-plugin-stronghold
First you need to register the core plugin with Tauri: First you need to register the core plugin with Tauri:
`src-tauri/src/main.rs` `src-tauri/src/main.rs`
```rust ```rust
fn main() { fn main() {
tauri::Builder::default() tauri::Builder::default()
@ -51,7 +53,7 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings: Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript ```javascript
import { Stronghold, Location } from 'tauri-plugin-stronghold-api' import { Stronghold, Location } from "tauri-plugin-stronghold-api";
// TODO // TODO
``` ```
@ -65,4 +67,3 @@ PRs accepted. Please make sure to read the Contributing Guide before making a pu
Code: (c) 2015 - Present - The Tauri Programme within The Commons Conservancy. Code: (c) 2015 - Present - The Tauri Programme within The Commons Conservancy.
MIT or MIT/Apache 2.0 where applicable. MIT or MIT/Apache 2.0 where applicable.

@ -13,6 +13,7 @@ There are three general methods of installation that we can recommend.
Install the Core plugin by adding the following to your `Cargo.toml` file: Install the Core plugin by adding the following to your `Cargo.toml` file:
`src-tauri/Cargo.toml` `src-tauri/Cargo.toml`
```toml ```toml
[dependencies] [dependencies]
tauri-plugin-upload = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" } tauri-plugin-upload = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" }
@ -26,7 +27,7 @@ You can install the JavaScript Guest bindings using your preferred JavaScript pa
pnpm add https://github.com/tauri-apps/tauri-plugin-upload pnpm add https://github.com/tauri-apps/tauri-plugin-upload
# or # or
npm add https://github.com/tauri-apps/tauri-plugin-upload npm add https://github.com/tauri-apps/tauri-plugin-upload
# or # or
yarn add https://github.com/tauri-apps/tauri-plugin-upload yarn add https://github.com/tauri-apps/tauri-plugin-upload
``` ```
@ -35,6 +36,7 @@ yarn add https://github.com/tauri-apps/tauri-plugin-upload
First you need to register the core plugin with Tauri: First you need to register the core plugin with Tauri:
`src-tauri/src/main.rs` `src-tauri/src/main.rs`
```rust ```rust
fn main() { fn main() {
tauri::Builder::default() tauri::Builder::default()

@ -13,6 +13,7 @@ There are three general methods of installation that we can recommend.
Install the Core plugin by adding the following to your `Cargo.toml` file: Install the Core plugin by adding the following to your `Cargo.toml` file:
`src-tauri/Cargo.toml` `src-tauri/Cargo.toml`
```toml ```toml
[dependencies] [dependencies]
tauri-plugin-websocket = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" } tauri-plugin-websocket = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" }
@ -26,7 +27,7 @@ You can install the JavaScript Guest bindings using your preferred JavaScript pa
pnpm add https://github.com/tauri-apps/tauri-plugin-websocket pnpm add https://github.com/tauri-apps/tauri-plugin-websocket
# or # or
npm add https://github.com/tauri-apps/tauri-plugin-websocket npm add https://github.com/tauri-apps/tauri-plugin-websocket
# or # or
yarn add https://github.com/tauri-apps/tauri-plugin-websocket yarn add https://github.com/tauri-apps/tauri-plugin-websocket
``` ```
@ -35,6 +36,7 @@ yarn add https://github.com/tauri-apps/tauri-plugin-websocket
First you need to register the core plugin with Tauri: First you need to register the core plugin with Tauri:
`src-tauri/src/main.rs` `src-tauri/src/main.rs`
```rust ```rust
fn main() { fn main() {
tauri::Builder::default() tauri::Builder::default()
@ -47,13 +49,13 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings: Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript ```javascript
import { WebSocket } from 'tauri-plugin-websocket-api' import { WebSocket } from "tauri-plugin-websocket-api";
const ws = await WebSocket.connect('wss://example.com') const ws = await WebSocket.connect("wss://example.com");
await ws.send('Hello World') await ws.send("Hello World");
await ws.disconnect() await ws.disconnect();
``` ```
## Contributing ## Contributing

@ -13,6 +13,7 @@ There are three general methods of installation that we can recommend.
Install the Core plugin by adding the following to your `Cargo.toml` file: Install the Core plugin by adding the following to your `Cargo.toml` file:
`src-tauri/Cargo.toml` `src-tauri/Cargo.toml`
```toml ```toml
[dependencies] [dependencies]
tauri-plugin-window-state = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" } tauri-plugin-window-state = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" }
@ -23,6 +24,7 @@ tauri-plugin-window-state = { git = "https://github.com/tauri-apps/plugins-works
First you need to register the core plugin with Tauri: First you need to register the core plugin with Tauri:
`src-tauri/src/main.rs` `src-tauri/src/main.rs`
```rust ```rust
fn main() { fn main() {
tauri::Builder::default() tauri::Builder::default()
@ -35,6 +37,7 @@ fn main() {
Afterwards all windows will remember their state when the app is being closed and will restore to their previous state on the next launch. Afterwards all windows will remember their state when the app is being closed and will restore to their previous state on the next launch.
Optionally you can also tell the plugin to save the state of all open window to disk my using the `save_window_state()` method exposed by the `AppHandleExt` trait: Optionally you can also tell the plugin to save the state of all open window to disk my using the `save_window_state()` method exposed by the `AppHandleExt` trait:
```rust ```rust
use tauri_plugin_window_state::AppHandleExt; use tauri_plugin_window_state::AppHandleExt;
@ -43,6 +46,7 @@ app.save_window_state(); // will save the state of all open windows to disk
``` ```
To manually restore a windows state from disk you can call the `restore_state()` method exposed by the `WindowExt` trait: To manually restore a windows state from disk you can call the `restore_state()` method exposed by the `WindowExt` trait:
```rust ```rust
use tauri_plugin_window_state::{WindowExt, ShowMode}; use tauri_plugin_window_state::{WindowExt, ShowMode};

@ -1,6 +1,4 @@
{ {
"extends": [ "extends": ["config:base"],
"config:base" "enabledManagers": ["cargo", "npm"]
], }
"enabledManagers": ["cargo", "npm"]
}

@ -13,6 +13,7 @@ There are three general methods of installation that we can recommend.
Install the Core plugin by adding the following to your `Cargo.toml` file: Install the Core plugin by adding the following to your `Cargo.toml` file:
`src-tauri/Cargo.toml` `src-tauri/Cargo.toml`
```toml ```toml
[dependencies] [dependencies]
<!-- plugin here --> = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" } <!-- plugin here --> = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" }
@ -26,7 +27,7 @@ You can install the JavaScript Guest bindings using your preferred JavaScript pa
pnpm add <!-- plugin here --> pnpm add <!-- plugin here -->
# or # or
npm add <!-- plugin here --> npm add <!-- plugin here -->
# or # or
yarn add <!-- plugin here --> yarn add <!-- plugin here -->
``` ```
@ -35,6 +36,7 @@ yarn add <!-- plugin here -->
First you need to register the core plugin with Tauri: First you need to register the core plugin with Tauri:
`src-tauri/src/main.rs` `src-tauri/src/main.rs`
```rust ```rust
fn main() { fn main() {
tauri::Builder::default() tauri::Builder::default()

@ -3,7 +3,7 @@ import { readFileSync } from "fs";
import { createConfig } from "../rollup.config.mjs"; import { createConfig } from "../rollup.config.mjs";
export default createConfig({ export default createConfig({
input: 'guest-js/index.ts', input: "guest-js/index.ts",
pkg: JSON.parse( pkg: JSON.parse(
readFileSync(new URL("./package.json", import.meta.url), "utf8") readFileSync(new URL("./package.json", import.meta.url), "utf8")
), ),

Loading…
Cancel
Save