diff --git a/plugins/authenticator/README.md b/plugins/authenticator/README.md index 542195ae5..884d81b9e 100644 --- a/plugins/authenticator/README.md +++ b/plugins/authenticator/README.md @@ -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) +const counter = await auth.verifySignature( + challenge, + app, + signData.signData, + clientData, + keyHandle, + pubkey +); -if(counter && counter>0) { - console.log('SUCCESS!') +if (counter && counter > 0) { + console.log("SUCCESS!"); } ``` diff --git a/plugins/autostart/README.md b/plugins/autostart/README.md index f048cd137..87e7d1321 100644 --- a/plugins/autostart/README.md +++ b/plugins/autostart/README.md @@ -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 diff --git a/plugins/fs-extra/README.md b/plugins/fs-extra/README.md index 27b2756e7..6ea6ea1c5 100644 --- a/plugins/fs-extra/README.md +++ b/plugins/fs-extra/README.md @@ -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. \ No newline at end of file +MIT or MIT/Apache 2.0 where applicable. diff --git a/plugins/fs-watch/README.md b/plugins/fs-watch/README.md index 9ce827392..26ee5bfc8 100644 --- a/plugins/fs-watch/README.md +++ b/plugins/fs-watch/README.md @@ -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 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 stopRawWatcher = await watchImmediate( + ["/path/a", "/path/b"], + {}, + (event) => { + const { path, operation, cookie } = event; + } +); ``` ## Contributing diff --git a/plugins/localhost/README.md b/plugins/localhost/README.md index e5c495f11..23b075770 100644 --- a/plugins/localhost/README.md +++ b/plugins/localhost/README.md @@ -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}; diff --git a/plugins/log/README.md b/plugins/log/README.md index 2d691449b..f49c2c7b9 100644 --- a/plugins/log/README.md +++ b/plugins/log/README.md @@ -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`: diff --git a/plugins/persisted-scope/README.md b/plugins/persisted-scope/README.md index a856a7773..43dd5909b 100644 --- a/plugins/persisted-scope/README.md +++ b/plugins/persisted-scope/README.md @@ -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() diff --git a/plugins/positioner/README.md b/plugins/positioner/README.md index 861043cde..54332ddc4 100644 --- a/plugins/positioner/README.md +++ b/plugins/positioner/README.md @@ -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. - diff --git a/plugins/sql/README.md b/plugins/sql/README.md index ee7ef7404..2b7c6f9b6 100644 --- a/plugins/sql/README.md +++ b/plugins/sql/README.md @@ -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 diff --git a/plugins/store/README.md b/plugins/store/README.md index 4276872d3..0e1eb29a5 100644 --- a/plugins/store/README.md +++ b/plugins/store/README.md @@ -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 }); ``` diff --git a/plugins/stronghold/README.md b/plugins/stronghold/README.md index 3831aaa86..bc79b46cd 100644 --- a/plugins/stronghold/README.md +++ b/plugins/stronghold/README.md @@ -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. - diff --git a/plugins/upload/README.md b/plugins/upload/README.md index 0ad80957b..1168a3629 100644 --- a/plugins/upload/README.md +++ b/plugins/upload/README.md @@ -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() diff --git a/plugins/websocket/README.md b/plugins/websocket/README.md index 9d1abd6c2..954a650f7 100644 --- a/plugins/websocket/README.md +++ b/plugins/websocket/README.md @@ -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 diff --git a/plugins/window-state/README.md b/plugins/window-state/README.md index bc8094f3d..de309e738 100644 --- a/plugins/window-state/README.md +++ b/plugins/window-state/README.md @@ -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}; diff --git a/renovate.json b/renovate.json index b9973fa26..4dac52b1c 100644 --- a/renovate.json +++ b/renovate.json @@ -1,6 +1,4 @@ { - "extends": [ - "config:base" - ], - "enabledManagers": ["cargo", "npm"] -} \ No newline at end of file + "extends": ["config:base"], + "enabledManagers": ["cargo", "npm"] +} diff --git a/shared/template/README.md b/shared/template/README.md index 5823ab98f..0a059e4f3 100644 --- a/shared/template/README.md +++ b/shared/template/README.md @@ -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] = { 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 # or npm add -# or +# or yarn add ``` @@ -35,6 +36,7 @@ yarn add First you need to register the core plugin with Tauri: `src-tauri/src/main.rs` + ```rust fn main() { tauri::Builder::default() diff --git a/shared/template/rollup.config.mjs b/shared/template/rollup.config.mjs index 35002e057..96840adc0 100644 --- a/shared/template/rollup.config.mjs +++ b/shared/template/rollup.config.mjs @@ -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") ),