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:
`src-tauri/Cargo.toml`
```toml
[dependencies]
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
# or
npm add https://github.com/tauri-apps/tauri-plugin-authenticator
# or
# or
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:
`src-tauri/src/main.rs`
```rust
fn main() {
tauri::Builder::default()
@ -49,37 +51,49 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript
import { Authenticator } from 'tauri-plugin-authenticator-api'
import { Authenticator } from "tauri-plugin-authenticator-api";
const auth = new Authenticator()
auth.init() // initialize transports
const auth = new Authenticator();
auth.init(); // initialize transports
// generate a 32-bytes long random challenge
const arr = new Uint32Array(32)
window.crypto.getRandomValues(arr)
const b64 = btoa(String.fromCharCode.apply(null, arr))
const arr = new Uint32Array(32);
window.crypto.getRandomValues(arr);
const b64 = btoa(String.fromCharCode.apply(null, arr));
// 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
const json = await auth.register(challenge, domain)
const registerResult = JSON.parse(json)
const json = await auth.register(challenge, domain);
const registerResult = JSON.parse(json);
// verify te registration was successfull
const r2 = await auth.verifyRegistration(challenge, app, registerResult.registerData, registerResult.clientData)
const j2 = JSON.parse(r2)
const r2 = await auth.verifyRegistration(
challenge,
app,
registerResult.registerData,
registerResult.clientData
);
const j2 = JSON.parse(r2);
// sign some data
const json = await auth.sign(challenge, app, keyHandle)
const signData = JSON.parse(json)
const json = await auth.sign(challenge, app, keyHandle);
const signData = JSON.parse(json);
// verify the signature again
const counter = await auth.verifySignature(challenge, app, signData.signData, clientData, keyHandle, pubkey)
if(counter && counter>0) {
console.log('SUCCESS!')
const counter = await auth.verifySignature(
challenge,
app,
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:
`src-tauri/Cargo.toml`
```toml
[dependencies]
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
# or
npm add https://github.com/tauri-apps/tauri-plugin-autostart
# or
# or
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:
`src-tauri/src/main.rs`
```rust
fn main() {
tauri::Builder::default()
@ -47,13 +49,13 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```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

@ -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:
`src-tauri/Cargo.toml`
```toml
[dependencies]
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
# or
npm add https://github.com/tauri-apps/tauri-plugin-fs-extra
# or
# or
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:
`src-tauri/src/main.rs`
```rust
fn main() {
tauri::Builder::default()
@ -47,9 +49,9 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```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
@ -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.
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:
`src-tauri/Cargo.toml`
```toml
[dependencies]
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
# or
npm add https://github.com/tauri-apps/tauri-plugin-fs-watch
# or
# or
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:
`src-tauri/src/main.rs`
```rust
fn main() {
tauri::Builder::default()
@ -47,16 +49,24 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```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
const stopWatching = await watch('/path/to/something', { recursive: true }, event => {
const { type, payload } = event
})
const stopRawWatcher = await watchImmediate(['/path/a', '/path/b'], {}, event => {
const { path, operation, cookie } = event
})
const stopWatching = await watch(
"/path/to/something",
{ recursive: true },
(event) => {
const { type, payload } = event;
}
);
const stopRawWatcher = await watchImmediate(
["/path/a", "/path/b"],
{},
(event) => {
const { path, operation, cookie } = event;
}
);
```
## 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:
`src-tauri/Cargo.toml`
```toml
[dependencies]
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:
`src-tauri/src/main.rs`
```rust
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:
`src-tauri/Cargo.toml`
```toml
[dependencies]
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
# or
npm add https://github.com/tauri-apps/tauri-plugin-log
# or
# or
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:
`src-tauri/src/main.rs`
```rust
use tauri_plugin_log::{LogTarget};
@ -53,17 +55,17 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```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
const detach = await attachConsole()
const detach = await attachConsole();
trace("Trace")
info("Info")
error("Error")
trace("Trace");
info("Info");
error("Error");
// detach the browser console from the log stream
detach()
detach();
```
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:
`src-tauri/Cargo.toml`
```toml
[dependencies]
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:
`src-tauri/src/main.rs`
```rust
fn main() {
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:
`src-tauri/Cargo.toml`
```toml
[dependencies]
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
# or
npm add tauri-plugin-positioner
# or
# or
yarn add tauri-plugin-positioner
```
@ -40,7 +41,7 @@ Or through git:
pnpm add https://github.com/tauri-apps/tauri-plugin-positioner
# or
npm add https://github.com/tauri-apps/tauri-plugin-positioner
# or
# or
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:
`src-tauri/src/main.rs`
```rust
fn main() {
tauri::Builder::default()
@ -65,9 +67,9 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```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:
@ -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.
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:
`src-tauri/Cargo.toml`
```toml
[dependencies.tauri-plugin-sql]
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
# or
npm add https://github.com/tauri-apps/tauri-plugin-sql
# or
# or
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:
`src-tauri/src/main.rs`
```rust
fn main() {
tauri::Builder::default()
@ -49,16 +51,16 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```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`.
const db = await Database.load('sqlite:test.db')
const db = await Database.load("sqlite:test.db");
// mysql
const db = await Database.load('mysql://user:pass@host/database')
const db = await Database.load("mysql://user:pass@host/database");
// 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

@ -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:
`src-tauri/Cargo.toml`
```toml
[dependencies]
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
# or
npm add https://github.com/tauri-apps/tauri-plugin-store
# or
# or
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:
`src-tauri/src/main.rs`
```rust
fn main() {
tauri::Builder::default()
@ -47,13 +49,13 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```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 });
```

@ -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:
`src-tauri/Cargo.toml`
```toml
[dependencies]
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
# or
npm add https://github.com/tauri-apps/tauri-plugin-stronghold
# or
# or
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:
`src-tauri/src/main.rs`
```rust
fn main() {
tauri::Builder::default()
@ -51,7 +53,7 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript
import { Stronghold, Location } from 'tauri-plugin-stronghold-api'
import { Stronghold, Location } from "tauri-plugin-stronghold-api";
// 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.
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:
`src-tauri/Cargo.toml`
```toml
[dependencies]
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
# or
npm add https://github.com/tauri-apps/tauri-plugin-upload
# or
# or
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:
`src-tauri/src/main.rs`
```rust
fn main() {
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:
`src-tauri/Cargo.toml`
```toml
[dependencies]
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
# or
npm add https://github.com/tauri-apps/tauri-plugin-websocket
# or
# or
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:
`src-tauri/src/main.rs`
```rust
fn main() {
tauri::Builder::default()
@ -47,13 +49,13 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```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

@ -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:
`src-tauri/Cargo.toml`
```toml
[dependencies]
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:
`src-tauri/src/main.rs`
```rust
fn main() {
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.
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
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:
```rust
use tauri_plugin_window_state::{WindowExt, ShowMode};

@ -1,6 +1,4 @@
{
"extends": [
"config:base"
],
"enabledManagers": ["cargo", "npm"]
}
"extends": ["config:base"],
"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:
`src-tauri/Cargo.toml`
```toml
[dependencies]
<!-- 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 -->
# or
npm add <!-- plugin here -->
# or
# or
yarn add <!-- plugin here -->
```
@ -35,6 +36,7 @@ yarn add <!-- plugin here -->
First you need to register the core plugin with Tauri:
`src-tauri/src/main.rs`
```rust
fn main() {
tauri::Builder::default()

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

Loading…
Cancel
Save