diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000..83ba0c42 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,5 @@ +# Order is important; the last matching pattern takes the most precedence. +* @tauri-apps/plugin-maintainers + +# Currently CI/CD for plugins are in heavy flux, and the plugin team manages it themselves. +# .github @tauri-apps/wg-devops diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml index 6464f883..aabf8d93 100644 --- a/.github/workflows/sync.yml +++ b/.github/workflows/sync.yml @@ -1,6 +1,7 @@ name: Sync on: + workflow_dispatch: push: branches: - dev @@ -14,7 +15,21 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - # potentially a build step here + - name: Cache pnpm modules + uses: actions/cache@v3 + with: + path: ~/.pnpm-store + key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}- + - uses: actions/setup-node@v3 + with: + node-version: 18 + - uses: pnpm/action-setup@v2.2.4 + with: + run_install: true + - name: Build packages + run: pnpm build - name: Sync run: .github/sync-to-mirrors.sh env: diff --git a/.gitignore b/.gitignore index 5feb9078..2c6d35b6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ target -node_modules \ No newline at end of file +node_modules +dist \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 1002e9b4..0a70412a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -149,7 +149,7 @@ dependencies = [ "devd-rs", "libc", "libudev", - "log 0.4.17", + "log", "rand 0.7.3", "runloop", "winapi 0.3.9", @@ -993,7 +993,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3bdd7b0849075e79ee9a1836df22c717d1eba30451796fdc631b04565dd11e2a" dependencies = [ - "log 0.4.17", + "log", ] [[package]] @@ -1304,7 +1304,7 @@ checksum = "d266041a359dfa931b370ef684cceb84b166beb14f7f0421f4a6a3d0c446d12e" dependencies = [ "cc", "libc", - "log 0.4.17", + "log", "rustversion", "windows", ] @@ -1443,7 +1443,7 @@ dependencies = [ "aho-corasick", "bstr", "fnv", - "log 0.4.17", + "log", "regex", ] @@ -1607,7 +1607,7 @@ version = "0.25.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5c13fb08e5d4dfc151ee5e88bae63f7773d61852f3bdc73c9f4b9e1bde03148" dependencies = [ - "log 0.4.17", + "log", "mac", "markup5ever", "proc-macro2", @@ -1751,7 +1751,7 @@ dependencies = [ "crossbeam-utils", "globset", "lazy_static", - "log 0.4.17", + "log", "memchr", "regex", "same-file", @@ -1948,7 +1948,7 @@ dependencies = [ "cesu8", "combine", "jni-sys", - "log 0.4.17", + "log", "thiserror", "walkdir", ] @@ -2026,7 +2026,7 @@ dependencies = [ "gtk", "gtk-sys", "libappindicator-sys", - "log 0.4.17", + "log", ] [[package]] @@ -2133,20 +2133,6 @@ dependencies = [ "scopeguard", ] -[[package]] -name = "log" -version = "0.1.0" -dependencies = [ - "byte-unit", - "fern", - "log 0.4.17", - "serde", - "serde_json", - "serde_repr", - "tauri", - "time 0.3.17", -] - [[package]] name = "log" version = "0.4.17" @@ -2193,7 +2179,7 @@ version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a24f40fb03852d1cdd84330cddcaf98e9ec08a7b7768e952fad3b4cf048ec8fd" dependencies = [ - "log 0.4.17", + "log", "phf 0.8.0", "phf_codegen", "string_cache", @@ -2273,7 +2259,7 @@ dependencies = [ "iovec", "kernel32-sys", "libc", - "log 0.4.17", + "log", "miow", "net2", "slab", @@ -2287,7 +2273,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de" dependencies = [ "libc", - "log 0.4.17", + "log", "wasi 0.11.0+wasi-snapshot-preview1", "windows-sys 0.42.0", ] @@ -2299,7 +2285,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52403fe290012ce777c4626790c8951324a2b9e3316b3143779c72b029742f19" dependencies = [ "lazycell", - "log 0.4.17", + "log", "mio 0.6.23", "slab", ] @@ -2324,7 +2310,7 @@ checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" dependencies = [ "lazy_static", "libc", - "log 0.4.17", + "log", "openssl", "openssl-probe", "openssl-sys", @@ -3186,7 +3172,7 @@ dependencies = [ "hyper-tls", "ipnet", "js-sys", - "log 0.4.17", + "log", "mime", "native-tls", "once_cell", @@ -3271,7 +3257,7 @@ version = "0.20.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "539a2bfe908f471bfa933876bd1eb6a19cf2176d375f82ef7f99530a40e48c2c" dependencies = [ - "log 0.4.17", + "log", "ring", "sct", "webpki", @@ -3396,7 +3382,7 @@ dependencies = [ "cssparser", "derive_more", "fxhash", - "log 0.4.17", + "log", "matches", "phf 0.8.0", "phf_codegen", @@ -3735,7 +3721,7 @@ dependencies = [ "itoa 1.0.4", "libc", "libsqlite3-sys", - "log 0.4.17", + "log", "md-5", "memchr", "num-bigint", @@ -3862,7 +3848,7 @@ checksum = "8b00fbacafc4ef96fb95fac07d86cc3ec5e21c8efa94785374ad7913a4a216ba" dependencies = [ "atom", "lazy_static", - "log 0.4.17", + "log", "thiserror", "zeroize", ] @@ -4000,7 +3986,7 @@ dependencies = [ "lazy_static", "libappindicator", "libc", - "log 0.4.17", + "log", "ndk", "ndk-context", "ndk-sys", @@ -4121,7 +4107,7 @@ dependencies = [ "authenticator", "base64 0.13.1", "chrono", - "log 0.4.17", + "log", "once_cell", "rand 0.8.5", "rusty-fork", @@ -4138,7 +4124,7 @@ name = "tauri-plugin-autostart" version = "0.1.0" dependencies = [ "auto-launch", - "log 0.4.17", + "log", "serde", "serde_json", "tauri", @@ -4149,7 +4135,7 @@ dependencies = [ name = "tauri-plugin-fs-extra" version = "0.1.0" dependencies = [ - "log 0.4.17", + "log", "serde", "serde_json", "tauri", @@ -4160,7 +4146,7 @@ dependencies = [ name = "tauri-plugin-fs-watch" version = "0.1.0" dependencies = [ - "log 0.4.17", + "log", "notify", "serde", "serde_json", @@ -4173,7 +4159,7 @@ name = "tauri-plugin-localhost" version = "0.1.0" dependencies = [ "http", - "log 0.4.17", + "log", "serde", "serde_json", "tauri", @@ -4181,12 +4167,26 @@ dependencies = [ "tiny_http", ] +[[package]] +name = "tauri-plugin-log" +version = "0.1.0" +dependencies = [ + "byte-unit", + "fern", + "log", + "serde", + "serde_json", + "serde_repr", + "tauri", + "time 0.3.17", +] + [[package]] name = "tauri-plugin-persisted-scope" version = "0.1.0" dependencies = [ "bincode", - "log 0.4.17", + "log", "serde", "serde_json", "tauri", @@ -4197,7 +4197,7 @@ dependencies = [ name = "tauri-plugin-positioner" version = "0.2.7" dependencies = [ - "log 0.4.17", + "log", "serde", "serde_json", "serde_repr", @@ -4210,7 +4210,7 @@ name = "tauri-plugin-sql" version = "0.1.0" dependencies = [ "futures", - "log 0.4.17", + "log", "serde", "serde_json", "sqlx", @@ -4223,7 +4223,7 @@ dependencies = [ name = "tauri-plugin-store" version = "0.1.0" dependencies = [ - "log 0.4.17", + "log", "serde", "serde_json", "tauri", @@ -4237,7 +4237,7 @@ dependencies = [ "hex", "iota-crypto 0.14.3", "iota_stronghold", - "log 0.4.17", + "log", "rand 0.8.5", "rusty-fork", "serde", @@ -4252,7 +4252,7 @@ name = "tauri-plugin-upload" version = "0.1.0" dependencies = [ "futures", - "log 0.4.17", + "log", "read-progress-stream", "reqwest", "serde", @@ -4268,7 +4268,7 @@ name = "tauri-plugin-websocket" version = "0.1.0" dependencies = [ "futures-util", - "log 0.4.17", + "log", "rand 0.8.5", "serde", "serde_json", @@ -4283,7 +4283,7 @@ name = "tauri-plugin-window-state" version = "0.1.0" dependencies = [ "bincode", - "log 0.4.17", + "log", "serde", "serde_json", "tauri", @@ -4473,7 +4473,7 @@ checksum = "e0d6ef4e10d23c1efb862eecad25c5054429a71958b4eeef85eb5e7170b477ca" dependencies = [ "ascii", "chunked_transfer", - "log 0.4.17", + "log", "time 0.3.17", "url", ] @@ -4549,7 +4549,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f714dd15bead90401d77e04243611caec13726c2408afd5b31901dfcdcb3b181" dependencies = [ "futures-util", - "log 0.4.17", + "log", "native-tls", "tokio", "tokio-native-tls", @@ -4625,7 +4625,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" dependencies = [ "lazy_static", - "log 0.4.17", + "log", "tracing-core", ] @@ -4673,7 +4673,7 @@ dependencies = [ "bytes 1.3.0", "http", "httparse", - "log 0.4.17", + "log", "native-tls", "rand 0.8.5", "sha-1", @@ -4877,7 +4877,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" dependencies = [ - "log 0.4.17", + "log", "try-lock", ] @@ -4916,7 +4916,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" dependencies = [ "bumpalo", - "log 0.4.17", + "log", "once_cell", "proc-macro2", "quote", @@ -5338,7 +5338,7 @@ dependencies = [ "http", "kuchiki", "libc", - "log 0.4.17", + "log", "objc", "objc_id", "once_cell", diff --git a/plugins/authenticator/.gitignore b/plugins/authenticator/.gitignore new file mode 100644 index 00000000..b512c09d --- /dev/null +++ b/plugins/authenticator/.gitignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/plugins/authenticator/README.md b/plugins/authenticator/README.md index 9b0fdcbe..a868a3f8 100644 --- a/plugins/authenticator/README.md +++ b/plugins/authenticator/README.md @@ -1,17 +1,86 @@ ![plugin-authenticator](banner.png) - +Use Hardware Security-keys in your Tauri App. ## Install +There are three general methods of installation that we can recommend. + +1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked) +2. Pull sources directly from Github using git tags / revision hashes (most secure) +3. Git submodule install this repo in your tauri project and then use file protocol to ingest the source (most secure, but inconvenient to use) + +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 +tauri-plugin-authenticator = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" } ``` +You can install the JavaScript Guest bindings using your preferred JavaScript package manager: + +> 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-authenticator +# or +npm add https://github.com/tauri-apps/tauri-plugin-authenticator +# or +yarn add https://github.com/tauri-apps/tauri-plugin-authenticator ``` ## Usage +First you need to register the core plugin with Tauri: + +`src-tauri/src/main.rs` +```rust +fn main() { + tauri::Builder::default() + .plugin(tauri_plugin_authenticator::init()) + .run(tauri::generate_context!()) + .expect("error while running tauri application"); +} ``` +Afterwards all the plugin's APIs are available through the JavaScript guest bindings: + +```javascript +import { Authenticator } from 'tauri-plugin-authenticator-api' + +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)) +// web-safe base64 +const challenge = b64.replace(/\+/g, '-').replace(/\//g, '_') + +const domain = 'https://tauri.app' + +// attempt to register with the security key +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) + +// sign some data +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!') +} ``` ## Contributing @@ -20,6 +89,6 @@ PRs accepted. Please make sure to read the Contributing Guide before making a pu ## License -Code: (c) 2015 - 2021 - 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. diff --git a/plugins/authenticator/guest-js/dist/index.d.ts b/plugins/authenticator/guest-js/dist/index.d.ts deleted file mode 100644 index 15a751bf..00000000 --- a/plugins/authenticator/guest-js/dist/index.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -export declare class Authenticator { - init(): Promise; - register(challenge: string, application: string): Promise; - verifyRegistration(challenge: string, application: string, registerData: string, clientData: string): Promise; - sign(challenge: string, application: string, keyHandle: string): Promise; - verifySignature(challenge: string, application: string, signData: string, clientData: string, keyHandle: string, pubkey: string): Promise; -} diff --git a/plugins/authenticator/guest-js/dist/index.min.js b/plugins/authenticator/guest-js/dist/index.min.js deleted file mode 100644 index 44e0d948..00000000 --- a/plugins/authenticator/guest-js/dist/index.min.js +++ /dev/null @@ -1,45 +0,0 @@ -var d=Object.defineProperty;var e=(c,a)=>{for(var b in a)d(c,b,{get:a[b],enumerable:!0});}; - -var f={};e(f,{convertFileSrc:()=>w,invoke:()=>c,transformCallback:()=>s});function u(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function s(e,r=!1){let n=u(),t=`_${n}`;return Object.defineProperty(window,t,{value:o=>(r&&Reflect.deleteProperty(window,t),e==null?void 0:e(o)),writable:!1,configurable:!0}),n}async function c(e,r={}){return new Promise((n,t)=>{let o=s(i=>{n(i),Reflect.deleteProperty(window,`_${a}`);},!0),a=s(i=>{t(i),Reflect.deleteProperty(window,`_${o}`);},!0);window.__TAURI_IPC__({cmd:e,callback:o,error:a,...r});})}function w(e,r="asset"){let n=encodeURIComponent(e);return navigator.userAgent.includes("Windows")?`https://${r}.localhost/${n}`:`${r}://localhost/${n}`} - -class Authenticator { - async init() { - return await c("plugin:authenticator|init"); - } - async register(challenge, application) { - return await c("plugin:authenticator|register", { - timeout: 10000, - challenge, - application, - }); - } - async verifyRegistration(challenge, application, registerData, clientData) { - return await c("plugin:authenticator|verify_registration", { - challenge, - application, - registerData, - clientData, - }); - } - async sign(challenge, application, keyHandle) { - return await c("plugin:authenticator|sign", { - timeout: 10000, - challenge, - application, - keyHandle, - }); - } - async verifySignature(challenge, application, signData, clientData, keyHandle, pubkey) { - return await c("plugin:authenticator|verify_signature", { - challenge, - application, - signData, - clientData, - keyHandle, - pubkey, - }); - } -} - -export { Authenticator }; -//# sourceMappingURL=index.min.js.map diff --git a/plugins/authenticator/guest-js/dist/index.min.js.map b/plugins/authenticator/guest-js/dist/index.min.js.map deleted file mode 100644 index f4d8fb30..00000000 --- a/plugins/authenticator/guest-js/dist/index.min.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.min.js","sources":["../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-FEIY7W7S.js","../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-RCPA6UVN.js","../index.ts"],"sourcesContent":["var d=Object.defineProperty;var e=(c,a)=>{for(var b in a)d(c,b,{get:a[b],enumerable:!0})};export{e as a};\n","import{a as d}from\"./chunk-FEIY7W7S.js\";var f={};d(f,{convertFileSrc:()=>w,invoke:()=>c,transformCallback:()=>s});function u(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function s(e,r=!1){let n=u(),t=`_${n}`;return Object.defineProperty(window,t,{value:o=>(r&&Reflect.deleteProperty(window,t),e==null?void 0:e(o)),writable:!1,configurable:!0}),n}async function c(e,r={}){return new Promise((n,t)=>{let o=s(i=>{n(i),Reflect.deleteProperty(window,`_${a}`)},!0),a=s(i=>{t(i),Reflect.deleteProperty(window,`_${o}`)},!0);window.__TAURI_IPC__({cmd:e,callback:o,error:a,...r})})}function w(e,r=\"asset\"){let n=encodeURIComponent(e);return navigator.userAgent.includes(\"Windows\")?`https://${r}.localhost/${n}`:`${r}://localhost/${n}`}export{s as a,c as b,w as c,f as d};\n",null],"names":["d","invoke"],"mappings":"AAA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C,CAAC;KACJ;AAED,IAAA,MAAM,IAAI,CACR,SAAiB,EACjB,WAAmB,EACnB,SAAiB,EAAA;AAEjB,QAAA,OAAO,MAAMA,CAAM,CAAC,2BAA2B,EAAE;AAC/C,YAAA,OAAO,EAAE,KAAK;YACd,SAAS;YACT,WAAW;YACX,SAAS;AACV,SAAA,CAAC,CAAC;KACJ;AAED,IAAA,MAAM,eAAe,CACnB,SAAiB,EACjB,WAAmB,EACnB,QAAgB,EAChB,UAAkB,EAClB,SAAiB,EACjB,MAAc,EAAA;AAEd,QAAA,OAAO,MAAMA,CAAM,CAAC,uCAAuC,EAAE;YAC3D,SAAS;YACT,WAAW;YACX,QAAQ;YACR,UAAU;YACV,SAAS;YACT,MAAM;AACP,SAAA,CAAC,CAAC;KACJ;AACF;;;;"} \ No newline at end of file diff --git a/plugins/authenticator/guest-js/dist/index.mjs b/plugins/authenticator/guest-js/dist/index.mjs deleted file mode 100644 index b3ce700d..00000000 --- a/plugins/authenticator/guest-js/dist/index.mjs +++ /dev/null @@ -1,43 +0,0 @@ -import { invoke } from '@tauri-apps/api/tauri'; - -class Authenticator { - async init() { - return await invoke("plugin:authenticator|init"); - } - async register(challenge, application) { - return await invoke("plugin:authenticator|register", { - timeout: 10000, - challenge, - application, - }); - } - async verifyRegistration(challenge, application, registerData, clientData) { - return await invoke("plugin:authenticator|verify_registration", { - challenge, - application, - registerData, - clientData, - }); - } - async sign(challenge, application, keyHandle) { - return await invoke("plugin:authenticator|sign", { - timeout: 10000, - challenge, - application, - keyHandle, - }); - } - async verifySignature(challenge, application, signData, clientData, keyHandle, pubkey) { - return await invoke("plugin:authenticator|verify_signature", { - challenge, - application, - signData, - clientData, - keyHandle, - pubkey, - }); - } -} - -export { Authenticator }; -//# sourceMappingURL=index.mjs.map diff --git a/plugins/authenticator/guest-js/dist/index.mjs.map b/plugins/authenticator/guest-js/dist/index.mjs.map deleted file mode 100644 index 5c3da097..00000000 --- a/plugins/authenticator/guest-js/dist/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../index.ts"],"sourcesContent":[null],"names":[],"mappings":";;MAEa,aAAa,CAAA;AACxB,IAAA,MAAM,IAAI,GAAA;AACR,QAAA,OAAO,MAAM,MAAM,CAAC,2BAA2B,CAAC,CAAC;KAClD;AAED,IAAA,MAAM,QAAQ,CAAC,SAAiB,EAAE,WAAmB,EAAA;AACnD,QAAA,OAAO,MAAM,MAAM,CAAC,+BAA+B,EAAE;AACnD,YAAA,OAAO,EAAE,KAAK;YACd,SAAS;YACT,WAAW;AACZ,SAAA,CAAC,CAAC;KACJ;IAED,MAAM,kBAAkB,CACtB,SAAiB,EACjB,WAAmB,EACnB,YAAoB,EACpB,UAAkB,EAAA;AAElB,QAAA,OAAO,MAAM,MAAM,CAAC,0CAA0C,EAAE;YAC9D,SAAS;YACT,WAAW;YACX,YAAY;YACZ,UAAU;AACX,SAAA,CAAC,CAAC;KACJ;AAED,IAAA,MAAM,IAAI,CACR,SAAiB,EACjB,WAAmB,EACnB,SAAiB,EAAA;AAEjB,QAAA,OAAO,MAAM,MAAM,CAAC,2BAA2B,EAAE;AAC/C,YAAA,OAAO,EAAE,KAAK;YACd,SAAS;YACT,WAAW;YACX,SAAS;AACV,SAAA,CAAC,CAAC;KACJ;AAED,IAAA,MAAM,eAAe,CACnB,SAAiB,EACjB,WAAmB,EACnB,QAAgB,EAChB,UAAkB,EAClB,SAAiB,EACjB,MAAc,EAAA;AAEd,QAAA,OAAO,MAAM,MAAM,CAAC,uCAAuC,EAAE;YAC3D,SAAS;YACT,WAAW;YACX,QAAQ;YACR,UAAU;YACV,SAAS;YACT,MAAM;AACP,SAAA,CAAC,CAAC;KACJ;AACF;;;;"} \ No newline at end of file diff --git a/plugins/authenticator/guest-js/tsconfig.json b/plugins/authenticator/guest-js/tsconfig.json deleted file mode 120000 index 9c2b2da2..00000000 --- a/plugins/authenticator/guest-js/tsconfig.json +++ /dev/null @@ -1 +0,0 @@ -../../../shared/tsconfig.json \ No newline at end of file diff --git a/plugins/authenticator/package.json b/plugins/authenticator/package.json new file mode 100644 index 00000000..6cf8288e --- /dev/null +++ b/plugins/authenticator/package.json @@ -0,0 +1,32 @@ +{ + "name": "tauri-plugin-authenticator-api", + "version": "0.0.0", + "license": "MIT or APACHE-2.0", + "authors": [ + "Tauri Programme within The Commons Conservancy" + ], + "type": "module", + "browser": "guest-js/dist/index.min.js", + "module": "guest-js/dist/index.mjs", + "types": "guest-js/dist/index.d.ts", + "exports": { + "import": "./guest-js/dist/index.mjs", + "types": "./guest-js/dist/index.d.ts", + "browser": "./guest-js/dist/index.min.js" + }, + "scripts": { + "build": "rollup -c" + }, + "files": [ + "guest-js/dist", + "!guest-js/dist/**/*.map", + "README.md", + "LICENSE" + ], + "devDependencies": { + "tslib": "^2.4.1" + }, + "dependencies": { + "@tauri-apps/api": "^1.2.0" + } +} diff --git a/plugins/authenticator/guest-js/rollup.config.mjs b/plugins/authenticator/rollup.config.mjs similarity index 68% rename from plugins/authenticator/guest-js/rollup.config.mjs rename to plugins/authenticator/rollup.config.mjs index ee885522..6555e98b 100644 --- a/plugins/authenticator/guest-js/rollup.config.mjs +++ b/plugins/authenticator/rollup.config.mjs @@ -1,8 +1,9 @@ import { readFileSync } from "fs"; -import { createConfig } from "../../../shared/rollup.config.mjs"; +import { createConfig } from "../../shared/rollup.config.mjs"; export default createConfig({ + input: "guest-js/index.ts", pkg: JSON.parse( readFileSync(new URL("./package.json", import.meta.url), "utf8") ), diff --git a/plugins/authenticator/src/auth.rs b/plugins/authenticator/src/auth.rs index 363b0d11..3241ef72 100644 --- a/plugins/authenticator/src/auth.rs +++ b/plugins/authenticator/src/auth.rs @@ -75,8 +75,8 @@ pub fn register(application: String, timeout: u64, challenge: String) -> crate:: let (key_handle, public_key) = _u2f_get_key_handle_and_public_key_from_register_response(®ister_data).unwrap(); - let key_handle_base64 = encode_config(&key_handle, URL_SAFE_NO_PAD); - let public_key_base64 = encode_config(&public_key, URL_SAFE_NO_PAD); + let key_handle_base64 = encode_config(key_handle, URL_SAFE_NO_PAD); + let public_key_base64 = encode_config(public_key, URL_SAFE_NO_PAD); let register_data_base64 = encode_config(®ister_data, URL_SAFE_NO_PAD); println!("Key Handle: {}", &key_handle_base64); println!("Public Key: {}", &public_key_base64); @@ -108,7 +108,7 @@ pub fn sign( challenge: String, key_handle: String, ) -> crate::Result { - let credential = match decode_config(&key_handle, URL_SAFE_NO_PAD) { + let credential = match decode_config(key_handle, URL_SAFE_NO_PAD) { Ok(v) => v, Err(e) => { return Err(e.into()); @@ -152,7 +152,7 @@ pub fn sign( let (_, handle_used, sign_data, device_info) = sign_result.unwrap(); - let sig = encode_config(&sign_data, URL_SAFE_NO_PAD); + let sig = encode_config(sign_data, URL_SAFE_NO_PAD); println!("Sign result: {}", sig); println!( diff --git a/plugins/authenticator/src/u2f.rs b/plugins/authenticator/src/u2f.rs index b1f2e280..80eb9497 100644 --- a/plugins/authenticator/src/u2f.rs +++ b/plugins/authenticator/src/u2f.rs @@ -15,7 +15,7 @@ static VERSION: &str = "U2F_V2"; pub fn make_challenge(app_id: &str, challenge_bytes: Vec) -> Challenge { let utc: DateTime = Utc::now(); Challenge { - challenge: encode_config(&challenge_bytes, URL_SAFE_NO_PAD), + challenge: encode_config(challenge_bytes, URL_SAFE_NO_PAD), timestamp: format!("{:?}", utc), app_id: app_id.to_string(), } @@ -35,10 +35,10 @@ pub fn verify_registration( register_data: String, client_data: String, ) -> crate::Result { - let challenge_bytes = decode_config(&challenge, URL_SAFE_NO_PAD)?; + let challenge_bytes = decode_config(challenge, URL_SAFE_NO_PAD)?; let challenge = make_challenge(&app_id, challenge_bytes); let client_data_bytes: Vec = client_data.as_bytes().into(); - let client_data_base64 = encode_config(&client_data_bytes, URL_SAFE_NO_PAD); + let client_data_base64 = encode_config(client_data_bytes, URL_SAFE_NO_PAD); let client = U2f::new(app_id); match client.register_response( challenge, @@ -74,12 +74,12 @@ pub fn verify_signature( key_handle: String, pub_key: String, ) -> crate::Result { - let challenge_bytes = decode_config(&challenge, URL_SAFE_NO_PAD)?; + let challenge_bytes = decode_config(challenge, URL_SAFE_NO_PAD)?; let chal = make_challenge(&app_id, challenge_bytes); let client_data_bytes: Vec = client_data.as_bytes().into(); - let client_data_base64 = encode_config(&client_data_bytes, URL_SAFE_NO_PAD); + let client_data_base64 = encode_config(client_data_bytes, URL_SAFE_NO_PAD); let key_handle_bytes = decode_config(&key_handle, URL_SAFE_NO_PAD)?; - let pubkey_bytes = decode_config(&pub_key, URL_SAFE_NO_PAD)?; + let pubkey_bytes = decode_config(pub_key, URL_SAFE_NO_PAD)?; let client = U2f::new(app_id); let mut _counter: u32 = 0; match client.sign_response( diff --git a/plugins/authenticator/tsconfig.json b/plugins/authenticator/tsconfig.json new file mode 120000 index 00000000..7cd38da8 --- /dev/null +++ b/plugins/authenticator/tsconfig.json @@ -0,0 +1 @@ +../../shared/tsconfig.json \ No newline at end of file diff --git a/plugins/autostart/.gitignore b/plugins/autostart/.gitignore new file mode 100644 index 00000000..b512c09d --- /dev/null +++ b/plugins/autostart/.gitignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/plugins/autostart/README.md b/plugins/autostart/README.md index 6fb45653..f048cd13 100644 --- a/plugins/autostart/README.md +++ b/plugins/autostart/README.md @@ -1,17 +1,59 @@ ![plugin-autostart](banner.png) - +Automatically launch your application at startup. Supports Windows, Mac (via AppleScript or Launch Agent), and Linux. ## Install +There are three general methods of installation that we can recommend. + +1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked) +2. Pull sources directly from Github using git tags / revision hashes (most secure) +3. Git submodule install this repo in your tauri project and then use file protocol to ingest the source (most secure, but inconvenient to use) + +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" } ``` +You can install the JavaScript Guest bindings using your preferred JavaScript package manager: + +> 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-autostart +# or +npm add https://github.com/tauri-apps/tauri-plugin-autostart +# or +yarn add https://github.com/tauri-apps/tauri-plugin-autostart ``` ## Usage +First you need to register the core plugin with Tauri: + +`src-tauri/src/main.rs` +```rust +fn main() { + tauri::Builder::default() + .plugin(tauri_plugin_autostart::init(MacosLauncher::LaunchAgent, Some(vec!["--flag1", "--flag2"]) /* arbitrary number of args to pass to your app */)) + .run(tauri::generate_context!()) + .expect("error while running tauri application"); +} ``` +Afterwards all the plugin's APIs are available through the JavaScript guest bindings: + +```javascript +import { enable, isEnabled, disable } from 'tauri-plugin-autostart-api' + +await enable() + +console.log(`registered for autostart? ${await isEnabled()}`) + +disable() ``` ## Contributing @@ -20,6 +62,6 @@ PRs accepted. Please make sure to read the Contributing Guide before making a pu ## License -Code: (c) 2015 - 2021 - 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. diff --git a/plugins/autostart/guest-js/dist/index.d.ts b/plugins/autostart/guest-js/dist/index.d.ts deleted file mode 100644 index 992c1846..00000000 --- a/plugins/autostart/guest-js/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export declare function isEnabled(): Promise; -export declare function enable(): Promise; -export declare function disable(): Promise; diff --git a/plugins/autostart/guest-js/dist/index.min.js b/plugins/autostart/guest-js/dist/index.min.js deleted file mode 100644 index ec57b5cc..00000000 --- a/plugins/autostart/guest-js/dist/index.min.js +++ /dev/null @@ -1,17 +0,0 @@ -var d=Object.defineProperty;var e=(c,a)=>{for(var b in a)d(c,b,{get:a[b],enumerable:!0});}; - -var f={};e(f,{convertFileSrc:()=>w,invoke:()=>c,transformCallback:()=>s});function u(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function s(e,r=!1){let n=u(),t=`_${n}`;return Object.defineProperty(window,t,{value:o=>(r&&Reflect.deleteProperty(window,t),e==null?void 0:e(o)),writable:!1,configurable:!0}),n}async function c(e,r={}){return new Promise((n,t)=>{let o=s(i=>{n(i),Reflect.deleteProperty(window,`_${a}`);},!0),a=s(i=>{t(i),Reflect.deleteProperty(window,`_${o}`);},!0);window.__TAURI_IPC__({cmd:e,callback:o,error:a,...r});})}function w(e,r="asset"){let n=encodeURIComponent(e);return navigator.userAgent.includes("Windows")?`https://${r}.localhost/${n}`:`${r}://localhost/${n}`} - -// Copyright 2019-2021 Tauri Programme within The Commons Conservancy -async function isEnabled() { - return await c("plugin:autostart|is_enabled"); -} -async function enable() { - await c("plugin:autostart|enable"); -} -async function disable() { - await c("plugin:autostart|disable"); -} - -export { disable, enable, isEnabled }; -//# sourceMappingURL=index.min.js.map diff --git a/plugins/autostart/guest-js/dist/index.min.js.map b/plugins/autostart/guest-js/dist/index.min.js.map deleted file mode 100644 index fe579aa2..00000000 --- a/plugins/autostart/guest-js/dist/index.min.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.min.js","sources":["../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-FEIY7W7S.js","../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-RCPA6UVN.js","../index.ts"],"sourcesContent":["var d=Object.defineProperty;var e=(c,a)=>{for(var b in a)d(c,b,{get:a[b],enumerable:!0})};export{e as a};\n","import{a as d}from\"./chunk-FEIY7W7S.js\";var f={};d(f,{convertFileSrc:()=>w,invoke:()=>c,transformCallback:()=>s});function u(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function s(e,r=!1){let n=u(),t=`_${n}`;return Object.defineProperty(window,t,{value:o=>(r&&Reflect.deleteProperty(window,t),e==null?void 0:e(o)),writable:!1,configurable:!0}),n}async function c(e,r={}){return new Promise((n,t)=>{let o=s(i=>{n(i),Reflect.deleteProperty(window,`_${a}`)},!0),a=s(i=>{t(i),Reflect.deleteProperty(window,`_${o}`)},!0);window.__TAURI_IPC__({cmd:e,callback:o,error:a,...r})})}function w(e,r=\"asset\"){let n=encodeURIComponent(e);return navigator.userAgent.includes(\"Windows\")?`https://${r}.localhost/${n}`:`${r}://localhost/${n}`}export{s as a,c as b,w as c,f as d};\n",null],"names":["d","invoke"],"mappings":"AAAA,IAAI,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAC,CAAC;;ACAjD,IAAI,CAAC,CAAC,EAAE,CAACA,CAAC,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,OAAO,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAA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\ No newline at end of file diff --git a/plugins/autostart/guest-js/dist/index.mjs b/plugins/autostart/guest-js/dist/index.mjs deleted file mode 100644 index 1ad484b9..00000000 --- a/plugins/autostart/guest-js/dist/index.mjs +++ /dev/null @@ -1,15 +0,0 @@ -import { invoke } from '@tauri-apps/api/tauri'; - -// Copyright 2019-2021 Tauri Programme within The Commons Conservancy -async function isEnabled() { - return await invoke("plugin:autostart|is_enabled"); -} -async function enable() { - await invoke("plugin:autostart|enable"); -} -async function disable() { - await invoke("plugin:autostart|disable"); -} - -export { disable, enable, isEnabled }; -//# sourceMappingURL=index.mjs.map diff --git a/plugins/autostart/guest-js/dist/index.mjs.map b/plugins/autostart/guest-js/dist/index.mjs.map deleted file mode 100644 index 3a6571c8..00000000 --- a/plugins/autostart/guest-js/dist/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;AAMO,eAAe,SAAS,GAAA;AAC7B,IAAA,OAAO,MAAM,MAAM,CAAC,6BAA6B,CAAC,CAAC;AACrD,CAAC;AAEM,eAAe,MAAM,GAAA;AAC1B,IAAA,MAAM,MAAM,CAAC,yBAAyB,CAAC,CAAC;AAC1C,CAAC;AAEM,eAAe,OAAO,GAAA;AAC3B,IAAA,MAAM,MAAM,CAAC,0BAA0B,CAAC,CAAC;AAC3C;;;;"} \ No newline at end of file diff --git a/plugins/autostart/guest-js/tsconfig.json b/plugins/autostart/guest-js/tsconfig.json deleted file mode 120000 index 9c2b2da2..00000000 --- a/plugins/autostart/guest-js/tsconfig.json +++ /dev/null @@ -1 +0,0 @@ -../../../shared/tsconfig.json \ No newline at end of file diff --git a/plugins/autostart/guest-js/package.json b/plugins/autostart/package.json similarity index 57% rename from plugins/autostart/guest-js/package.json rename to plugins/autostart/package.json index b854d383..357fc587 100644 --- a/plugins/autostart/guest-js/package.json +++ b/plugins/autostart/package.json @@ -6,20 +6,20 @@ "Tauri Programme within The Commons Conservancy" ], "type": "module", - "browser": "dist/index.min.js", - "module": "dist/index.mjs", - "types": "dist/index.d.ts", + "browser": "guest-js/dist/index.min.js", + "module": "guest-js/dist/index.mjs", + "types": "guest-js/dist/index.d.ts", "exports": { - "import": "./dist/index.mjs", - "types": "./dist/index.d.ts", - "browser": "./dist/index.min.js" + "import": "./guest-js/dist/index.mjs", + "types": "./guest-js/dist/index.d.ts", + "browser": "./guest-js/dist/index.min.js" }, "scripts": { "build": "rollup -c" }, "files": [ - "dist", - "!dist/**/*.map", + "guest-js/dist", + "!guest-js/dist/**/*.map", "README.md", "LICENSE" ], diff --git a/plugins/fs-watch/guest-js/rollup.config.mjs b/plugins/autostart/rollup.config.mjs similarity index 68% rename from plugins/fs-watch/guest-js/rollup.config.mjs rename to plugins/autostart/rollup.config.mjs index ee885522..6555e98b 100644 --- a/plugins/fs-watch/guest-js/rollup.config.mjs +++ b/plugins/autostart/rollup.config.mjs @@ -1,8 +1,9 @@ import { readFileSync } from "fs"; -import { createConfig } from "../../../shared/rollup.config.mjs"; +import { createConfig } from "../../shared/rollup.config.mjs"; export default createConfig({ + input: "guest-js/index.ts", pkg: JSON.parse( readFileSync(new URL("./package.json", import.meta.url), "utf8") ), diff --git a/plugins/autostart/tsconfig.json b/plugins/autostart/tsconfig.json new file mode 120000 index 00000000..7cd38da8 --- /dev/null +++ b/plugins/autostart/tsconfig.json @@ -0,0 +1 @@ +../../shared/tsconfig.json \ No newline at end of file diff --git a/plugins/fs-extra/.gitignore b/plugins/fs-extra/.gitignore new file mode 100644 index 00000000..b512c09d --- /dev/null +++ b/plugins/fs-extra/.gitignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/plugins/fs-extra/README.md b/plugins/fs-extra/README.md index 6047161d..f2b74924 100644 --- a/plugins/fs-extra/README.md +++ b/plugins/fs-extra/README.md @@ -1,17 +1,53 @@ -![plugin-fs-extra](banner.png) - ## Install +There are three general methods of installation that we can recommend. + +1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked) +2. Pull sources directly from Github using git tags / revision hashes (most secure) +3. Git submodule install this repo in your tauri project and then use file protocol to ingest the source (most secure, but inconvenient to use) + +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" } ``` +You can install the JavaScript Guest bindings using your preferred JavaScript package manager: + +> 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-fs-extra +# or +npm add https://github.com/tauri-apps/tauri-plugin-fs-extra +# or +yarn add https://github.com/tauri-apps/tauri-plugin-fs-extra ``` ## Usage +First you need to register the core plugin with Tauri: + +`src-tauri/src/main.rs` +```rust +fn main() { + tauri::Builder::default() + .plugin(tauri_plugin_fs_extra::init()) + .run(tauri::generate_context!()) + .expect("error while running tauri application"); +} ``` +Afterwards all the plugin's APIs are available through the JavaScript guest bindings: + +```javascript +import { metadata } from 'tauri-plugin-fs-extra-api' + +await metadata('/path/to/file') ``` ## Contributing @@ -20,6 +56,6 @@ PRs accepted. Please make sure to read the Contributing Guide before making a pu ## License -Code: (c) 2015 - 2021 - 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. \ No newline at end of file diff --git a/plugins/fs-extra/guest-js/dist/index.d.ts b/plugins/fs-extra/guest-js/dist/index.d.ts deleted file mode 100644 index 1b835801..00000000 --- a/plugins/fs-extra/guest-js/dist/index.d.ts +++ /dev/null @@ -1,87 +0,0 @@ -export interface Permissions { - /** - * `true` if these permissions describe a readonly (unwritable) file. - */ - readonly: boolean; - /** - * The underlying raw `st_mode` bits that contain the standard Unix permissions for this file. - */ - mode: number | undefined; -} -/** - * Metadata information about a file. - * This structure is returned from the `metadata` function or method - * and represents known metadata about a file such as its permissions, size, modification times, etc. - */ -export interface Metadata { - /** - * The last access time of this metadata. - */ - accessedAt: Date; - /** - * The creation time listed in this metadata. - */ - createdAt: Date; - /** - * The last modification time listed in this metadata. - */ - modifiedAt: Date; - /** - * `true` if this metadata is for a directory. - */ - isDir: boolean; - /** - * `true` if this metadata is for a regular file. - */ - isFile: boolean; - /** - * `true` if this metadata is for a symbolic link. - */ - isSymlink: boolean; - /** - * The size of the file, in bytes, this metadata is for. - */ - size: number; - /** - * The permissions of the file this metadata is for. - */ - permissions: Permissions; - /** - * The ID of the device containing the file. Only available on Unix. - */ - dev: number | undefined; - /** - * The inode number. Only available on Unix. - */ - ino: number | undefined; - /** - * The rights applied to this file. Only available on Unix. - */ - mode: number | undefined; - /** - * The number of hard links pointing to this file. Only available on Unix. - */ - nlink: number | undefined; - /** - * The user ID of the owner of this file. Only available on Unix. - */ - uid: number | undefined; - /** - * The group ID of the owner of this file. Only available on Unix. - */ - gid: number | undefined; - /** - * The device ID of this file (if it is a special one). Only available on Unix. - */ - rdev: number | undefined; - /** - * The block size for filesystem I/O. Only available on Unix. - */ - blksize: number | undefined; - /** - * The number of blocks allocated to the file, in 512-byte units. Only available on Unix. - */ - blocks: number | undefined; -} -export declare function metadata(path: string): Promise; -export declare function exists(path: string): Promise; diff --git a/plugins/fs-extra/guest-js/dist/index.min.js b/plugins/fs-extra/guest-js/dist/index.min.js deleted file mode 100644 index 65055aee..00000000 --- a/plugins/fs-extra/guest-js/dist/index.min.js +++ /dev/null @@ -1,24 +0,0 @@ -var d=Object.defineProperty;var e=(c,a)=>{for(var b in a)d(c,b,{get:a[b],enumerable:!0});}; - -var f={};e(f,{convertFileSrc:()=>w,invoke:()=>c,transformCallback:()=>s});function u(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function s(e,r=!1){let n=u(),t=`_${n}`;return Object.defineProperty(window,t,{value:o=>(r&&Reflect.deleteProperty(window,t),e==null?void 0:e(o)),writable:!1,configurable:!0}),n}async function c(e,r={}){return new Promise((n,t)=>{let o=s(i=>{n(i),Reflect.deleteProperty(window,`_${a}`);},!0),a=s(i=>{t(i),Reflect.deleteProperty(window,`_${o}`);},!0);window.__TAURI_IPC__({cmd:e,callback:o,error:a,...r});})}function w(e,r="asset"){let n=encodeURIComponent(e);return navigator.userAgent.includes("Windows")?`https://${r}.localhost/${n}`:`${r}://localhost/${n}`} - -// Copyright 2019-2021 Tauri Programme within The Commons Conservancy -async function metadata(path) { - return await c("plugin:fs-extra|metadata", { - path, - }).then((metadata) => { - const { accessedAtMs, createdAtMs, modifiedAtMs, ...data } = metadata; - return { - accessedAt: new Date(accessedAtMs), - createdAt: new Date(createdAtMs), - modifiedAt: new Date(modifiedAtMs), - ...data, - }; - }); -} -async function exists(path) { - return await c("plugin:fs-extra|exists", { path }); -} - -export { exists, metadata }; -//# sourceMappingURL=index.min.js.map diff --git a/plugins/fs-extra/guest-js/dist/index.min.js.map b/plugins/fs-extra/guest-js/dist/index.min.js.map deleted file mode 100644 index c3af6d13..00000000 --- a/plugins/fs-extra/guest-js/dist/index.min.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.min.js","sources":["../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-FEIY7W7S.js","../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-RCPA6UVN.js","../index.ts"],"sourcesContent":["var d=Object.defineProperty;var e=(c,a)=>{for(var b in a)d(c,b,{get:a[b],enumerable:!0})};export{e as a};\n","import{a as d}from\"./chunk-FEIY7W7S.js\";var f={};d(f,{convertFileSrc:()=>w,invoke:()=>c,transformCallback:()=>s});function u(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function s(e,r=!1){let n=u(),t=`_${n}`;return Object.defineProperty(window,t,{value:o=>(r&&Reflect.deleteProperty(window,t),e==null?void 0:e(o)),writable:!1,configurable:!0}),n}async function c(e,r={}){return new Promise((n,t)=>{let o=s(i=>{n(i),Reflect.deleteProperty(window,`_${a}`)},!0),a=s(i=>{t(i),Reflect.deleteProperty(window,`_${o}`)},!0);window.__TAURI_IPC__({cmd:e,callback:o,error:a,...r})})}function w(e,r=\"asset\"){let n=encodeURIComponent(e);return navigator.userAgent.includes(\"Windows\")?`https://${r}.localhost/${n}`:`${r}://localhost/${n}`}export{s as a,c as b,w as c,f as d};\n",null],"names":["d","invoke"],"mappings":"AAAA,IAAI,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAC,CAAC;;ACAjD,IAAI,CAAC,CAAC,EAAE,CAACA,CAAC,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,OAAO,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAA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AE,GAAG,IAAI,EAAE,GAAG,QAAQ,CAAC;QACtE,OAAO;AACL,YAAA,UAAU,EAAE,IAAI,IAAI,CAAC,YAAY,CAAC;AAClC,YAAA,SAAS,EAAE,IAAI,IAAI,CAAC,WAAW,CAAC;AAChC,YAAA,UAAU,EAAE,IAAI,IAAI,CAAC,YAAY,CAAC;AAClC,YAAA,GAAG,IAAI;SACR,CAAC;AACJ,KAAC,CAAC,CAAC;AACL,CAAC;AAEM,eAAe,MAAM,CAAC,IAAY,EAAA;IACvC,OAAO,MAAMA,CAAM,CAAC,wBAAwB,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;AAC1D;;;;"} \ No newline at end of file diff --git a/plugins/fs-extra/guest-js/dist/index.mjs b/plugins/fs-extra/guest-js/dist/index.mjs deleted file mode 100644 index 0a2b0086..00000000 --- a/plugins/fs-extra/guest-js/dist/index.mjs +++ /dev/null @@ -1,22 +0,0 @@ -import { invoke } from '@tauri-apps/api/tauri'; - -// Copyright 2019-2021 Tauri Programme within The Commons Conservancy -async function metadata(path) { - return await invoke("plugin:fs-extra|metadata", { - path, - }).then((metadata) => { - const { accessedAtMs, createdAtMs, modifiedAtMs, ...data } = metadata; - return { - accessedAt: new Date(accessedAtMs), - createdAt: new Date(createdAtMs), - modifiedAt: new Date(modifiedAtMs), - ...data, - }; - }); -} -async function exists(path) { - return await invoke("plugin:fs-extra|exists", { path }); -} - -export { exists, metadata }; -//# sourceMappingURL=index.mjs.map diff --git a/plugins/fs-extra/guest-js/dist/index.mjs.map b/plugins/fs-extra/guest-js/dist/index.mjs.map deleted file mode 100644 index 91824ef2..00000000 --- a/plugins/fs-extra/guest-js/dist/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;AAiHO,eAAe,QAAQ,CAAC,IAAY,EAAA;AACzC,IAAA,OAAO,MAAM,MAAM,CAAkB,0BAA0B,EAAE;QAC/D,IAAI;AACL,KAAA,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,KAAI;AACnB,QAAA,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,GAAG,IAAI,EAAE,GAAG,QAAQ,CAAC;QACtE,OAAO;AACL,YAAA,UAAU,EAAE,IAAI,IAAI,CAAC,YAAY,CAAC;AAClC,YAAA,SAAS,EAAE,IAAI,IAAI,CAAC,WAAW,CAAC;AAChC,YAAA,UAAU,EAAE,IAAI,IAAI,CAAC,YAAY,CAAC;AAClC,YAAA,GAAG,IAAI;SACR,CAAC;AACJ,KAAC,CAAC,CAAC;AACL,CAAC;AAEM,eAAe,MAAM,CAAC,IAAY,EAAA;IACvC,OAAO,MAAM,MAAM,CAAC,wBAAwB,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;AAC1D;;;;"} \ No newline at end of file diff --git a/plugins/fs-extra/guest-js/tsconfig.json b/plugins/fs-extra/guest-js/tsconfig.json deleted file mode 120000 index 9c2b2da2..00000000 --- a/plugins/fs-extra/guest-js/tsconfig.json +++ /dev/null @@ -1 +0,0 @@ -../../../shared/tsconfig.json \ No newline at end of file diff --git a/plugins/fs-extra/guest-js/package.json b/plugins/fs-extra/package.json similarity index 63% rename from plugins/fs-extra/guest-js/package.json rename to plugins/fs-extra/package.json index 2feb2115..8929b996 100644 --- a/plugins/fs-extra/guest-js/package.json +++ b/plugins/fs-extra/package.json @@ -6,13 +6,13 @@ "Tauri Programme within The Commons Conservancy" ], "type": "module", - "browser": "dist/index.min.js", - "module": "dist/index.mjs", - "types": "dist/index.d.ts", + "browser": "guest-js/dist/index.min.js", + "module": "guest-js/dist/index.mjs", + "types": "guest-js/dist/index.d.ts", "exports": { - "import": "./dist/index.mjs", - "types": "./dist/index.d.ts", - "browser": "./dist/index.min.js" + "import": "./guest-js/dist/index.mjs", + "types": "./guest-js/dist/index.d.ts", + "browser": "./guest-js/dist/index.min.js" }, "scripts": { "build": "rollup -c" diff --git a/plugins/autostart/guest-js/rollup.config.mjs b/plugins/fs-extra/rollup.config.mjs similarity index 68% rename from plugins/autostart/guest-js/rollup.config.mjs rename to plugins/fs-extra/rollup.config.mjs index ee885522..6555e98b 100644 --- a/plugins/autostart/guest-js/rollup.config.mjs +++ b/plugins/fs-extra/rollup.config.mjs @@ -1,8 +1,9 @@ import { readFileSync } from "fs"; -import { createConfig } from "../../../shared/rollup.config.mjs"; +import { createConfig } from "../../shared/rollup.config.mjs"; export default createConfig({ + input: "guest-js/index.ts", pkg: JSON.parse( readFileSync(new URL("./package.json", import.meta.url), "utf8") ), diff --git a/plugins/fs-extra/tsconfig.json b/plugins/fs-extra/tsconfig.json new file mode 120000 index 00000000..7cd38da8 --- /dev/null +++ b/plugins/fs-extra/tsconfig.json @@ -0,0 +1 @@ +../../shared/tsconfig.json \ No newline at end of file diff --git a/plugins/fs-watch/.gitignore b/plugins/fs-watch/.gitignore new file mode 100644 index 00000000..b512c09d --- /dev/null +++ b/plugins/fs-watch/.gitignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/plugins/fs-watch/README.md b/plugins/fs-watch/README.md index 1c11acf0..4a0d65c0 100644 --- a/plugins/fs-watch/README.md +++ b/plugins/fs-watch/README.md @@ -1,17 +1,62 @@ ![plugin-fs-watch](banner.png) - +Watch changes on files and directories through [notify](https://github.com/notify-rs/notify). ## Install +There are three general methods of installation that we can recommend. + +1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked) +2. Pull sources directly from Github using git tags / revision hashes (most secure) +3. Git submodule install this repo in your tauri project and then use file protocol to ingest the source (most secure, but inconvenient to use) + +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" } ``` +You can install the JavaScript Guest bindings using your preferred JavaScript package manager: + +> 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-fs-watch +# or +npm add https://github.com/tauri-apps/tauri-plugin-fs-watch +# or +yarn add https://github.com/tauri-apps/tauri-plugin-fs-watch ``` ## Usage +First you need to register the core plugin with Tauri: + +`src-tauri/src/main.rs` +```rust +fn main() { + tauri::Builder::default() + .plugin(tauri_plugin_fs_watch::init()) + .run(tauri::generate_context!()) + .expect("error while running tauri application"); +} ``` +Afterwards all the plugin's APIs are available through the JavaScript guest bindings: + +```javascript +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 +}) ``` ## Contributing @@ -20,6 +65,6 @@ PRs accepted. Please make sure to read the Contributing Guide before making a pu ## License -Code: (c) 2015 - 2021 - 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. diff --git a/plugins/fs-watch/guest-js/dist/index.d.ts b/plugins/fs-watch/guest-js/dist/index.d.ts deleted file mode 100644 index a9219d0d..00000000 --- a/plugins/fs-watch/guest-js/dist/index.d.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { UnlistenFn } from "@tauri-apps/api/event"; -export interface WatchOptions { - recursive?: boolean; -} -export interface DebouncedWatchOptions extends WatchOptions { - delayMs?: number; -} -export interface RawEvent { - path: string | null; - operation: number; - cookie: number | null; -} -export type DebouncedEvent = { - type: "NoticeWrite"; - payload: string; -} | { - type: "NoticeRemove"; - payload: string; -} | { - type: "Create"; - payload: string; -} | { - type: "Write"; - payload: string; -} | { - type: "Chmod"; - payload: string; -} | { - type: "Remove"; - payload: string; -} | { - type: "Rename"; - payload: string; -} | { - type: "Rescan"; - payload: null; -} | { - type: "Error"; - payload: { - error: string; - path: string | null; - }; -}; -export declare function watch(paths: string | string[], options: DebouncedWatchOptions, cb: (event: DebouncedEvent) => void): Promise; -export declare function watchImmediate(paths: string | string[], options: WatchOptions, cb: (event: RawEvent) => void): Promise; diff --git a/plugins/fs-watch/guest-js/dist/index.min.js b/plugins/fs-watch/guest-js/dist/index.min.js deleted file mode 100644 index bbd71b61..00000000 --- a/plugins/fs-watch/guest-js/dist/index.min.js +++ /dev/null @@ -1,72 +0,0 @@ -var d=Object.defineProperty;var e=(c,a)=>{for(var b in a)d(c,b,{get:a[b],enumerable:!0});}; - -var f$1={};e(f$1,{convertFileSrc:()=>w$1,invoke:()=>c$2,transformCallback:()=>s$2});function u$2(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function s$2(e,r=!1){let n=u$2(),t=`_${n}`;return Object.defineProperty(window,t,{value:o=>(r&&Reflect.deleteProperty(window,t),e==null?void 0:e(o)),writable:!1,configurable:!0}),n}async function c$2(e,r={}){return new Promise((n,t)=>{let o=s$2(i=>{n(i),Reflect.deleteProperty(window,`_${a}`);},!0),a=s$2(i=>{t(i),Reflect.deleteProperty(window,`_${o}`);},!0);window.__TAURI_IPC__({cmd:e,callback:o,error:a,...r});})}function w$1(e,r="asset"){let n=encodeURIComponent(e);return navigator.userAgent.includes("Windows")?`https://${r}.localhost/${n}`:`${r}://localhost/${n}`} - -async function a(i){return c$2("tauri",i)} - -var W$1={};e(W$1,{TauriEvent:()=>c$1,emit:()=>D,listen:()=>E$1,once:()=>_});async function s$1(n,t){return a({__tauriModule:"Event",message:{cmd:"unlisten",event:n,eventId:t}})}async function m$1(n,t,i){await a({__tauriModule:"Event",message:{cmd:"emit",event:n,windowLabel:t,payload:i}});}async function o$1(n,t,i){return a({__tauriModule:"Event",message:{cmd:"listen",event:n,windowLabel:t,handler:s$2(i)}}).then(r=>async()=>s$1(n,r))}async function u$1(n,t,i){return o$1(n,t,r=>{i(r),s$1(n,r.id).catch(()=>{});})}var c$1=(e=>(e.WINDOW_RESIZED="tauri://resize",e.WINDOW_MOVED="tauri://move",e.WINDOW_CLOSE_REQUESTED="tauri://close-requested",e.WINDOW_CREATED="tauri://window-created",e.WINDOW_DESTROYED="tauri://destroyed",e.WINDOW_FOCUS="tauri://focus",e.WINDOW_BLUR="tauri://blur",e.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",e.WINDOW_THEME_CHANGED="tauri://theme-changed",e.WINDOW_FILE_DROP="tauri://file-drop",e.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover",e.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled",e.MENU="tauri://menu",e.CHECK_UPDATE="tauri://update",e.UPDATE_AVAILABLE="tauri://update-available",e.INSTALL_UPDATE="tauri://update-install",e.STATUS_UPDATE="tauri://update-status",e.DOWNLOAD_PROGRESS="tauri://update-download-progress",e))(c$1||{});async function E$1(n,t){return o$1(n,null,t)}async function _(n,t){return u$1(n,null,t)}async function D(n,t){return m$1(n,void 0,t)} - -var C={};e(C,{CloseRequestedEvent:()=>y,LogicalPosition:()=>c,LogicalSize:()=>m,PhysicalPosition:()=>o,PhysicalSize:()=>l,UserAttentionType:()=>W,WebviewWindow:()=>s,WebviewWindowHandle:()=>u,WindowManager:()=>h,appWindow:()=>b,availableMonitors:()=>T,currentMonitor:()=>E,getAll:()=>M,getCurrent:()=>f,primaryMonitor:()=>z});var m=class{constructor(e,a){this.type="Logical";this.width=e,this.height=a;}},l=class{constructor(e,a){this.type="Physical";this.width=e,this.height=a;}toLogical(e){return new m(this.width/e,this.height/e)}},c=class{constructor(e,a){this.type="Logical";this.x=e,this.y=a;}},o=class{constructor(e,a){this.type="Physical";this.x=e,this.y=a;}toLogical(e){return new c(this.x/e,this.y/e)}},W=(a=>(a[a.Critical=1]="Critical",a[a.Informational=2]="Informational",a))(W||{});function f(){return new s(window.__TAURI_METADATA__.__currentWindow.label,{skip:!0})}function M(){return window.__TAURI_METADATA__.__windows.map(i=>new s(i.label,{skip:!0}))}var P=["tauri://created","tauri://error"],u=class{constructor(e){this.label=e,this.listeners=Object.create(null);}async listen(e,a){return this._handleTauriEvent(e,a)?Promise.resolve(()=>{let n=this.listeners[e];n.splice(n.indexOf(a),1);}):o$1(e,this.label,a)}async once(e,a){return this._handleTauriEvent(e,a)?Promise.resolve(()=>{let n=this.listeners[e];n.splice(n.indexOf(a),1);}):u$1(e,this.label,a)}async emit(e,a){if(P.includes(e)){for(let n of this.listeners[e]||[])n({event:e,id:-1,windowLabel:this.label,payload:a});return Promise.resolve()}return m$1(e,this.label,a)}_handleTauriEvent(e,a){return P.includes(e)?(e in this.listeners?this.listeners[e].push(a):this.listeners[e]=[a],!0):!1}},h=class extends u{async scaleFactor(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"scaleFactor"}}}})}async innerPosition(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"innerPosition"}}}}).then(({x:e,y:a})=>new o(e,a))}async outerPosition(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"outerPosition"}}}}).then(({x:e,y:a})=>new o(e,a))}async innerSize(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"innerSize"}}}}).then(({width:e,height:a})=>new l(e,a))}async outerSize(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"outerSize"}}}}).then(({width:e,height:a})=>new l(e,a))}async isFullscreen(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"isFullscreen"}}}})}async isMaximized(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"isMaximized"}}}})}async isDecorated(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"isDecorated"}}}})}async isResizable(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"isResizable"}}}})}async isVisible(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"isVisible"}}}})}async theme(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"theme"}}}})}async center(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"center"}}}})}async requestUserAttention(e){let a$1=null;return e&&(e===1?a$1={type:"Critical"}:a$1={type:"Informational"}),a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"requestUserAttention",payload:a$1}}}})}async setResizable(e){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setResizable",payload:e}}}})}async setTitle(e){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setTitle",payload:e}}}})}async maximize(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"maximize"}}}})}async unmaximize(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"unmaximize"}}}})}async toggleMaximize(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"toggleMaximize"}}}})}async minimize(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"minimize"}}}})}async unminimize(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"unminimize"}}}})}async show(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"show"}}}})}async hide(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"hide"}}}})}async close(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"close"}}}})}async setDecorations(e){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setDecorations",payload:e}}}})}async setAlwaysOnTop(e){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setAlwaysOnTop",payload:e}}}})}async setSize(e){if(!e||e.type!=="Logical"&&e.type!=="Physical")throw new Error("the `size` argument must be either a LogicalSize or a PhysicalSize instance");return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setSize",payload:{type:e.type,data:{width:e.width,height:e.height}}}}}})}async setMinSize(e){if(e&&e.type!=="Logical"&&e.type!=="Physical")throw new Error("the `size` argument must be either a LogicalSize or a PhysicalSize instance");return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setMinSize",payload:e?{type:e.type,data:{width:e.width,height:e.height}}:null}}}})}async setMaxSize(e){if(e&&e.type!=="Logical"&&e.type!=="Physical")throw new Error("the `size` argument must be either a LogicalSize or a PhysicalSize instance");return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setMaxSize",payload:e?{type:e.type,data:{width:e.width,height:e.height}}:null}}}})}async setPosition(e){if(!e||e.type!=="Logical"&&e.type!=="Physical")throw new Error("the `position` argument must be either a LogicalPosition or a PhysicalPosition instance");return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setPosition",payload:{type:e.type,data:{x:e.x,y:e.y}}}}}})}async setFullscreen(e){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setFullscreen",payload:e}}}})}async setFocus(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setFocus"}}}})}async setIcon(e){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setIcon",payload:{icon:typeof e=="string"?e:Array.from(e)}}}}})}async setSkipTaskbar(e){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setSkipTaskbar",payload:e}}}})}async setCursorGrab(e){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setCursorGrab",payload:e}}}})}async setCursorVisible(e){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setCursorVisible",payload:e}}}})}async setCursorIcon(e){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setCursorIcon",payload:e}}}})}async setCursorPosition(e){if(!e||e.type!=="Logical"&&e.type!=="Physical")throw new Error("the `position` argument must be either a LogicalPosition or a PhysicalPosition instance");return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setCursorPosition",payload:{type:e.type,data:{x:e.x,y:e.y}}}}}})}async setIgnoreCursorEvents(e){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setIgnoreCursorEvents",payload:e}}}})}async startDragging(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"startDragging"}}}})}async onResized(e){return this.listen("tauri://resize",e)}async onMoved(e){return this.listen("tauri://move",e)}async onCloseRequested(e){return this.listen("tauri://close-requested",a=>{let n=new y(a);Promise.resolve(e(n)).then(()=>{if(!n.isPreventDefault())return this.close()});})}async onFocusChanged(e){let a=await this.listen("tauri://focus",d=>{e({...d,payload:!0});}),n=await this.listen("tauri://blur",d=>{e({...d,payload:!1});});return ()=>{a(),n();}}async onScaleChanged(e){return this.listen("tauri://scale-change",e)}async onMenuClicked(e){return this.listen("tauri://menu",e)}async onFileDropEvent(e){let a=await this.listen("tauri://file-drop",r=>{e({...r,payload:{type:"drop",paths:r.payload}});}),n=await this.listen("tauri://file-drop-hover",r=>{e({...r,payload:{type:"hover",paths:r.payload}});}),d=await this.listen("tauri://file-drop-cancelled",r=>{e({...r,payload:{type:"cancel"}});});return ()=>{a(),n(),d();}}async onThemeChanged(e){return this.listen("tauri://theme-changed",e)}},y=class{constructor(e){this._preventDefault=!1;this.event=e.event,this.windowLabel=e.windowLabel,this.id=e.id;}preventDefault(){this._preventDefault=!0;}isPreventDefault(){return this._preventDefault}},s=class extends h{constructor(e,a$1={}){super(e),a$1!=null&&a$1.skip||a({__tauriModule:"Window",message:{cmd:"createWebview",data:{options:{label:e,...a$1}}}}).then(async()=>this.emit("tauri://created")).catch(async n=>this.emit("tauri://error",n));}static getByLabel(e){return M().some(a=>a.label===e)?new s(e,{skip:!0}):null}},b;"__TAURI_METADATA__"in window?b=new s(window.__TAURI_METADATA__.__currentWindow.label,{skip:!0}):(console.warn(`Could not find "window.__TAURI_METADATA__". The "appWindow" value will reference the "main" window label. -Note that this is not an issue if running this frontend on a browser instead of a Tauri window.`),b=new s("main",{skip:!0}));function g(i){return i===null?null:{name:i.name,scaleFactor:i.scaleFactor,position:new o(i.position.x,i.position.y),size:new l(i.size.width,i.size.height)}}async function E(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{cmd:{type:"currentMonitor"}}}}).then(g)}async function z(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{cmd:{type:"primaryMonitor"}}}}).then(g)}async function T(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{cmd:{type:"availableMonitors"}}}}).then(i=>i.map(g))} - -const w = b; -async function unwatch(id) { - await c$2("plugin:fs-watch|unwatch", { id }); -} -async function watch(paths, options, cb) { - const opts = { - recursive: false, - delayMs: 2000, - ...options, - }; - let watchPaths; - if (typeof paths === "string") { - watchPaths = [paths]; - } - else { - watchPaths = paths; - } - const id = window.crypto.getRandomValues(new Uint32Array(1))[0]; - await c$2("plugin:fs-watch|watch", { - id, - paths: watchPaths, - options: opts, - }); - const unlisten = await w.listen(`watcher://debounced-event/${id}`, (event) => { - cb(event.payload); - }); - return () => { - void unwatch(id); - unlisten(); - }; -} -async function watchImmediate(paths, options, cb) { - const opts = { - recursive: false, - ...options, - delayMs: null, - }; - let watchPaths; - if (typeof paths === "string") { - watchPaths = [paths]; - } - else { - watchPaths = paths; - } - const id = window.crypto.getRandomValues(new Uint32Array(1))[0]; - await c$2("plugin:fs-watch|watch", { - id, - paths: watchPaths, - options: opts, - }); - const unlisten = await w.listen(`watcher://raw-event/${id}`, (event) => { - cb(event.payload); - }); - return () => { - void unwatch(id); - unlisten(); - }; -} - -export { watch, watchImmediate }; -//# sourceMappingURL=index.min.js.map diff --git a/plugins/fs-watch/guest-js/dist/index.min.js.map b/plugins/fs-watch/guest-js/dist/index.min.js.map deleted file mode 100644 index a1caa25f..00000000 --- a/plugins/fs-watch/guest-js/dist/index.min.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.min.js","sources":["../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-FEIY7W7S.js","../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-RCPA6UVN.js","../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-HNLFKTAJ.js","../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-3WDDWFXT.js","../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-QSWLDHGO.js","../index.ts"],"sourcesContent":["var d=Object.defineProperty;var e=(c,a)=>{for(var b in a)d(c,b,{get:a[b],enumerable:!0})};export{e as a};\n","import{a as d}from\"./chunk-FEIY7W7S.js\";var f={};d(f,{convertFileSrc:()=>w,invoke:()=>c,transformCallback:()=>s});function u(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function s(e,r=!1){let n=u(),t=`_${n}`;return Object.defineProperty(window,t,{value:o=>(r&&Reflect.deleteProperty(window,t),e==null?void 0:e(o)),writable:!1,configurable:!0}),n}async function c(e,r={}){return new Promise((n,t)=>{let o=s(i=>{n(i),Reflect.deleteProperty(window,`_${a}`)},!0),a=s(i=>{t(i),Reflect.deleteProperty(window,`_${o}`)},!0);window.__TAURI_IPC__({cmd:e,callback:o,error:a,...r})})}function w(e,r=\"asset\"){let n=encodeURIComponent(e);return navigator.userAgent.includes(\"Windows\")?`https://${r}.localhost/${n}`:`${r}://localhost/${n}`}export{s as a,c as b,w as c,f as d};\n","import{b as o}from\"./chunk-RCPA6UVN.js\";async function a(i){return o(\"tauri\",i)}export{a};\n","import{a}from\"./chunk-HNLFKTAJ.js\";import{a as l}from\"./chunk-RCPA6UVN.js\";import{a as d}from\"./chunk-FEIY7W7S.js\";var W={};d(W,{TauriEvent:()=>c,emit:()=>D,listen:()=>E,once:()=>_});async function s(n,t){return a({__tauriModule:\"Event\",message:{cmd:\"unlisten\",event:n,eventId:t}})}async function m(n,t,i){await a({__tauriModule:\"Event\",message:{cmd:\"emit\",event:n,windowLabel:t,payload:i}})}async function o(n,t,i){return a({__tauriModule:\"Event\",message:{cmd:\"listen\",event:n,windowLabel:t,handler:l(i)}}).then(r=>async()=>s(n,r))}async function u(n,t,i){return o(n,t,r=>{i(r),s(n,r.id).catch(()=>{})})}var c=(e=>(e.WINDOW_RESIZED=\"tauri://resize\",e.WINDOW_MOVED=\"tauri://move\",e.WINDOW_CLOSE_REQUESTED=\"tauri://close-requested\",e.WINDOW_CREATED=\"tauri://window-created\",e.WINDOW_DESTROYED=\"tauri://destroyed\",e.WINDOW_FOCUS=\"tauri://focus\",e.WINDOW_BLUR=\"tauri://blur\",e.WINDOW_SCALE_FACTOR_CHANGED=\"tauri://scale-change\",e.WINDOW_THEME_CHANGED=\"tauri://theme-changed\",e.WINDOW_FILE_DROP=\"tauri://file-drop\",e.WINDOW_FILE_DROP_HOVER=\"tauri://file-drop-hover\",e.WINDOW_FILE_DROP_CANCELLED=\"tauri://file-drop-cancelled\",e.MENU=\"tauri://menu\",e.CHECK_UPDATE=\"tauri://update\",e.UPDATE_AVAILABLE=\"tauri://update-available\",e.INSTALL_UPDATE=\"tauri://update-install\",e.STATUS_UPDATE=\"tauri://update-status\",e.DOWNLOAD_PROGRESS=\"tauri://update-download-progress\",e))(c||{});async function E(n,t){return o(n,null,t)}async function _(n,t){return u(n,null,t)}async function D(n,t){return m(n,void 0,t)}export{m as a,o as b,u as c,c as d,E as e,_ as f,D as g,W as h};\n","import{a as p,b as _,c as w}from\"./chunk-3WDDWFXT.js\";import{a as t}from\"./chunk-HNLFKTAJ.js\";import{a as v}from\"./chunk-FEIY7W7S.js\";var C={};v(C,{CloseRequestedEvent:()=>y,LogicalPosition:()=>c,LogicalSize:()=>m,PhysicalPosition:()=>o,PhysicalSize:()=>l,UserAttentionType:()=>W,WebviewWindow:()=>s,WebviewWindowHandle:()=>u,WindowManager:()=>h,appWindow:()=>b,availableMonitors:()=>T,currentMonitor:()=>E,getAll:()=>M,getCurrent:()=>f,primaryMonitor:()=>z});var m=class{constructor(e,a){this.type=\"Logical\";this.width=e,this.height=a}},l=class{constructor(e,a){this.type=\"Physical\";this.width=e,this.height=a}toLogical(e){return new m(this.width/e,this.height/e)}},c=class{constructor(e,a){this.type=\"Logical\";this.x=e,this.y=a}},o=class{constructor(e,a){this.type=\"Physical\";this.x=e,this.y=a}toLogical(e){return new c(this.x/e,this.y/e)}},W=(a=>(a[a.Critical=1]=\"Critical\",a[a.Informational=2]=\"Informational\",a))(W||{});function f(){return new s(window.__TAURI_METADATA__.__currentWindow.label,{skip:!0})}function M(){return window.__TAURI_METADATA__.__windows.map(i=>new s(i.label,{skip:!0}))}var P=[\"tauri://created\",\"tauri://error\"],u=class{constructor(e){this.label=e,this.listeners=Object.create(null)}async listen(e,a){return this._handleTauriEvent(e,a)?Promise.resolve(()=>{let n=this.listeners[e];n.splice(n.indexOf(a),1)}):_(e,this.label,a)}async once(e,a){return this._handleTauriEvent(e,a)?Promise.resolve(()=>{let n=this.listeners[e];n.splice(n.indexOf(a),1)}):w(e,this.label,a)}async emit(e,a){if(P.includes(e)){for(let n of this.listeners[e]||[])n({event:e,id:-1,windowLabel:this.label,payload:a});return Promise.resolve()}return p(e,this.label,a)}_handleTauriEvent(e,a){return P.includes(e)?(e in this.listeners?this.listeners[e].push(a):this.listeners[e]=[a],!0):!1}},h=class extends u{async scaleFactor(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"scaleFactor\"}}}})}async innerPosition(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"innerPosition\"}}}}).then(({x:e,y:a})=>new o(e,a))}async outerPosition(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"outerPosition\"}}}}).then(({x:e,y:a})=>new o(e,a))}async innerSize(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"innerSize\"}}}}).then(({width:e,height:a})=>new l(e,a))}async outerSize(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"outerSize\"}}}}).then(({width:e,height:a})=>new l(e,a))}async isFullscreen(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"isFullscreen\"}}}})}async isMaximized(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"isMaximized\"}}}})}async isDecorated(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"isDecorated\"}}}})}async isResizable(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"isResizable\"}}}})}async isVisible(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"isVisible\"}}}})}async theme(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"theme\"}}}})}async center(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"center\"}}}})}async requestUserAttention(e){let a=null;return e&&(e===1?a={type:\"Critical\"}:a={type:\"Informational\"}),t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"requestUserAttention\",payload:a}}}})}async setResizable(e){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setResizable\",payload:e}}}})}async setTitle(e){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setTitle\",payload:e}}}})}async maximize(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"maximize\"}}}})}async unmaximize(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"unmaximize\"}}}})}async toggleMaximize(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"toggleMaximize\"}}}})}async minimize(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"minimize\"}}}})}async unminimize(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"unminimize\"}}}})}async show(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"show\"}}}})}async hide(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"hide\"}}}})}async close(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"close\"}}}})}async setDecorations(e){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setDecorations\",payload:e}}}})}async setAlwaysOnTop(e){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setAlwaysOnTop\",payload:e}}}})}async setSize(e){if(!e||e.type!==\"Logical\"&&e.type!==\"Physical\")throw new Error(\"the `size` argument must be either a LogicalSize or a PhysicalSize instance\");return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setSize\",payload:{type:e.type,data:{width:e.width,height:e.height}}}}}})}async setMinSize(e){if(e&&e.type!==\"Logical\"&&e.type!==\"Physical\")throw new Error(\"the `size` argument must be either a LogicalSize or a PhysicalSize instance\");return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setMinSize\",payload:e?{type:e.type,data:{width:e.width,height:e.height}}:null}}}})}async setMaxSize(e){if(e&&e.type!==\"Logical\"&&e.type!==\"Physical\")throw new Error(\"the `size` argument must be either a LogicalSize or a PhysicalSize instance\");return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setMaxSize\",payload:e?{type:e.type,data:{width:e.width,height:e.height}}:null}}}})}async setPosition(e){if(!e||e.type!==\"Logical\"&&e.type!==\"Physical\")throw new Error(\"the `position` argument must be either a LogicalPosition or a PhysicalPosition instance\");return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setPosition\",payload:{type:e.type,data:{x:e.x,y:e.y}}}}}})}async setFullscreen(e){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setFullscreen\",payload:e}}}})}async setFocus(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setFocus\"}}}})}async setIcon(e){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setIcon\",payload:{icon:typeof e==\"string\"?e:Array.from(e)}}}}})}async setSkipTaskbar(e){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setSkipTaskbar\",payload:e}}}})}async setCursorGrab(e){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setCursorGrab\",payload:e}}}})}async setCursorVisible(e){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setCursorVisible\",payload:e}}}})}async setCursorIcon(e){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setCursorIcon\",payload:e}}}})}async setCursorPosition(e){if(!e||e.type!==\"Logical\"&&e.type!==\"Physical\")throw new Error(\"the `position` argument must be either a LogicalPosition or a PhysicalPosition instance\");return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setCursorPosition\",payload:{type:e.type,data:{x:e.x,y:e.y}}}}}})}async setIgnoreCursorEvents(e){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setIgnoreCursorEvents\",payload:e}}}})}async startDragging(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"startDragging\"}}}})}async onResized(e){return this.listen(\"tauri://resize\",e)}async onMoved(e){return this.listen(\"tauri://move\",e)}async onCloseRequested(e){return this.listen(\"tauri://close-requested\",a=>{let n=new y(a);Promise.resolve(e(n)).then(()=>{if(!n.isPreventDefault())return this.close()})})}async onFocusChanged(e){let a=await this.listen(\"tauri://focus\",d=>{e({...d,payload:!0})}),n=await this.listen(\"tauri://blur\",d=>{e({...d,payload:!1})});return()=>{a(),n()}}async onScaleChanged(e){return this.listen(\"tauri://scale-change\",e)}async onMenuClicked(e){return this.listen(\"tauri://menu\",e)}async onFileDropEvent(e){let a=await this.listen(\"tauri://file-drop\",r=>{e({...r,payload:{type:\"drop\",paths:r.payload}})}),n=await this.listen(\"tauri://file-drop-hover\",r=>{e({...r,payload:{type:\"hover\",paths:r.payload}})}),d=await this.listen(\"tauri://file-drop-cancelled\",r=>{e({...r,payload:{type:\"cancel\"}})});return()=>{a(),n(),d()}}async onThemeChanged(e){return this.listen(\"tauri://theme-changed\",e)}},y=class{constructor(e){this._preventDefault=!1;this.event=e.event,this.windowLabel=e.windowLabel,this.id=e.id}preventDefault(){this._preventDefault=!0}isPreventDefault(){return this._preventDefault}},s=class extends h{constructor(e,a={}){super(e),a!=null&&a.skip||t({__tauriModule:\"Window\",message:{cmd:\"createWebview\",data:{options:{label:e,...a}}}}).then(async()=>this.emit(\"tauri://created\")).catch(async n=>this.emit(\"tauri://error\",n))}static getByLabel(e){return M().some(a=>a.label===e)?new s(e,{skip:!0}):null}},b;\"__TAURI_METADATA__\"in window?b=new s(window.__TAURI_METADATA__.__currentWindow.label,{skip:!0}):(console.warn(`Could not find \"window.__TAURI_METADATA__\". The \"appWindow\" value will reference the \"main\" window label.\nNote that this is not an issue if running this frontend on a browser instead of a Tauri window.`),b=new s(\"main\",{skip:!0}));function g(i){return i===null?null:{name:i.name,scaleFactor:i.scaleFactor,position:new o(i.position.x,i.position.y),size:new l(i.size.width,i.size.height)}}async function E(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{cmd:{type:\"currentMonitor\"}}}}).then(g)}async function z(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{cmd:{type:\"primaryMonitor\"}}}}).then(g)}async function T(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{cmd:{type:\"availableMonitors\"}}}}).then(i=>i.map(g))}export{m as a,l as b,c,o as d,W as e,f,M as g,u as h,h as i,y as j,s as k,b as l,E as m,z as n,T as o,C as p};\n",null],"names":["f","d","w","c","s","u","o","W","E","m","l","v","_","p","t","a","appWindow","invoke"],"mappings":"AAAA,IAAI,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAC,CAAC;;ACAjD,IAAIA,GAAC,CAAC,EAAE,CAACC,CAAC,CAACD,GAAC,CAAC,CAAC,cAAc,CAAC,IAAIE,GAAC,CAAC,MAAM,CAAC,IAAIC,GAAC,CAAC,iBAAiB,CAAC,IAAIC,GAAC,CAAC,CAAC,CAAC,SAASC,GAAC,EAAE,CAAC,OAAO,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAASD,GAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAACC,GAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC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M,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAEhE,MAAMA,GAAM,CAAC,uBAAuB,EAAE;QACpC,EAAE;AACF,QAAA,KAAK,EAAE,UAAU;AACjB,QAAA,OAAO,EAAE,IAAI;AACd,KAAA,CAAC,CAAC;AAEH,IAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,CAAC,MAAM,CAC7B,CAAuB,oBAAA,EAAA,EAAE,CAAE,CAAA,EAC3B,CAAC,KAAK,KAAI;AACR,QAAA,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AACpB,KAAC,CACF,CAAC;AAEF,IAAA,OAAO,MAAK;AACV,QAAA,KAAK,OAAO,CAAC,EAAE,CAAC,CAAC;AACjB,QAAA,QAAQ,EAAE,CAAC;AACb,KAAC,CAAC;AACJ;;;;"} \ No newline at end of file diff --git a/plugins/fs-watch/guest-js/dist/index.mjs b/plugins/fs-watch/guest-js/dist/index.mjs deleted file mode 100644 index 6d876a15..00000000 --- a/plugins/fs-watch/guest-js/dist/index.mjs +++ /dev/null @@ -1,64 +0,0 @@ -import { invoke } from '@tauri-apps/api/tauri'; -import { appWindow } from '@tauri-apps/api/window'; - -const w = appWindow; -async function unwatch(id) { - await invoke("plugin:fs-watch|unwatch", { id }); -} -async function watch(paths, options, cb) { - const opts = { - recursive: false, - delayMs: 2000, - ...options, - }; - let watchPaths; - if (typeof paths === "string") { - watchPaths = [paths]; - } - else { - watchPaths = paths; - } - const id = window.crypto.getRandomValues(new Uint32Array(1))[0]; - await invoke("plugin:fs-watch|watch", { - id, - paths: watchPaths, - options: opts, - }); - const unlisten = await w.listen(`watcher://debounced-event/${id}`, (event) => { - cb(event.payload); - }); - return () => { - void unwatch(id); - unlisten(); - }; -} -async function watchImmediate(paths, options, cb) { - const opts = { - recursive: false, - ...options, - delayMs: null, - }; - let watchPaths; - if (typeof paths === "string") { - watchPaths = [paths]; - } - else { - watchPaths = paths; - } - const id = window.crypto.getRandomValues(new Uint32Array(1))[0]; - await invoke("plugin:fs-watch|watch", { - id, - paths: watchPaths, - options: opts, - }); - const unlisten = await w.listen(`watcher://raw-event/${id}`, (event) => { - cb(event.payload); - }); - return () => { - void unwatch(id); - unlisten(); - }; -} - -export { watch, watchImmediate }; -//# sourceMappingURL=index.mjs.map diff --git a/plugins/fs-watch/guest-js/dist/index.mjs.map b/plugins/fs-watch/guest-js/dist/index.mjs.map deleted file mode 100644 index 29007a2d..00000000 --- a/plugins/fs-watch/guest-js/dist/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAIA,MAAM,CAAC,GAAkB,SAAS,CAAC;AA2BnC,eAAe,OAAO,CAAC,EAAU,EAAA;IAC/B,MAAM,MAAM,CAAC,yBAAyB,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;AAClD,CAAC;AAEM,eAAe,KAAK,CACzB,KAAwB,EACxB,OAA8B,EAC9B,EAAmC,EAAA;AAEnC,IAAA,MAAM,IAAI,GAAG;AACX,QAAA,SAAS,EAAE,KAAK;AAChB,QAAA,OAAO,EAAE,IAAI;AACb,QAAA,GAAG,OAAO;KACX,CAAC;AACF,IAAA,IAAI,UAAU,CAAC;AACf,IAAA,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;AAC7B,QAAA,UAAU,GAAG,CAAC,KAAK,CAAC,CAAC;AACtB,KAAA;AAAM,SAAA;QACL,UAAU,GAAG,KAAK,CAAC;AACpB,KAAA;AAED,IAAA,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAEhE,MAAM,MAAM,CAAC,uBAAuB,EAAE;QACpC,EAAE;AACF,QAAA,KAAK,EAAE,UAAU;AACjB,QAAA,OAAO,EAA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QAAA,KAAK,OAAO,CAAC,EAAE,CAAC,CAAC;AACjB,QAAA,QAAQ,EAAE,CAAC;AACb,KAAC,CAAC;AACJ;;;;"} \ No newline at end of file diff --git a/plugins/fs-watch/guest-js/tsconfig.json b/plugins/fs-watch/guest-js/tsconfig.json deleted file mode 120000 index 9c2b2da2..00000000 --- a/plugins/fs-watch/guest-js/tsconfig.json +++ /dev/null @@ -1 +0,0 @@ -../../../shared/tsconfig.json \ No newline at end of file diff --git a/plugins/fs-watch/guest-js/package.json b/plugins/fs-watch/package.json similarity index 63% rename from plugins/fs-watch/guest-js/package.json rename to plugins/fs-watch/package.json index 522180eb..c903f942 100644 --- a/plugins/fs-watch/guest-js/package.json +++ b/plugins/fs-watch/package.json @@ -6,13 +6,13 @@ "Tauri Programme within The Commons Conservancy" ], "type": "module", - "browser": "dist/index.min.js", - "module": "dist/index.mjs", - "types": "dist/index.d.ts", + "browser": "guest-js/dist/index.min.js", + "module": "guest-js/dist/index.mjs", + "types": "guest-js/dist/index.d.ts", "exports": { - "import": "./dist/index.mjs", - "types": "./dist/index.d.ts", - "browser": "./dist/index.min.js" + "import": "./guest-js/dist/index.mjs", + "types": "./guest-js/dist/index.d.ts", + "browser": "./guest-js/dist/index.min.js" }, "scripts": { "build": "rollup -c" diff --git a/plugins/fs-extra/guest-js/rollup.config.mjs b/plugins/fs-watch/rollup.config.mjs similarity index 68% rename from plugins/fs-extra/guest-js/rollup.config.mjs rename to plugins/fs-watch/rollup.config.mjs index ee885522..6555e98b 100644 --- a/plugins/fs-extra/guest-js/rollup.config.mjs +++ b/plugins/fs-watch/rollup.config.mjs @@ -1,8 +1,9 @@ import { readFileSync } from "fs"; -import { createConfig } from "../../../shared/rollup.config.mjs"; +import { createConfig } from "../../shared/rollup.config.mjs"; export default createConfig({ + input: "guest-js/index.ts", pkg: JSON.parse( readFileSync(new URL("./package.json", import.meta.url), "utf8") ), diff --git a/plugins/fs-watch/tsconfig.json b/plugins/fs-watch/tsconfig.json new file mode 120000 index 00000000..7cd38da8 --- /dev/null +++ b/plugins/fs-watch/tsconfig.json @@ -0,0 +1 @@ +../../shared/tsconfig.json \ No newline at end of file diff --git a/plugins/localhost/README.md b/plugins/localhost/README.md index 66c0c587..e5c495f1 100644 --- a/plugins/localhost/README.md +++ b/plugins/localhost/README.md @@ -1,17 +1,55 @@ ![plugin-localhost](banner.png) - +Expose your apps assets through a localhost server instead of the default custom protocol. + +> Note: This plugins brings considerable security risks and you should only use it if you know what your are doing. If in doubt, use the default custom protocol implementation. ## Install -``` +There are three general methods of installation that we can recommend. -``` +1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked) +2. Pull sources directly from Github using git tags / revision hashes (most secure) +3. Git submodule install this repo in your tauri project and then use file protocol to ingest the source (most secure, but inconvenient to use) -## Usage +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" } +portpicker = "0.1" # used in the example to pick a random free port ``` +## Usage + +First you need to register the core plugin with Tauri: + +`src-tauri/src/main.rs` +```rust +use tauri::{utils::config::AppUrl, 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) + .title("Localhost Example") + .build()?; + Ok(()) + }) + .run(context) + .expect("error while running tauri application"); +} ``` ## Contributing @@ -20,6 +58,6 @@ PRs accepted. Please make sure to read the Contributing Guide before making a pu ## License -Code: (c) 2015 - 2021 - 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. diff --git a/plugins/log/.gitignore b/plugins/log/.gitignore new file mode 100644 index 00000000..b512c09d --- /dev/null +++ b/plugins/log/.gitignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/plugins/log/Cargo.toml b/plugins/log/Cargo.toml index ac30ee68..8d627dfe 100644 --- a/plugins/log/Cargo.toml +++ b/plugins/log/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "log" +name = "tauri-plugin-log" version = "0.1.0" edition.workspace = true authors.workspace = true diff --git a/plugins/log/README.md b/plugins/log/README.md index 79504c98..2d691449 100644 --- a/plugins/log/README.md +++ b/plugins/log/README.md @@ -1,25 +1,86 @@ ![plugin-log](banner.png) - +Configurable logging for your Tauri app. ## Install +There are three general methods of installation that we can recommend. + +1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked) +2. Pull sources directly from Github using git tags / revision hashes (most secure) +3. Git submodule install this repo in your tauri project and then use file protocol to ingest the source (most secure, but inconvenient to use) + +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" } ``` +You can install the JavaScript Guest bindings using your preferred JavaScript package manager: + +> 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-log +# or +npm add https://github.com/tauri-apps/tauri-plugin-log +# or +yarn add https://github.com/tauri-apps/tauri-plugin-log ``` ## Usage +First you need to register the core plugin with Tauri: + +`src-tauri/src/main.rs` +```rust +use tauri_plugin_log::{LogTarget}; + +fn main() { + tauri::Builder::default() + .plugin(tauri_plugin_log::Builder::default().targets([ + LogTarget::LogDir, + LogTarget::Stdout, + LogTarget::Webview, + ]).build()) + .run(tauri::generate_context!()) + .expect("error while running tauri application"); +} ``` +Afterwards all the plugin's APIs are available through the JavaScript guest bindings: + +```javascript +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() + +trace("Trace") +info("Info") +error("Error") + +// detach the browser console from the log stream +detach() ``` +To log from rust code, add the log crate to your `Cargo.toml`: + +```toml +[dependencies] +log = "^0.4" +``` + +Now, you can use the macros provided by the log crate to log messages from your backend. See the [docs](https://docs.rs/log/latest) for more details. + ## Contributing PRs accepted. Please make sure to read the Contributing Guide before making a pull request. ## License -Code: (c) 2015 - 2021 - 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. diff --git a/plugins/log/guest-js/dist/index.d.ts b/plugins/log/guest-js/dist/index.d.ts deleted file mode 100644 index f74f4588..00000000 --- a/plugins/log/guest-js/dist/index.d.ts +++ /dev/null @@ -1,87 +0,0 @@ -import { UnlistenFn } from "@tauri-apps/api/event"; -export type LogOptions = { - file?: string; - line?: number; -} & Record; -/** - * Logs a message at the error level. - * - * @param message - * - * # Examples - * - * ```js - * import { error } from 'tauri-plugin-log-api'; - * - * const err_info = "No connection"; - * const port = 22; - * - * error(`Error: ${err_info} on port ${port}`); - * ``` - */ -export declare function error(message: string, options?: LogOptions): Promise; -/** - * Logs a message at the warn level. - * - * @param message - * - * # Examples - * - * ```js - * import { warn } from 'tauri-plugin-log-api'; - * - * const warn_description = "Invalid Input"; - * - * warn(`Warning! {warn_description}!`); - * ``` - */ -export declare function warn(message: string, options?: LogOptions): Promise; -/** - * Logs a message at the info level. - * - * @param message - * - * # Examples - * - * ```js - * import { info } from 'tauri-plugin-log-api'; - * - * const conn_info = { port: 40, speed: 3.20 }; - * - * info(`Connected to port {conn_info.port} at {conn_info.speed} Mb/s`); - * ``` - */ -export declare function info(message: string, options?: LogOptions): Promise; -/** - * Logs a message at the debug level. - * - * @param message - * - * # Examples - * - * ```js - * import { debug } from 'tauri-plugin-log-api'; - * - * const pos = { x: 3.234, y: -1.223 }; - * - * debug(`New position: x: {pos.x}, y: {pos.y}`); - * ``` - */ -export declare function debug(message: string, options?: LogOptions): Promise; -/** - * Logs a message at the trace level. - * - * @param message - * - * # Examples - * - * ```js - * import { trace } from 'tauri-plugin-log-api'; - * - * let pos = { x: 3.234, y: -1.223 }; - * - * trace(`Position is: x: {pos.x}, y: {pos.y}`); - * ``` - */ -export declare function trace(message: string, options?: LogOptions): Promise; -export declare function attachConsole(): Promise; diff --git a/plugins/log/guest-js/dist/index.min.js b/plugins/log/guest-js/dist/index.min.js deleted file mode 100644 index 260e7c63..00000000 --- a/plugins/log/guest-js/dist/index.min.js +++ /dev/null @@ -1,180 +0,0 @@ -var d=Object.defineProperty;var e=(c,a)=>{for(var b in a)d(c,b,{get:a[b],enumerable:!0});}; - -var f={};e(f,{convertFileSrc:()=>w,invoke:()=>c$1,transformCallback:()=>s$1});function u$1(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function s$1(e,r=!1){let n=u$1(),t=`_${n}`;return Object.defineProperty(window,t,{value:o=>(r&&Reflect.deleteProperty(window,t),e==null?void 0:e(o)),writable:!1,configurable:!0}),n}async function c$1(e,r={}){return new Promise((n,t)=>{let o=s$1(i=>{n(i),Reflect.deleteProperty(window,`_${a}`);},!0),a=s$1(i=>{t(i),Reflect.deleteProperty(window,`_${o}`);},!0);window.__TAURI_IPC__({cmd:e,callback:o,error:a,...r});})}function w(e,r="asset"){let n=encodeURIComponent(e);return navigator.userAgent.includes("Windows")?`https://${r}.localhost/${n}`:`${r}://localhost/${n}`} - -async function a(i){return c$1("tauri",i)} - -var W={};e(W,{TauriEvent:()=>c,emit:()=>D,listen:()=>E,once:()=>_});async function s(n,t){return a({__tauriModule:"Event",message:{cmd:"unlisten",event:n,eventId:t}})}async function m(n,t,i){await a({__tauriModule:"Event",message:{cmd:"emit",event:n,windowLabel:t,payload:i}});}async function o(n,t,i){return a({__tauriModule:"Event",message:{cmd:"listen",event:n,windowLabel:t,handler:s$1(i)}}).then(r=>async()=>s(n,r))}async function u(n,t,i){return o(n,t,r=>{i(r),s(n,r.id).catch(()=>{});})}var c=(e=>(e.WINDOW_RESIZED="tauri://resize",e.WINDOW_MOVED="tauri://move",e.WINDOW_CLOSE_REQUESTED="tauri://close-requested",e.WINDOW_CREATED="tauri://window-created",e.WINDOW_DESTROYED="tauri://destroyed",e.WINDOW_FOCUS="tauri://focus",e.WINDOW_BLUR="tauri://blur",e.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",e.WINDOW_THEME_CHANGED="tauri://theme-changed",e.WINDOW_FILE_DROP="tauri://file-drop",e.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover",e.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled",e.MENU="tauri://menu",e.CHECK_UPDATE="tauri://update",e.UPDATE_AVAILABLE="tauri://update-available",e.INSTALL_UPDATE="tauri://update-install",e.STATUS_UPDATE="tauri://update-status",e.DOWNLOAD_PROGRESS="tauri://update-download-progress",e))(c||{});async function E(n,t){return o(n,null,t)}async function _(n,t){return u(n,null,t)}async function D(n,t){return m(n,void 0,t)} - -var LogLevel; -(function (LogLevel) { - /** - * The "trace" level. - * - * Designates very low priority, often extremely verbose, information. - */ - LogLevel[LogLevel["Trace"] = 1] = "Trace"; - /** - * The "debug" level. - * - * Designates lower priority information. - */ - LogLevel[LogLevel["Debug"] = 2] = "Debug"; - /** - * The "info" level. - * - * Designates useful information. - */ - LogLevel[LogLevel["Info"] = 3] = "Info"; - /** - * The "warn" level. - * - * Designates hazardous situations. - */ - LogLevel[LogLevel["Warn"] = 4] = "Warn"; - /** - * The "error" level. - * - * Designates very serious errors. - */ - LogLevel[LogLevel["Error"] = 5] = "Error"; -})(LogLevel || (LogLevel = {})); -async function log(level, message, options) { - var _a, _b; - const traces = (_a = new Error().stack) === null || _a === void 0 ? void 0 : _a.split("\n").map((line) => line.split("@")); - const filtered = traces === null || traces === void 0 ? void 0 : traces.filter(([name, location]) => { - return name.length > 0 && location !== "[native code]"; - }); - const { file, line, ...keyValues } = options !== null && options !== void 0 ? options : {}; - await c$1("plugin:log|log", { - level, - message, - location: (_b = filtered === null || filtered === void 0 ? void 0 : filtered[0]) === null || _b === void 0 ? void 0 : _b.filter((v) => v.length > 0).join("@"), - file, - line, - keyValues, - }); -} -/** - * Logs a message at the error level. - * - * @param message - * - * # Examples - * - * ```js - * import { error } from 'tauri-plugin-log-api'; - * - * const err_info = "No connection"; - * const port = 22; - * - * error(`Error: ${err_info} on port ${port}`); - * ``` - */ -async function error(message, options) { - await log(LogLevel.Error, message, options); -} -/** - * Logs a message at the warn level. - * - * @param message - * - * # Examples - * - * ```js - * import { warn } from 'tauri-plugin-log-api'; - * - * const warn_description = "Invalid Input"; - * - * warn(`Warning! {warn_description}!`); - * ``` - */ -async function warn(message, options) { - await log(LogLevel.Warn, message, options); -} -/** - * Logs a message at the info level. - * - * @param message - * - * # Examples - * - * ```js - * import { info } from 'tauri-plugin-log-api'; - * - * const conn_info = { port: 40, speed: 3.20 }; - * - * info(`Connected to port {conn_info.port} at {conn_info.speed} Mb/s`); - * ``` - */ -async function info(message, options) { - await log(LogLevel.Info, message, options); -} -/** - * Logs a message at the debug level. - * - * @param message - * - * # Examples - * - * ```js - * import { debug } from 'tauri-plugin-log-api'; - * - * const pos = { x: 3.234, y: -1.223 }; - * - * debug(`New position: x: {pos.x}, y: {pos.y}`); - * ``` - */ -async function debug(message, options) { - await log(LogLevel.Debug, message, options); -} -/** - * Logs a message at the trace level. - * - * @param message - * - * # Examples - * - * ```js - * import { trace } from 'tauri-plugin-log-api'; - * - * let pos = { x: 3.234, y: -1.223 }; - * - * trace(`Position is: x: {pos.x}, y: {pos.y}`); - * ``` - */ -async function trace(message, options) { - await log(LogLevel.Trace, message, options); -} -async function attachConsole() { - return await E("log://log", (event) => { - const payload = event.payload; - // Strip ANSI escape codes - const message = payload.message.replace( - // eslint-disable-next-line no-control-regex - /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, ""); - switch (payload.level) { - case LogLevel.Trace: - console.log(message); - break; - case LogLevel.Debug: - console.debug(message); - break; - case LogLevel.Info: - console.info(message); - break; - case LogLevel.Warn: - console.warn(message); - break; - case LogLevel.Error: - console.error(message); - break; - default: - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions - throw new Error(`unknown log level ${payload.level}`); - } - }); -} - -export { attachConsole, debug, error, info, trace, warn }; -//# sourceMappingURL=index.min.js.map diff --git a/plugins/log/guest-js/dist/index.min.js.map b/plugins/log/guest-js/dist/index.min.js.map deleted file mode 100644 index 23994bdd..00000000 --- a/plugins/log/guest-js/dist/index.min.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.min.js","sources":["../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-FEIY7W7S.js","../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-RCPA6UVN.js","../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-HNLFKTAJ.js","../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-3WDDWFXT.js","../index.ts"],"sourcesContent":["var d=Object.defineProperty;var e=(c,a)=>{for(var b in a)d(c,b,{get:a[b],enumerable:!0})};export{e as a};\n","import{a as d}from\"./chunk-FEIY7W7S.js\";var f={};d(f,{convertFileSrc:()=>w,invoke:()=>c,transformCallback:()=>s});function u(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function s(e,r=!1){let n=u(),t=`_${n}`;return Object.defineProperty(window,t,{value:o=>(r&&Reflect.deleteProperty(window,t),e==null?void 0:e(o)),writable:!1,configurable:!0}),n}async function c(e,r={}){return new Promise((n,t)=>{let o=s(i=>{n(i),Reflect.deleteProperty(window,`_${a}`)},!0),a=s(i=>{t(i),Reflect.deleteProperty(window,`_${o}`)},!0);window.__TAURI_IPC__({cmd:e,callback:o,error:a,...r})})}function w(e,r=\"asset\"){let n=encodeURIComponent(e);return navigator.userAgent.includes(\"Windows\")?`https://${r}.localhost/${n}`:`${r}://localhost/${n}`}export{s as a,c as b,w as c,f as d};\n","import{b as o}from\"./chunk-RCPA6UVN.js\";async function a(i){return o(\"tauri\",i)}export{a};\n","import{a}from\"./chunk-HNLFKTAJ.js\";import{a as l}from\"./chunk-RCPA6UVN.js\";import{a as d}from\"./chunk-FEIY7W7S.js\";var W={};d(W,{TauriEvent:()=>c,emit:()=>D,listen:()=>E,once:()=>_});async function s(n,t){return a({__tauriModule:\"Event\",message:{cmd:\"unlisten\",event:n,eventId:t}})}async function m(n,t,i){await a({__tauriModule:\"Event\",message:{cmd:\"emit\",event:n,windowLabel:t,payload:i}})}async function o(n,t,i){return a({__tauriModule:\"Event\",message:{cmd:\"listen\",event:n,windowLabel:t,handler:l(i)}}).then(r=>async()=>s(n,r))}async function u(n,t,i){return o(n,t,r=>{i(r),s(n,r.id).catch(()=>{})})}var c=(e=>(e.WINDOW_RESIZED=\"tauri://resize\",e.WINDOW_MOVED=\"tauri://move\",e.WINDOW_CLOSE_REQUESTED=\"tauri://close-requested\",e.WINDOW_CREATED=\"tauri://window-created\",e.WINDOW_DESTROYED=\"tauri://destroyed\",e.WINDOW_FOCUS=\"tauri://focus\",e.WINDOW_BLUR=\"tauri://blur\",e.WINDOW_SCALE_FACTOR_CHANGED=\"tauri://scale-change\",e.WINDOW_THEME_CHANGED=\"tauri://theme-changed\",e.WINDOW_FILE_DROP=\"tauri://file-drop\",e.WINDOW_FILE_DROP_HOVER=\"tauri://file-drop-hover\",e.WINDOW_FILE_DROP_CANCELLED=\"tauri://file-drop-cancelled\",e.MENU=\"tauri://menu\",e.CHECK_UPDATE=\"tauri://update\",e.UPDATE_AVAILABLE=\"tauri://update-available\",e.INSTALL_UPDATE=\"tauri://update-install\",e.STATUS_UPDATE=\"tauri://update-status\",e.DOWNLOAD_PROGRESS=\"tauri://update-download-progress\",e))(c||{});async function E(n,t){return o(n,null,t)}async function _(n,t){return u(n,null,t)}async function D(n,t){return m(n,void 0,t)}export{m as a,o as b,u as c,c as d,E as e,_ as f,D as g,W as h};\n",null],"names":["d","c","s","u","o","l","invoke","listen"],"mappings":"AAAA,IAAI,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAC,CAAC;;ACAjD,IAAI,CAAC,CAAC,EAAE,CAACA,CAAC,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,IAAIC,GAAC,CAAC,iBAAiB,CAAC,IAAIC,GAAC,CAAC,CAAC,CAAC,SAASC,GAAC,EAAE,CAAC,OAAO,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAASD,GAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAACC,GAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,eAAeF,GAAC,C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C,OAAO;;QAErC,6EAA6E,EAC7E,EAAE,CACH,CAAC;QAEF,QAAQ,OAAO,CAAC,KAAK;YACnB,KAAK,QAAQ,CAAC,KAAK;AACjB,gBAAA,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;gBACrB,MAAM;YACR,KAAK,QAAQ,CAAC,KAAK;AACjB,gBAAA,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBACvB,MAAM;YACR,KAAK,QAAQ,CAAC,IAAI;AAChB,gBAAA,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBACtB,MAAM;YACR,KAAK,QAAQ,CAAC,IAAI;AAChB,gBAAA,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBACtB,MAAM;YACR,KAAK,QAAQ,CAAC,KAAK;AACjB,gBAAA,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBACvB,MAAM;AACR,YAAA;;gBAEE,MAAM,IAAI,KAAK,CAAC,CAAA,kBAAA,EAAqB,OAAO,CAAC,KAAK,CAAE,CAAA,CAAC,CAAC;AACzD,SAAA;AACH,KAAC,CAAC,CAAC;AACL;;;;"} \ No newline at end of file diff --git a/plugins/log/guest-js/dist/index.mjs b/plugins/log/guest-js/dist/index.mjs deleted file mode 100644 index 04860183..00000000 --- a/plugins/log/guest-js/dist/index.mjs +++ /dev/null @@ -1,175 +0,0 @@ -import { invoke } from '@tauri-apps/api/tauri'; -import { listen } from '@tauri-apps/api/event'; - -var LogLevel; -(function (LogLevel) { - /** - * The "trace" level. - * - * Designates very low priority, often extremely verbose, information. - */ - LogLevel[LogLevel["Trace"] = 1] = "Trace"; - /** - * The "debug" level. - * - * Designates lower priority information. - */ - LogLevel[LogLevel["Debug"] = 2] = "Debug"; - /** - * The "info" level. - * - * Designates useful information. - */ - LogLevel[LogLevel["Info"] = 3] = "Info"; - /** - * The "warn" level. - * - * Designates hazardous situations. - */ - LogLevel[LogLevel["Warn"] = 4] = "Warn"; - /** - * The "error" level. - * - * Designates very serious errors. - */ - LogLevel[LogLevel["Error"] = 5] = "Error"; -})(LogLevel || (LogLevel = {})); -async function log(level, message, options) { - var _a, _b; - const traces = (_a = new Error().stack) === null || _a === void 0 ? void 0 : _a.split("\n").map((line) => line.split("@")); - const filtered = traces === null || traces === void 0 ? void 0 : traces.filter(([name, location]) => { - return name.length > 0 && location !== "[native code]"; - }); - const { file, line, ...keyValues } = options !== null && options !== void 0 ? options : {}; - await invoke("plugin:log|log", { - level, - message, - location: (_b = filtered === null || filtered === void 0 ? void 0 : filtered[0]) === null || _b === void 0 ? void 0 : _b.filter((v) => v.length > 0).join("@"), - file, - line, - keyValues, - }); -} -/** - * Logs a message at the error level. - * - * @param message - * - * # Examples - * - * ```js - * import { error } from 'tauri-plugin-log-api'; - * - * const err_info = "No connection"; - * const port = 22; - * - * error(`Error: ${err_info} on port ${port}`); - * ``` - */ -async function error(message, options) { - await log(LogLevel.Error, message, options); -} -/** - * Logs a message at the warn level. - * - * @param message - * - * # Examples - * - * ```js - * import { warn } from 'tauri-plugin-log-api'; - * - * const warn_description = "Invalid Input"; - * - * warn(`Warning! {warn_description}!`); - * ``` - */ -async function warn(message, options) { - await log(LogLevel.Warn, message, options); -} -/** - * Logs a message at the info level. - * - * @param message - * - * # Examples - * - * ```js - * import { info } from 'tauri-plugin-log-api'; - * - * const conn_info = { port: 40, speed: 3.20 }; - * - * info(`Connected to port {conn_info.port} at {conn_info.speed} Mb/s`); - * ``` - */ -async function info(message, options) { - await log(LogLevel.Info, message, options); -} -/** - * Logs a message at the debug level. - * - * @param message - * - * # Examples - * - * ```js - * import { debug } from 'tauri-plugin-log-api'; - * - * const pos = { x: 3.234, y: -1.223 }; - * - * debug(`New position: x: {pos.x}, y: {pos.y}`); - * ``` - */ -async function debug(message, options) { - await log(LogLevel.Debug, message, options); -} -/** - * Logs a message at the trace level. - * - * @param message - * - * # Examples - * - * ```js - * import { trace } from 'tauri-plugin-log-api'; - * - * let pos = { x: 3.234, y: -1.223 }; - * - * trace(`Position is: x: {pos.x}, y: {pos.y}`); - * ``` - */ -async function trace(message, options) { - await log(LogLevel.Trace, message, options); -} -async function attachConsole() { - return await listen("log://log", (event) => { - const payload = event.payload; - // Strip ANSI escape codes - const message = payload.message.replace( - // eslint-disable-next-line no-control-regex - /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, ""); - switch (payload.level) { - case LogLevel.Trace: - console.log(message); - break; - case LogLevel.Debug: - console.debug(message); - break; - case LogLevel.Info: - console.info(message); - break; - case LogLevel.Warn: - console.warn(message); - break; - case LogLevel.Error: - console.error(message); - break; - default: - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions - throw new Error(`unknown log level ${payload.level}`); - } - }); -} - -export { attachConsole, debug, error, info, trace, warn }; -//# sourceMappingURL=index.mjs.map diff --git a/plugins/log/guest-js/dist/index.mjs.map b/plugins/log/guest-js/dist/index.mjs.map deleted file mode 100644 index 08d01124..00000000 --- a/plugins/log/guest-js/dist/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAQA,IAAK,QA+BJ,CAAA;AA/BD,CAAA,UAAK,QAAQ,EAAA;AACX;;;;AAIG;AACH,IAAA,QAAA,CAAA,QAAA,CAAA,OAAA,CAAA,GAAA,CAAA,CAAA,GAAA,OAAS,CAAA;AACT;;;;AAIG;AACH,IAAA,QAAA,CAAA,QAAA,CAAA,OAAA,CAAA,GAAA,CAAA,CAAA,GAAA,OAAK,CAAA;AACL;;;;AAIG;AACH,IAAA,QAAA,CAAA,QAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAI,CAAA;AACJ;;;;AAIG;AACH,IAAA,QAAA,CAAA,QAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAI,CAAA;AACJ;;;;AAIG;AACH,IAAA,Q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CAAC,CAAC;gBACrB,MAAM;YACR,KAAK,QAAQ,CAAC,KAAK;AACjB,gBAAA,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBACvB,MAAM;YACR,KAAK,QAAQ,CAAC,IAAI;AAChB,gBAAA,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBACtB,MAAM;YACR,KAAK,QAAQ,CAAC,IAAI;AAChB,gBAAA,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBACtB,MAAM;YACR,KAAK,QAAQ,CAAC,KAAK;AACjB,gBAAA,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBACvB,MAAM;AACR,YAAA;;gBAEE,MAAM,IAAI,KAAK,CAAC,CAAA,kBAAA,EAAqB,OAAO,CAAC,KAAK,CAAE,CAAA,CAAC,CAAC;AACzD,SAAA;AACH,KAAC,CAAC,CAAC;AACL;;;;"} \ No newline at end of file diff --git a/plugins/log/guest-js/package.json b/plugins/log/guest-js/package.json deleted file mode 100644 index 8446267c..00000000 --- a/plugins/log/guest-js/package.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "tauri-plugin-log", - "version": "0.0.0", - "license": "MIT or APACHE-2.0", - "authors": [ - "Tauri Programme within The Commons Conservancy" - ], - "type": "module", - "browser": "dist/index.min.js", - "module": "dist/index.mjs", - "types": "dist/index.d.ts", - "exports": { - "import": "./dist/index.mjs", - "types": "./dist/index.d.ts", - "browser": "./dist/index.min.js" - }, - "scripts": { - "build": "rollup -c" - }, - "files": [ - "dist", - "!dist/**/*.map", - "README.md", - "LICENSE" - ], - "devDependencies": { - "tslib": "^2.4.1" - }, - "dependencies": { - "@tauri-apps/api": "^1.2.0" - } -} diff --git a/plugins/log/guest-js/rollup.config.mjs b/plugins/log/guest-js/rollup.config.mjs deleted file mode 100644 index ee885522..00000000 --- a/plugins/log/guest-js/rollup.config.mjs +++ /dev/null @@ -1,10 +0,0 @@ -import { readFileSync } from "fs"; - -import { createConfig } from "../../../shared/rollup.config.mjs"; - -export default createConfig({ - pkg: JSON.parse( - readFileSync(new URL("./package.json", import.meta.url), "utf8") - ), - external: [/^@tauri-apps\/api/], -}); diff --git a/plugins/log/guest-js/tsconfig.json b/plugins/log/guest-js/tsconfig.json deleted file mode 120000 index 9c2b2da2..00000000 --- a/plugins/log/guest-js/tsconfig.json +++ /dev/null @@ -1 +0,0 @@ -../../../shared/tsconfig.json \ No newline at end of file diff --git a/plugins/authenticator/guest-js/package.json b/plugins/log/package.json similarity index 58% rename from plugins/authenticator/guest-js/package.json rename to plugins/log/package.json index cbc19957..9574a8fc 100644 --- a/plugins/authenticator/guest-js/package.json +++ b/plugins/log/package.json @@ -1,18 +1,18 @@ { - "name": "tauri-plugin-authenticator-api", + "name": "tauri-plugin-log-api", "version": "0.0.0", "license": "MIT or APACHE-2.0", "authors": [ "Tauri Programme within The Commons Conservancy" ], "type": "module", - "browser": "dist/index.min.js", - "module": "dist/index.mjs", - "types": "dist/index.d.ts", + "browser": "guest-js/dist/index.min.js", + "module": "guest-js/dist/index.mjs", + "types": "guest-js/dist/index.d.ts", "exports": { - "import": "./dist/index.mjs", - "types": "./dist/index.d.ts", - "browser": "./dist/index.min.js" + "import": "./guest-js/dist/index.mjs", + "types": "./guest-js/dist/index.d.ts", + "browser": "./guest-js/dist/index.min.js" }, "scripts": { "build": "rollup -c" diff --git a/plugins/log/rollup.config.mjs b/plugins/log/rollup.config.mjs new file mode 100644 index 00000000..6555e98b --- /dev/null +++ b/plugins/log/rollup.config.mjs @@ -0,0 +1,11 @@ +import { readFileSync } from "fs"; + +import { createConfig } from "../../shared/rollup.config.mjs"; + +export default createConfig({ + input: "guest-js/index.ts", + pkg: JSON.parse( + readFileSync(new URL("./package.json", import.meta.url), "utf8") + ), + external: [/^@tauri-apps\/api/], +}); diff --git a/plugins/log/src/lib.rs b/plugins/log/src/lib.rs index 9288fe01..cf25db2d 100644 --- a/plugins/log/src/lib.rs +++ b/plugins/log/src/lib.rs @@ -142,14 +142,14 @@ fn log( logger().log(&builder.args(format_args!("{message}")).build()); } -pub struct LoggerBuilder { +pub struct Builder { dispatch: fern::Dispatch, rotation_strategy: RotationStrategy, max_file_size: u128, targets: Vec, } -impl Default for LoggerBuilder { +impl Default for Builder { fn default() -> Self { let format = time::format_description::parse("[[[year]-[month]-[day]][[[hour]:[minute]:[second]]") @@ -172,7 +172,7 @@ impl Default for LoggerBuilder { } } -impl LoggerBuilder { +impl Builder { pub fn new() -> Self { Default::default() } diff --git a/plugins/log/tsconfig.json b/plugins/log/tsconfig.json new file mode 120000 index 00000000..7cd38da8 --- /dev/null +++ b/plugins/log/tsconfig.json @@ -0,0 +1 @@ +../../shared/tsconfig.json \ No newline at end of file diff --git a/plugins/persisted-scope/README.md b/plugins/persisted-scope/README.md index 3891b209..a856a777 100644 --- a/plugins/persisted-scope/README.md +++ b/plugins/persisted-scope/README.md @@ -1,25 +1,45 @@ ![plugin-persisted-scope](banner.png) - +Save filesystem and asset scopes and restore them when the app is reopened. ## Install -``` +There are three general methods of installation that we can recommend. + +1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked) +2. Pull sources directly from Github using git tags / revision hashes (most secure) +3. Git submodule install this repo in your tauri project and then use file protocol to ingest the source (most secure, but inconvenient to use) + +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" } ``` ## Usage -``` +First you need to register the core plugin with Tauri: +`src-tauri/src/main.rs` +```rust +fn main() { + tauri::Builder::default() + .plugin(tauri_plugin_persisted_scope::init()) + .run(tauri::generate_context!()) + .expect("error while running tauri application"); +} ``` +Afterwards the plugin will automatically save and restore filesystem and asset scopes. + ## Contributing PRs accepted. Please make sure to read the Contributing Guide before making a pull request. ## License -Code: (c) 2015 - 2021 - 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. diff --git a/plugins/persisted-scope/src/lib.rs b/plugins/persisted-scope/src/lib.rs index 6827e4cd..9fbdf4f7 100644 --- a/plugins/persisted-scope/src/lib.rs +++ b/plugins/persisted-scope/src/lib.rs @@ -56,13 +56,13 @@ pub fn init() -> TauriPlugin { .unwrap_or_default(); for allowed in scope.allowed_paths { // allows the path as is - let _ = fs_scope.allow_file(&allowed); + let _ = fs_scope.allow_file(allowed); #[cfg(feature = "protocol-asset")] let _ = asset_protocol_scope.allow_file(allowed); } for forbidden in scope.forbidden_patterns { // forbid the path as is - let _ = fs_scope.forbid_file(&forbidden); + let _ = fs_scope.forbid_file(forbidden); #[cfg(feature = "protocol-asset")] let _ = asset_protocol_scope.forbid_file(forbidden); } diff --git a/plugins/positioner/.gitignore b/plugins/positioner/.gitignore new file mode 100644 index 00000000..b512c09d --- /dev/null +++ b/plugins/positioner/.gitignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/plugins/positioner/README.md b/plugins/positioner/README.md index 5eb5195e..861043cd 100644 --- a/plugins/positioner/README.md +++ b/plugins/positioner/README.md @@ -1,17 +1,82 @@ ![plugin-positioner](banner.png) - +Position your windows at well-known locations. + +This plugin is a port of [electron-positioner](https://github.com/jenslind/electron-positioner) for Tauri. ## Install +There are three general methods of installation that we can recommend. + +1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked) +2. Pull sources directly from Github using git tags / revision hashes (most secure) +3. Git submodule install this repo in your tauri project and then use file protocol to ingest the source (most secure, but inconvenient to use) + +Install the Core plugin by adding the following to your `Cargo.toml` file: + +`src-tauri/Cargo.toml` +```toml +[dependencies] +tauri-plugin-positioner = "1.0" +# or through git +tauri-plugin-positioner = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" } ``` +You can install the JavaScript Guest bindings using your preferred JavaScript package manager: + +> 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-plugin-positioner +# or +npm add tauri-plugin-positioner +# or +yarn add tauri-plugin-positioner +``` + +Or through git: + +```sh +pnpm add https://github.com/tauri-apps/tauri-plugin-positioner +# or +npm add https://github.com/tauri-apps/tauri-plugin-positioner +# or +yarn add https://github.com/tauri-apps/tauri-plugin-positioner ``` ## Usage +First you need to register the core plugin with Tauri: + +`src-tauri/src/main.rs` +```rust +fn main() { + tauri::Builder::default() + .plugin(tauri_plugin_positioner::init()) + // This is required to get tray-relative positions to work + .on_system_tray_event(|app, event| { + tauri_plugin_positioner::on_tray_event(app, &event); + }) + .run(tauri::generate_context!()) + .expect("error while running tauri application"); +} +``` + +Afterwards all the plugin's APIs are available through the JavaScript guest bindings: + +```javascript +import { move_window, Position } from 'tauri-plugin-positioner-api' + +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: + +```rust +use tauri_plugin_positioner::{WindowExt, Position}; + +let mut win = app.get_window("main").unwrap(); +let _ = win.move_window(Position::TopRight); ``` ## Contributing @@ -20,6 +85,7 @@ PRs accepted. Please make sure to read the Contributing Guide before making a pu ## License -Code: (c) 2015 - 2021 - 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. + diff --git a/plugins/positioner/guest-js/dist/index.d.ts b/plugins/positioner/guest-js/dist/index.d.ts deleted file mode 100644 index c03d4d05..00000000 --- a/plugins/positioner/guest-js/dist/index.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Well known window positions. - */ -export declare enum Position { - TopLeft = 0, - TopRight = 1, - BottomLeft = 2, - BottomRight = 3, - TopCenter = 4, - BottomCenter = 5, - LeftCenter = 6, - RightCenter = 7, - Center = 8, - TrayLeft = 9, - TrayBottomLeft = 10, - TrayRight = 11, - TrayBottomRight = 12, - TrayCenter = 13, - TrayBottomCenter = 14 -} -/** - * Moves the `Window` to the given {@link Position} using `WindowExt.move_window()` - * All positions are relative to the **current** screen. - * - * @param to The {@link Position} to move to. - */ -export declare function moveWindow(to: Position): Promise; diff --git a/plugins/positioner/guest-js/dist/index.min.js b/plugins/positioner/guest-js/dist/index.min.js deleted file mode 100644 index bede7644..00000000 --- a/plugins/positioner/guest-js/dist/index.min.js +++ /dev/null @@ -1,40 +0,0 @@ -var d=Object.defineProperty;var e=(c,a)=>{for(var b in a)d(c,b,{get:a[b],enumerable:!0});}; - -var f={};e(f,{convertFileSrc:()=>w,invoke:()=>c,transformCallback:()=>s});function u(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function s(e,r=!1){let n=u(),t=`_${n}`;return Object.defineProperty(window,t,{value:o=>(r&&Reflect.deleteProperty(window,t),e==null?void 0:e(o)),writable:!1,configurable:!0}),n}async function c(e,r={}){return new Promise((n,t)=>{let o=s(i=>{n(i),Reflect.deleteProperty(window,`_${a}`);},!0),a=s(i=>{t(i),Reflect.deleteProperty(window,`_${o}`);},!0);window.__TAURI_IPC__({cmd:e,callback:o,error:a,...r});})}function w(e,r="asset"){let n=encodeURIComponent(e);return navigator.userAgent.includes("Windows")?`https://${r}.localhost/${n}`:`${r}://localhost/${n}`} - -// Copyright 2021 Jonas Kruckenberg -/** - * Well known window positions. - */ -var Position; -(function (Position) { - Position[Position["TopLeft"] = 0] = "TopLeft"; - Position[Position["TopRight"] = 1] = "TopRight"; - Position[Position["BottomLeft"] = 2] = "BottomLeft"; - Position[Position["BottomRight"] = 3] = "BottomRight"; - Position[Position["TopCenter"] = 4] = "TopCenter"; - Position[Position["BottomCenter"] = 5] = "BottomCenter"; - Position[Position["LeftCenter"] = 6] = "LeftCenter"; - Position[Position["RightCenter"] = 7] = "RightCenter"; - Position[Position["Center"] = 8] = "Center"; - Position[Position["TrayLeft"] = 9] = "TrayLeft"; - Position[Position["TrayBottomLeft"] = 10] = "TrayBottomLeft"; - Position[Position["TrayRight"] = 11] = "TrayRight"; - Position[Position["TrayBottomRight"] = 12] = "TrayBottomRight"; - Position[Position["TrayCenter"] = 13] = "TrayCenter"; - Position[Position["TrayBottomCenter"] = 14] = "TrayBottomCenter"; -})(Position || (Position = {})); -/** - * Moves the `Window` to the given {@link Position} using `WindowExt.move_window()` - * All positions are relative to the **current** screen. - * - * @param to The {@link Position} to move to. - */ -async function moveWindow(to) { - await c("plugin:positioner|move_window", { - position: to, - }); -} - -export { Position, moveWindow }; -//# sourceMappingURL=index.min.js.map diff --git a/plugins/positioner/guest-js/dist/index.min.js.map b/plugins/positioner/guest-js/dist/index.min.js.map deleted file mode 100644 index 4e7d8f60..00000000 --- a/plugins/positioner/guest-js/dist/index.min.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.min.js","sources":["../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-FEIY7W7S.js","../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-RCPA6UVN.js","../index.ts"],"sourcesContent":["var d=Object.defineProperty;var e=(c,a)=>{for(var b in a)d(c,b,{get:a[b],enumerable:!0})};export{e as a};\n","import{a as d}from\"./chunk-FEIY7W7S.js\";var f={};d(f,{convertFileSrc:()=>w,invoke:()=>c,transformCallback:()=>s});function u(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function s(e,r=!1){let n=u(),t=`_${n}`;return Object.defineProperty(window,t,{value:o=>(r&&Reflect.deleteProperty(window,t),e==null?void 0:e(o)),writable:!1,configurable:!0}),n}async function c(e,r={}){return new Promise((n,t)=>{let o=s(i=>{n(i),Reflect.deleteProperty(window,`_${a}`)},!0),a=s(i=>{t(i),Reflect.deleteProperty(window,`_${o}`)},!0);window.__TAURI_IPC__({cmd:e,callback:o,error:a,...r})})}function w(e,r=\"asset\"){let n=encodeURIComponent(e);return navigator.userAgent.includes(\"Windows\")?`https://${r}.localhost/${n}`:`${r}://localhost/${n}`}export{s as a,c as b,w as c,f as d};\n",null],"names":["d","invoke"],"mappings":"AAAA,IAAI,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AAA,QAAA,CAAA,cAAA,CAAA,GAAA,CAAA,CAAA,GAAA,cAAY,CAAA;AACZ,IAAA,QAAA,CAAA,QAAA,CAAA,YAAA,CAAA,GAAA,CAAA,CAAA,GAAA,YAAU,CAAA;AACV,IAAA,QAAA,CAAA,QAAA,CAAA,aAAA,CAAA,GAAA,CAAA,CAAA,GAAA,aAAW,CAAA;AACX,IAAA,QAAA,CAAA,QAAA,CAAA,QAAA,CAAA,GAAA,CAAA,CAAA,GAAA,QAAM,CAAA;AACN,IAAA,QAAA,CAAA,QAAA,CAAA,UAAA,CAAA,GAAA,CAAA,CAAA,GAAA,UAAQ,CAAA;AACR,IAAA,QAAA,CAAA,QAAA,CAAA,gBAAA,CAAA,GAAA,EAAA,CAAA,GAAA,gBAAc,CAAA;AACd,IAAA,QAAA,CAAA,QAAA,CAAA,WAAA,CAAA,GAAA,EAAA,CAAA,GAAA,WAAS,CAAA;AACT,IAAA,QAAA,CAAA,QAAA,CAAA,iBAAA,CAAA,GAAA,EAAA,CAAA,GAAA,iBAAe,CAAA;AACf,IAAA,QAAA,CAAA,QAAA,CAAA,YAAA,CAAA,GAAA,EAAA,CAAA,GAAA,YAAU,CAAA;AACV,IAAA,QAAA,CAAA,QAAA,CAAA,kBAAA,CAAA,GAAA,EAAA,CAAA,GAAA,kBAAgB,CAAA;AAClB,CAAC,EAhBW,QAAQ,KAAR,QAAQ,GAgBnB,EAAA,CAAA,CAAA,CAAA;AAED;;;;;AAKG;AACI,eAAe,UAAU,CAAC,EAAY,EAAA;IAC3C,MAAMC,CAAM,CAAC,+BAA+B,EAAE;AAC5C,QAAA,QAAQ,EAAE,EAAE;AACb,KAAA,CAAC,CAAC;AACL;;;;"} \ No newline at end of file diff --git a/plugins/positioner/guest-js/dist/index.mjs b/plugins/positioner/guest-js/dist/index.mjs deleted file mode 100644 index 9e84b96a..00000000 --- a/plugins/positioner/guest-js/dist/index.mjs +++ /dev/null @@ -1,38 +0,0 @@ -import { invoke } from '@tauri-apps/api/tauri'; - -// Copyright 2021 Jonas Kruckenberg -/** - * Well known window positions. - */ -var Position; -(function (Position) { - Position[Position["TopLeft"] = 0] = "TopLeft"; - Position[Position["TopRight"] = 1] = "TopRight"; - Position[Position["BottomLeft"] = 2] = "BottomLeft"; - Position[Position["BottomRight"] = 3] = "BottomRight"; - Position[Position["TopCenter"] = 4] = "TopCenter"; - Position[Position["BottomCenter"] = 5] = "BottomCenter"; - Position[Position["LeftCenter"] = 6] = "LeftCenter"; - Position[Position["RightCenter"] = 7] = "RightCenter"; - Position[Position["Center"] = 8] = "Center"; - Position[Position["TrayLeft"] = 9] = "TrayLeft"; - Position[Position["TrayBottomLeft"] = 10] = "TrayBottomLeft"; - Position[Position["TrayRight"] = 11] = "TrayRight"; - Position[Position["TrayBottomRight"] = 12] = "TrayBottomRight"; - Position[Position["TrayCenter"] = 13] = "TrayCenter"; - Position[Position["TrayBottomCenter"] = 14] = "TrayBottomCenter"; -})(Position || (Position = {})); -/** - * Moves the `Window` to the given {@link Position} using `WindowExt.move_window()` - * All positions are relative to the **current** screen. - * - * @param to The {@link Position} to move to. - */ -async function moveWindow(to) { - await invoke("plugin:positioner|move_window", { - position: to, - }); -} - -export { Position, moveWindow }; -//# sourceMappingURL=index.mjs.map diff --git a/plugins/positioner/guest-js/dist/index.mjs.map b/plugins/positioner/guest-js/dist/index.mjs.map deleted file mode 100644 index 05b871b6..00000000 --- a/plugins/positioner/guest-js/dist/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;AAKA;;AAEG;IACS,SAgBX;AAhBD,CAAA,UAAY,QAAQ,EAAA;AAClB,IAAA,QAAA,CAAA,QAAA,CAAA,SAAA,CAAA,GAAA,CAAA,CAAA,GAAA,SAAW,CAAA;AACX,IAAA,QAAA,CAAA,QAAA,CAAA,UAAA,CAAA,GAAA,CAAA,CAAA,GAAA,UAAQ,CAAA;AACR,IAAA,QA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,EAAE;AAC5C,QAAA,QAAQ,EAAE,EAAE;AACb,KAAA,CAAC,CAAC;AACL;;;;"} \ No newline at end of file diff --git a/plugins/positioner/guest-js/rollup.config.mjs b/plugins/positioner/guest-js/rollup.config.mjs deleted file mode 100644 index ee885522..00000000 --- a/plugins/positioner/guest-js/rollup.config.mjs +++ /dev/null @@ -1,10 +0,0 @@ -import { readFileSync } from "fs"; - -import { createConfig } from "../../../shared/rollup.config.mjs"; - -export default createConfig({ - pkg: JSON.parse( - readFileSync(new URL("./package.json", import.meta.url), "utf8") - ), - external: [/^@tauri-apps\/api/], -}); diff --git a/plugins/positioner/guest-js/tsconfig.json b/plugins/positioner/guest-js/tsconfig.json deleted file mode 120000 index 9c2b2da2..00000000 --- a/plugins/positioner/guest-js/tsconfig.json +++ /dev/null @@ -1 +0,0 @@ -../../../shared/tsconfig.json \ No newline at end of file diff --git a/plugins/positioner/guest-js/package.json b/plugins/positioner/package.json similarity index 63% rename from plugins/positioner/guest-js/package.json rename to plugins/positioner/package.json index 96219aa3..5ee70039 100644 --- a/plugins/positioner/guest-js/package.json +++ b/plugins/positioner/package.json @@ -6,13 +6,13 @@ "Tauri Programme within The Commons Conservancy" ], "type": "module", - "browser": "dist/index.min.js", - "module": "dist/index.mjs", - "types": "dist/index.d.ts", + "browser": "guest-js/dist/index.min.js", + "module": "guest-js/dist/index.mjs", + "types": "guest-js/dist/index.d.ts", "exports": { - "import": "./dist/index.mjs", - "types": "./dist/index.d.ts", - "browser": "./dist/index.min.js" + "import": "./guest-js/dist/index.mjs", + "types": "./guest-js/dist/index.d.ts", + "browser": "./guest-js/dist/index.min.js" }, "scripts": { "build": "rollup -c" diff --git a/plugins/positioner/rollup.config.mjs b/plugins/positioner/rollup.config.mjs new file mode 100644 index 00000000..6555e98b --- /dev/null +++ b/plugins/positioner/rollup.config.mjs @@ -0,0 +1,11 @@ +import { readFileSync } from "fs"; + +import { createConfig } from "../../shared/rollup.config.mjs"; + +export default createConfig({ + input: "guest-js/index.ts", + pkg: JSON.parse( + readFileSync(new URL("./package.json", import.meta.url), "utf8") + ), + external: [/^@tauri-apps\/api/], +}); diff --git a/plugins/positioner/tsconfig.json b/plugins/positioner/tsconfig.json new file mode 120000 index 00000000..7cd38da8 --- /dev/null +++ b/plugins/positioner/tsconfig.json @@ -0,0 +1 @@ +../../shared/tsconfig.json \ No newline at end of file diff --git a/plugins/sql/.gitignore b/plugins/sql/.gitignore new file mode 100644 index 00000000..b512c09d --- /dev/null +++ b/plugins/sql/.gitignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/plugins/sql/README.md b/plugins/sql/README.md index 8649c739..ee7ef740 100644 --- a/plugins/sql/README.md +++ b/plugins/sql/README.md @@ -1,17 +1,64 @@ ![plugin-sql](banner.png) - +Interface with SQL databases through [sqlx](https://github.com/launchbadge/sqlx). It supports the `sqlite`, `mysql` and `postgres` drivers, enabled by a Cargo feature. ## Install +There are three general methods of installation that we can recommend. + +1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked) +2. Pull sources directly from Github using git tags / revision hashes (most secure) +3. Git submodule install this repo in your tauri project and then use file protocol to ingest the source (most secure, but inconvenient to use) + +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" +branch = "dev" +features = ["sqlite"] # or "postgres", or "mysql" ``` +You can install the JavaScript Guest bindings using your preferred JavaScript package manager: + +> 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-sql +# or +npm add https://github.com/tauri-apps/tauri-plugin-sql +# or +yarn add https://github.com/tauri-apps/tauri-plugin-sql ``` ## Usage +First you need to register the core plugin with Tauri: + +`src-tauri/src/main.rs` +```rust +fn main() { + tauri::Builder::default() + .plugin(tauri_plugin_sql::Builder::default()) + .run(tauri::generate_context!()) + .expect("error while running tauri application"); +} ``` +Afterwards all the plugin's APIs are available through the JavaScript guest bindings: + +```javascript +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') +// mysql +const db = await Database.load('mysql://user:pass@host/database') +// postgres +const db = await Database.load('postgres://postgres:password@localhost/test') + +await db.execute('INSERT INTO ...') ``` ## Contributing @@ -20,6 +67,6 @@ PRs accepted. Please make sure to read the Contributing Guide before making a pu ## License -Code: (c) 2015 - 2021 - 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. diff --git a/plugins/sql/guest-js/dist/index.d.ts b/plugins/sql/guest-js/dist/index.d.ts deleted file mode 100644 index 6b38ccb3..00000000 --- a/plugins/sql/guest-js/dist/index.d.ts +++ /dev/null @@ -1,95 +0,0 @@ -export interface QueryResult { - /** The number of rows affected by the query. */ - rowsAffected: number; - /** - * The last inserted `id`. - * - * This value is always `0` when using the Postgres driver. If the - * last inserted id is required on Postgres, the `select` function - * must be used, with a `RETURNING` clause - * (`INSERT INTO todos (title) VALUES ($1) RETURNING id`). - */ - lastInsertId: number; -} -/** - * **Database** - * - * The `Database` class serves as the primary interface for - * communicating with the rust side of the sql plugin. - */ -export default class Database { - path: string; - constructor(path: string); - /** - * **load** - * - * A static initializer which connects to the underlying database and - * returns a `Database` instance once a connection to the database is established. - * - * # Sqlite - * - * The path is relative to `tauri::api::path::BaseDirectory::App` and must start with `sqlite:`. - * - * @example - * ```ts - * const db = await Database.load("sqlite:test.db"); - * ``` - */ - static load(path: string): Promise; - /** - * **get** - * - * A static initializer which synchronously returns an instance of - * the Database class while deferring the actual database connection - * until the first invocation or selection on the database. - * - * # Sqlite - * - * The path is relative to `tauri::api::path::BaseDirectory::App` and must start with `sqlite:`. - * - * @example - * ```ts - * const db = Database.get("sqlite:test.db"); - * ``` - */ - static get(path: string): Database; - /** - * **execute** - * - * Passes a SQL expression to the database for execution. - * - * @example - * ```ts - * const result = await db.execute( - * "UPDATE todos SET title = $1, completed = $2 WHERE id = $3", - * [ todos.title, todos.status, todos.id ] - * ); - * ``` - */ - execute(query: string, bindValues?: unknown[]): Promise; - /** - * **select** - * - * Passes in a SELECT query to the database for execution. - * - * @example - * ```ts - * const result = await db.select( - * "SELECT * from todos WHERE id = $1", id - * ); - * ``` - */ - select(query: string, bindValues?: unknown[]): Promise; - /** - * **close** - * - * Closes the database connection pool. - * - * @example - * ```ts - * const success = await db.close() - * ``` - * @param db - Optionally state the name of a database if you are managing more than one. Otherwise, all database pools will be in scope. - */ - close(db?: string): Promise; -} diff --git a/plugins/sql/guest-js/dist/index.min.js b/plugins/sql/guest-js/dist/index.min.js deleted file mode 100644 index f734a03f..00000000 --- a/plugins/sql/guest-js/dist/index.min.js +++ /dev/null @@ -1,119 +0,0 @@ -var d=Object.defineProperty;var e=(c,a)=>{for(var b in a)d(c,b,{get:a[b],enumerable:!0});}; - -var f={};e(f,{convertFileSrc:()=>w,invoke:()=>c,transformCallback:()=>s});function u(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function s(e,r=!1){let n=u(),t=`_${n}`;return Object.defineProperty(window,t,{value:o=>(r&&Reflect.deleteProperty(window,t),e==null?void 0:e(o)),writable:!1,configurable:!0}),n}async function c(e,r={}){return new Promise((n,t)=>{let o=s(i=>{n(i),Reflect.deleteProperty(window,`_${a}`);},!0),a=s(i=>{t(i),Reflect.deleteProperty(window,`_${o}`);},!0);window.__TAURI_IPC__({cmd:e,callback:o,error:a,...r});})}function w(e,r="asset"){let n=encodeURIComponent(e);return navigator.userAgent.includes("Windows")?`https://${r}.localhost/${n}`:`${r}://localhost/${n}`} - -/** - * **Database** - * - * The `Database` class serves as the primary interface for - * communicating with the rust side of the sql plugin. - */ -class Database { - constructor(path) { - this.path = path; - } - /** - * **load** - * - * A static initializer which connects to the underlying database and - * returns a `Database` instance once a connection to the database is established. - * - * # Sqlite - * - * The path is relative to `tauri::api::path::BaseDirectory::App` and must start with `sqlite:`. - * - * @example - * ```ts - * const db = await Database.load("sqlite:test.db"); - * ``` - */ - static async load(path) { - const _path = await c("plugin:sql|load", { - db: path, - }); - return new Database(_path); - } - /** - * **get** - * - * A static initializer which synchronously returns an instance of - * the Database class while deferring the actual database connection - * until the first invocation or selection on the database. - * - * # Sqlite - * - * The path is relative to `tauri::api::path::BaseDirectory::App` and must start with `sqlite:`. - * - * @example - * ```ts - * const db = Database.get("sqlite:test.db"); - * ``` - */ - static get(path) { - return new Database(path); - } - /** - * **execute** - * - * Passes a SQL expression to the database for execution. - * - * @example - * ```ts - * const result = await db.execute( - * "UPDATE todos SET title = $1, completed = $2 WHERE id = $3", - * [ todos.title, todos.status, todos.id ] - * ); - * ``` - */ - async execute(query, bindValues) { - const [rowsAffected, lastInsertId] = await c("plugin:sql|execute", { - db: this.path, - query, - values: bindValues !== null && bindValues !== void 0 ? bindValues : [], - }); - return { - lastInsertId, - rowsAffected, - }; - } - /** - * **select** - * - * Passes in a SELECT query to the database for execution. - * - * @example - * ```ts - * const result = await db.select( - * "SELECT * from todos WHERE id = $1", id - * ); - * ``` - */ - async select(query, bindValues) { - const result = await c("plugin:sql|select", { - db: this.path, - query, - values: bindValues !== null && bindValues !== void 0 ? bindValues : [], - }); - return result; - } - /** - * **close** - * - * Closes the database connection pool. - * - * @example - * ```ts - * const success = await db.close() - * ``` - * @param db - Optionally state the name of a database if you are managing more than one. Otherwise, all database pools will be in scope. - */ - async close(db) { - const success = await c("plugin:sql|close", { - db, - }); - return success; - } -} - -export { Database as default }; -//# sourceMappingURL=index.min.js.map diff --git a/plugins/sql/guest-js/dist/index.min.js.map b/plugins/sql/guest-js/dist/index.min.js.map deleted file mode 100644 index 7e3466c5..00000000 --- a/plugins/sql/guest-js/dist/index.min.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.min.js","sources":["../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-FEIY7W7S.js","../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-RCPA6UVN.js","../index.ts"],"sourcesContent":["var d=Object.defineProperty;var e=(c,a)=>{for(var b in a)d(c,b,{get:a[b],enumerable:!0})};export{e as a};\n","import{a as d}from\"./chunk-FEIY7W7S.js\";var f={};d(f,{convertFileSrc:()=>w,invoke:()=>c,transformCallback:()=>s});function u(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function s(e,r=!1){let n=u(),t=`_${n}`;return Object.defineProperty(window,t,{value:o=>(r&&Reflect.deleteProperty(window,t),e==null?void 0:e(o)),writable:!1,configurable:!0}),n}async function c(e,r={}){return new Promise((n,t)=>{let o=s(i=>{n(i),Reflect.deleteProperty(window,`_${a}`)},!0),a=s(i=>{t(i),Reflect.deleteProperty(window,`_${o}`)},!0);window.__TAURI_IPC__({cmd:e,callback:o,error:a,...r})})}function w(e,r=\"asset\"){let n=encodeURIComponent(e);return navigator.userAgent.includes(\"Windows\")?`https://${r}.localhost/${n}`:`${r}://localhost/${n}`}export{s as a,c as b,w as c,f as d};\n",null],"names":["d","invoke"],"mappings":"AAAA,IAAI,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAC,CAAC;;ACAjD,IAAI,CAAC,CAAC,EAAE,CAACA,CAAC,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,OAAO,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,WAAW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CAAI,mBAAmB,EAAE;YAClD,EAAE,EAAE,IAAI,CAAC,IAAI;YACb,KAAK;AACL,YAAA,MAAM,EAAE,UAAU,KAAA,IAAA,IAAV,UAAU,KAAV,KAAA,CAAA,GAAA,UAAU,GAAI,EAAE;AACzB,SAAA,CAAC,CAAC;AAEH,QAAA,OAAO,MAAM,CAAC;KACf;AAED;;;;;;;;;;AAUG;IACH,MAAM,KAAK,CAAC,EAAW,EAAA;AACrB,QAAA,MAAM,OAAO,GAAG,MAAMA,CAAM,CAAU,kBAAkB,EAAE;YACxD,EAAE;AACH,SAAA,CAAC,CAAC;AACH,QAAA,OAAO,OAAO,CAAC;KAChB;AACF;;;;"} \ No newline at end of file diff --git a/plugins/sql/guest-js/dist/index.mjs b/plugins/sql/guest-js/dist/index.mjs deleted file mode 100644 index e255900f..00000000 --- a/plugins/sql/guest-js/dist/index.mjs +++ /dev/null @@ -1,117 +0,0 @@ -import { invoke } from '@tauri-apps/api/tauri'; - -/** - * **Database** - * - * The `Database` class serves as the primary interface for - * communicating with the rust side of the sql plugin. - */ -class Database { - constructor(path) { - this.path = path; - } - /** - * **load** - * - * A static initializer which connects to the underlying database and - * returns a `Database` instance once a connection to the database is established. - * - * # Sqlite - * - * The path is relative to `tauri::api::path::BaseDirectory::App` and must start with `sqlite:`. - * - * @example - * ```ts - * const db = await Database.load("sqlite:test.db"); - * ``` - */ - static async load(path) { - const _path = await invoke("plugin:sql|load", { - db: path, - }); - return new Database(_path); - } - /** - * **get** - * - * A static initializer which synchronously returns an instance of - * the Database class while deferring the actual database connection - * until the first invocation or selection on the database. - * - * # Sqlite - * - * The path is relative to `tauri::api::path::BaseDirectory::App` and must start with `sqlite:`. - * - * @example - * ```ts - * const db = Database.get("sqlite:test.db"); - * ``` - */ - static get(path) { - return new Database(path); - } - /** - * **execute** - * - * Passes a SQL expression to the database for execution. - * - * @example - * ```ts - * const result = await db.execute( - * "UPDATE todos SET title = $1, completed = $2 WHERE id = $3", - * [ todos.title, todos.status, todos.id ] - * ); - * ``` - */ - async execute(query, bindValues) { - const [rowsAffected, lastInsertId] = await invoke("plugin:sql|execute", { - db: this.path, - query, - values: bindValues !== null && bindValues !== void 0 ? bindValues : [], - }); - return { - lastInsertId, - rowsAffected, - }; - } - /** - * **select** - * - * Passes in a SELECT query to the database for execution. - * - * @example - * ```ts - * const result = await db.select( - * "SELECT * from todos WHERE id = $1", id - * ); - * ``` - */ - async select(query, bindValues) { - const result = await invoke("plugin:sql|select", { - db: this.path, - query, - values: bindValues !== null && bindValues !== void 0 ? bindValues : [], - }); - return result; - } - /** - * **close** - * - * Closes the database connection pool. - * - * @example - * ```ts - * const success = await db.close() - * ``` - * @param db - Optionally state the name of a database if you are managing more than one. Otherwise, all database pools will be in scope. - */ - async close(db) { - const success = await invoke("plugin:sql|close", { - db, - }); - return success; - } -} - -export { Database as default }; -//# sourceMappingURL=index.mjs.map diff --git a/plugins/sql/guest-js/dist/index.mjs.map b/plugins/sql/guest-js/dist/index.mjs.map deleted file mode 100644 index a2499c4f..00000000 --- a/plugins/sql/guest-js/dist/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAgBA;;;;;AAKG;AACW,MAAO,QAAQ,CAAA;AAE3B,IAAA,WAAA,CAAY,IAAY,EAAA;AACtB,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;KAClB;AAED;;;;;;;;;;;;;;AAcG;AACH,IAAA,aAAa,IAAI,CAAC,IAAY,EAAA;AAC5B,QAAA,MAAM,KAAK,GAAG,MAAM,MAAM,CAAS,iBAAiB,EAAE;AACpD,YAAA,EAAE,EAAE,IAAI;AACT,SAAA,CAAC,CAAC;AAEH,QAAA,OAAO,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC;KAC5B;AAED;;;;;;;;;;;;;;;AAeG;IACH,OAAO,GAAG,CAAC,IAAY,EAAA;AACrB,QAAA,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC;KAC3B;AAED;;;;;;;;;;;;AAYG;AACH,IAAA,MAAM,OAAO,CAAC,KAAa,EAAE,UAAsB,EAAA;QACjD,MAAM,CAAC,YAAY,EAAE,YAAY,CAAC,GAAG,MAAM,MAAM,CAC/C,oBAAoB,EACpB;YACE,EAAE,EAAE,IAAI,CAAC,IAAI;YACb,KAAK;AACL,YAAA,MAAM,EAAE,UAAU,KAAA,IAAA,IAAV,UAAU,KAAV,KAAA,CAAA,GAAA,UAAU,GAAI,EAAE;AACzB,SAAA,CACF,CAAC;QAEF,OAAO;YACL,YAAY;YACZ,YAAY;SACb,CAAC;KACH;AAED;;;;;;;;;;;AAWG;AACH,IAAA,MAAM,MAAM,CAAI,KAAa,EAAE,UAAsB,EAAA;AACnD,QAAA,MAAM,MAAM,GAAG,MAAM,MAAM,CAAI,mBAAmB,EAAE;YAClD,EAAE,EAAE,IAAI,CAAC,IAAI;YACb,KAAK;AACL,YAAA,MAAM,EAAE,UAAU,KAAA,IAAA,IAAV,UAAU,KAAV,KAAA,CAAA,GAAA,UAAU,GAAI,EAAE;AACzB,SAAA,CAAC,CAAC;AAEH,QAAA,OAAO,MAAM,CAAC;KACf;AAED;;;;;;;;;;AAUG;IACH,MAAM,KAAK,CAAC,EAAW,EAAA;AACrB,QAAA,MAAM,OAAO,GAAG,MAAM,MAAM,CAAU,kBAAkB,EAAE;YACxD,EAAE;AACH,SAAA,CAAC,CAAC;AACH,QAAA,OAAO,OAAO,CAAC;KAChB;AACF;;;;"} \ No newline at end of file diff --git a/plugins/sql/guest-js/rollup.config.mjs b/plugins/sql/guest-js/rollup.config.mjs deleted file mode 100644 index ee885522..00000000 --- a/plugins/sql/guest-js/rollup.config.mjs +++ /dev/null @@ -1,10 +0,0 @@ -import { readFileSync } from "fs"; - -import { createConfig } from "../../../shared/rollup.config.mjs"; - -export default createConfig({ - pkg: JSON.parse( - readFileSync(new URL("./package.json", import.meta.url), "utf8") - ), - external: [/^@tauri-apps\/api/], -}); diff --git a/plugins/sql/guest-js/tsconfig.json b/plugins/sql/guest-js/tsconfig.json deleted file mode 120000 index 9c2b2da2..00000000 --- a/plugins/sql/guest-js/tsconfig.json +++ /dev/null @@ -1 +0,0 @@ -../../../shared/tsconfig.json \ No newline at end of file diff --git a/plugins/sql/guest-js/package.json b/plugins/sql/package.json similarity index 63% rename from plugins/sql/guest-js/package.json rename to plugins/sql/package.json index 95a1036c..35b279ed 100644 --- a/plugins/sql/guest-js/package.json +++ b/plugins/sql/package.json @@ -6,13 +6,13 @@ "Tauri Programme within The Commons Conservancy" ], "type": "module", - "browser": "dist/index.min.js", - "module": "dist/index.mjs", - "types": "dist/index.d.ts", + "browser": "guest-js/dist/index.min.js", + "module": "guest-js/dist/index.mjs", + "types": "guest-js/dist/index.d.ts", "exports": { - "import": "./dist/index.mjs", - "types": "./dist/index.d.ts", - "browser": "./dist/index.min.js" + "import": "./guest-js/dist/index.mjs", + "types": "./guest-js/dist/index.d.ts", + "browser": "./guest-js/dist/index.min.js" }, "scripts": { "build": "rollup -c" diff --git a/plugins/sql/rollup.config.mjs b/plugins/sql/rollup.config.mjs new file mode 100644 index 00000000..6555e98b --- /dev/null +++ b/plugins/sql/rollup.config.mjs @@ -0,0 +1,11 @@ +import { readFileSync } from "fs"; + +import { createConfig } from "../../shared/rollup.config.mjs"; + +export default createConfig({ + input: "guest-js/index.ts", + pkg: JSON.parse( + readFileSync(new URL("./package.json", import.meta.url), "utf8") + ), + external: [/^@tauri-apps\/api/], +}); diff --git a/plugins/sql/tsconfig.json b/plugins/sql/tsconfig.json new file mode 120000 index 00000000..7cd38da8 --- /dev/null +++ b/plugins/sql/tsconfig.json @@ -0,0 +1 @@ +../../shared/tsconfig.json \ No newline at end of file diff --git a/plugins/store/.gitignore b/plugins/store/.gitignore new file mode 100644 index 00000000..b512c09d --- /dev/null +++ b/plugins/store/.gitignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/plugins/store/README.md b/plugins/store/README.md index 8baf2b8e..4276872d 100644 --- a/plugins/store/README.md +++ b/plugins/store/README.md @@ -1,17 +1,60 @@ ![plugin-store](banner.png) - +Simple, persistent key-value store. ## Install +There are three general methods of installation that we can recommend. + +1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked) +2. Pull sources directly from Github using git tags / revision hashes (most secure) +3. Git submodule install this repo in your tauri project and then use file protocol to ingest the source (most secure, but inconvenient to use) + +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" } ``` +You can install the JavaScript Guest bindings using your preferred JavaScript package manager: + +> 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-store +# or +npm add https://github.com/tauri-apps/tauri-plugin-store +# or +yarn add https://github.com/tauri-apps/tauri-plugin-store ``` ## Usage +First you need to register the core plugin with Tauri: + +`src-tauri/src/main.rs` +```rust +fn main() { + tauri::Builder::default() + .plugin(tauri_plugin_store::Builder::default().build()) + .run(tauri::generate_context!()) + .expect("error while running tauri application"); +} ``` +Afterwards all the plugin's APIs are available through the JavaScript guest bindings: + +```javascript +import { Store } from 'tauri-plugin-store-api'; + +const store = new Store('.settings.dat'); + +await store.set('some-key', { value: 5 }); + +const val = await store.get('some-key'); +assert(val, { value: 5 }); ``` ## Contributing @@ -20,6 +63,6 @@ PRs accepted. Please make sure to read the Contributing Guide before making a pu ## License -Code: (c) 2015 - 2021 - 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. diff --git a/plugins/store/guest-js/dist/index.d.ts b/plugins/store/guest-js/dist/index.d.ts deleted file mode 100644 index 80961098..00000000 --- a/plugins/store/guest-js/dist/index.d.ts +++ /dev/null @@ -1,105 +0,0 @@ -import { UnlistenFn } from "@tauri-apps/api/event"; -/** - * A key-value store persisted by the backend layer. - */ -export declare class Store { - path: string; - constructor(path: string); - /** - * Inserts a key-value pair into the store. - * - * @param key - * @param value - * @returns - */ - set(key: string, value: unknown): Promise; - /** - * Returns the value for the given `key` or `null` the key does not exist. - * - * @param key - * @returns - */ - get(key: string): Promise; - /** - * Returns `true` if the given `key` exists in the store. - * - * @param key - * @returns - */ - has(key: string): Promise; - /** - * Removes a key-value pair from the store. - * - * @param key - * @returns - */ - delete(key: string): Promise; - /** - * Clears the store, removing all key-value pairs. - * - * Note: To clear the storage and reset it to it's `default` value, use `reset` instead. - * @returns - */ - clear(): Promise; - /** - * Resets the store to it's `default` value. - * - * If no default value has been set, this method behaves identical to `clear`. - * @returns - */ - reset(): Promise; - /** - * Returns a list of all key in the store. - * - * @returns - */ - keys(): Promise; - /** - * Returns a list of all values in the store. - * - * @returns - */ - values(): Promise; - /** - * Returns a list of all entries in the store. - * - * @returns - */ - entries(): Promise>; - /** - * Returns the number of key-value pairs in the store. - * - * @returns - */ - length(): Promise; - /** - * Attempts to load the on-disk state at the stores `path` into memory. - * - * This method is useful if the on-disk state was edited by the user and you want to synchronize the changes. - * - * Note: This method does not emit change events. - * @returns - */ - load(): Promise; - /** - * Saves the store to disk at the stores `path`. - * - * As the store is only persistet to disk before the apps exit, changes might be lost in a crash. - * This method let's you persist the store to disk whenever you deem necessary. - * @returns - */ - save(): Promise; - /** - * Listen to changes on a store key. - * @param key - * @param cb - * @returns A promise resolving to a function to unlisten to the event. - */ - onKeyChange(key: string, cb: (value: T | null) => void): Promise; - /** - * Listen to changes on the store. - * @param cb - * @returns A promise resolving to a function to unlisten to the event. - */ - onChange(cb: (key: string, value: unknown) => void): Promise; -} diff --git a/plugins/store/guest-js/dist/index.min.js b/plugins/store/guest-js/dist/index.min.js deleted file mode 100644 index f9874a30..00000000 --- a/plugins/store/guest-js/dist/index.min.js +++ /dev/null @@ -1,185 +0,0 @@ -var d=Object.defineProperty;var e=(c,a)=>{for(var b in a)d(c,b,{get:a[b],enumerable:!0});}; - -var f$1={};e(f$1,{convertFileSrc:()=>w,invoke:()=>c$2,transformCallback:()=>s$2});function u$2(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function s$2(e,r=!1){let n=u$2(),t=`_${n}`;return Object.defineProperty(window,t,{value:o=>(r&&Reflect.deleteProperty(window,t),e==null?void 0:e(o)),writable:!1,configurable:!0}),n}async function c$2(e,r={}){return new Promise((n,t)=>{let o=s$2(i=>{n(i),Reflect.deleteProperty(window,`_${a}`);},!0),a=s$2(i=>{t(i),Reflect.deleteProperty(window,`_${o}`);},!0);window.__TAURI_IPC__({cmd:e,callback:o,error:a,...r});})}function w(e,r="asset"){let n=encodeURIComponent(e);return navigator.userAgent.includes("Windows")?`https://${r}.localhost/${n}`:`${r}://localhost/${n}`} - -async function a(i){return c$2("tauri",i)} - -var W$1={};e(W$1,{TauriEvent:()=>c$1,emit:()=>D,listen:()=>E$1,once:()=>_});async function s$1(n,t){return a({__tauriModule:"Event",message:{cmd:"unlisten",event:n,eventId:t}})}async function m$1(n,t,i){await a({__tauriModule:"Event",message:{cmd:"emit",event:n,windowLabel:t,payload:i}});}async function o$1(n,t,i){return a({__tauriModule:"Event",message:{cmd:"listen",event:n,windowLabel:t,handler:s$2(i)}}).then(r=>async()=>s$1(n,r))}async function u$1(n,t,i){return o$1(n,t,r=>{i(r),s$1(n,r.id).catch(()=>{});})}var c$1=(e=>(e.WINDOW_RESIZED="tauri://resize",e.WINDOW_MOVED="tauri://move",e.WINDOW_CLOSE_REQUESTED="tauri://close-requested",e.WINDOW_CREATED="tauri://window-created",e.WINDOW_DESTROYED="tauri://destroyed",e.WINDOW_FOCUS="tauri://focus",e.WINDOW_BLUR="tauri://blur",e.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",e.WINDOW_THEME_CHANGED="tauri://theme-changed",e.WINDOW_FILE_DROP="tauri://file-drop",e.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover",e.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled",e.MENU="tauri://menu",e.CHECK_UPDATE="tauri://update",e.UPDATE_AVAILABLE="tauri://update-available",e.INSTALL_UPDATE="tauri://update-install",e.STATUS_UPDATE="tauri://update-status",e.DOWNLOAD_PROGRESS="tauri://update-download-progress",e))(c$1||{});async function E$1(n,t){return o$1(n,null,t)}async function _(n,t){return u$1(n,null,t)}async function D(n,t){return m$1(n,void 0,t)} - -var C={};e(C,{CloseRequestedEvent:()=>y,LogicalPosition:()=>c,LogicalSize:()=>m,PhysicalPosition:()=>o,PhysicalSize:()=>l,UserAttentionType:()=>W,WebviewWindow:()=>s,WebviewWindowHandle:()=>u,WindowManager:()=>h,appWindow:()=>b,availableMonitors:()=>T,currentMonitor:()=>E,getAll:()=>M,getCurrent:()=>f,primaryMonitor:()=>z});var m=class{constructor(e,a){this.type="Logical";this.width=e,this.height=a;}},l=class{constructor(e,a){this.type="Physical";this.width=e,this.height=a;}toLogical(e){return new m(this.width/e,this.height/e)}},c=class{constructor(e,a){this.type="Logical";this.x=e,this.y=a;}},o=class{constructor(e,a){this.type="Physical";this.x=e,this.y=a;}toLogical(e){return new c(this.x/e,this.y/e)}},W=(a=>(a[a.Critical=1]="Critical",a[a.Informational=2]="Informational",a))(W||{});function f(){return new s(window.__TAURI_METADATA__.__currentWindow.label,{skip:!0})}function M(){return window.__TAURI_METADATA__.__windows.map(i=>new s(i.label,{skip:!0}))}var P=["tauri://created","tauri://error"],u=class{constructor(e){this.label=e,this.listeners=Object.create(null);}async listen(e,a){return this._handleTauriEvent(e,a)?Promise.resolve(()=>{let n=this.listeners[e];n.splice(n.indexOf(a),1);}):o$1(e,this.label,a)}async once(e,a){return this._handleTauriEvent(e,a)?Promise.resolve(()=>{let n=this.listeners[e];n.splice(n.indexOf(a),1);}):u$1(e,this.label,a)}async emit(e,a){if(P.includes(e)){for(let n of this.listeners[e]||[])n({event:e,id:-1,windowLabel:this.label,payload:a});return Promise.resolve()}return m$1(e,this.label,a)}_handleTauriEvent(e,a){return P.includes(e)?(e in this.listeners?this.listeners[e].push(a):this.listeners[e]=[a],!0):!1}},h=class extends u{async scaleFactor(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"scaleFactor"}}}})}async innerPosition(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"innerPosition"}}}}).then(({x:e,y:a})=>new o(e,a))}async outerPosition(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"outerPosition"}}}}).then(({x:e,y:a})=>new o(e,a))}async innerSize(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"innerSize"}}}}).then(({width:e,height:a})=>new l(e,a))}async outerSize(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"outerSize"}}}}).then(({width:e,height:a})=>new l(e,a))}async isFullscreen(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"isFullscreen"}}}})}async isMaximized(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"isMaximized"}}}})}async isDecorated(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"isDecorated"}}}})}async isResizable(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"isResizable"}}}})}async isVisible(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"isVisible"}}}})}async theme(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"theme"}}}})}async center(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"center"}}}})}async requestUserAttention(e){let a$1=null;return e&&(e===1?a$1={type:"Critical"}:a$1={type:"Informational"}),a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"requestUserAttention",payload:a$1}}}})}async setResizable(e){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setResizable",payload:e}}}})}async setTitle(e){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setTitle",payload:e}}}})}async maximize(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"maximize"}}}})}async unmaximize(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"unmaximize"}}}})}async toggleMaximize(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"toggleMaximize"}}}})}async minimize(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"minimize"}}}})}async unminimize(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"unminimize"}}}})}async show(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"show"}}}})}async hide(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"hide"}}}})}async close(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"close"}}}})}async setDecorations(e){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setDecorations",payload:e}}}})}async setAlwaysOnTop(e){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setAlwaysOnTop",payload:e}}}})}async setSize(e){if(!e||e.type!=="Logical"&&e.type!=="Physical")throw new Error("the `size` argument must be either a LogicalSize or a PhysicalSize instance");return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setSize",payload:{type:e.type,data:{width:e.width,height:e.height}}}}}})}async setMinSize(e){if(e&&e.type!=="Logical"&&e.type!=="Physical")throw new Error("the `size` argument must be either a LogicalSize or a PhysicalSize instance");return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setMinSize",payload:e?{type:e.type,data:{width:e.width,height:e.height}}:null}}}})}async setMaxSize(e){if(e&&e.type!=="Logical"&&e.type!=="Physical")throw new Error("the `size` argument must be either a LogicalSize or a PhysicalSize instance");return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setMaxSize",payload:e?{type:e.type,data:{width:e.width,height:e.height}}:null}}}})}async setPosition(e){if(!e||e.type!=="Logical"&&e.type!=="Physical")throw new Error("the `position` argument must be either a LogicalPosition or a PhysicalPosition instance");return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setPosition",payload:{type:e.type,data:{x:e.x,y:e.y}}}}}})}async setFullscreen(e){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setFullscreen",payload:e}}}})}async setFocus(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setFocus"}}}})}async setIcon(e){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setIcon",payload:{icon:typeof e=="string"?e:Array.from(e)}}}}})}async setSkipTaskbar(e){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setSkipTaskbar",payload:e}}}})}async setCursorGrab(e){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setCursorGrab",payload:e}}}})}async setCursorVisible(e){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setCursorVisible",payload:e}}}})}async setCursorIcon(e){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setCursorIcon",payload:e}}}})}async setCursorPosition(e){if(!e||e.type!=="Logical"&&e.type!=="Physical")throw new Error("the `position` argument must be either a LogicalPosition or a PhysicalPosition instance");return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setCursorPosition",payload:{type:e.type,data:{x:e.x,y:e.y}}}}}})}async setIgnoreCursorEvents(e){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setIgnoreCursorEvents",payload:e}}}})}async startDragging(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"startDragging"}}}})}async onResized(e){return this.listen("tauri://resize",e)}async onMoved(e){return this.listen("tauri://move",e)}async onCloseRequested(e){return this.listen("tauri://close-requested",a=>{let n=new y(a);Promise.resolve(e(n)).then(()=>{if(!n.isPreventDefault())return this.close()});})}async onFocusChanged(e){let a=await this.listen("tauri://focus",d=>{e({...d,payload:!0});}),n=await this.listen("tauri://blur",d=>{e({...d,payload:!1});});return ()=>{a(),n();}}async onScaleChanged(e){return this.listen("tauri://scale-change",e)}async onMenuClicked(e){return this.listen("tauri://menu",e)}async onFileDropEvent(e){let a=await this.listen("tauri://file-drop",r=>{e({...r,payload:{type:"drop",paths:r.payload}});}),n=await this.listen("tauri://file-drop-hover",r=>{e({...r,payload:{type:"hover",paths:r.payload}});}),d=await this.listen("tauri://file-drop-cancelled",r=>{e({...r,payload:{type:"cancel"}});});return ()=>{a(),n(),d();}}async onThemeChanged(e){return this.listen("tauri://theme-changed",e)}},y=class{constructor(e){this._preventDefault=!1;this.event=e.event,this.windowLabel=e.windowLabel,this.id=e.id;}preventDefault(){this._preventDefault=!0;}isPreventDefault(){return this._preventDefault}},s=class extends h{constructor(e,a$1={}){super(e),a$1!=null&&a$1.skip||a({__tauriModule:"Window",message:{cmd:"createWebview",data:{options:{label:e,...a$1}}}}).then(async()=>this.emit("tauri://created")).catch(async n=>this.emit("tauri://error",n));}static getByLabel(e){return M().some(a=>a.label===e)?new s(e,{skip:!0}):null}},b;"__TAURI_METADATA__"in window?b=new s(window.__TAURI_METADATA__.__currentWindow.label,{skip:!0}):(console.warn(`Could not find "window.__TAURI_METADATA__". The "appWindow" value will reference the "main" window label. -Note that this is not an issue if running this frontend on a browser instead of a Tauri window.`),b=new s("main",{skip:!0}));function g(i){return i===null?null:{name:i.name,scaleFactor:i.scaleFactor,position:new o(i.position.x,i.position.y),size:new l(i.size.width,i.size.height)}}async function E(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{cmd:{type:"currentMonitor"}}}}).then(g)}async function z(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{cmd:{type:"primaryMonitor"}}}}).then(g)}async function T(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{cmd:{type:"availableMonitors"}}}}).then(i=>i.map(g))} - -// Copyright 2021 Tauri Programme within The Commons Conservancy -/** - * A key-value store persisted by the backend layer. - */ -class Store { - constructor(path) { - this.path = path; - } - /** - * Inserts a key-value pair into the store. - * - * @param key - * @param value - * @returns - */ - async set(key, value) { - return await c$2("plugin:store|set", { - path: this.path, - key, - value, - }); - } - /** - * Returns the value for the given `key` or `null` the key does not exist. - * - * @param key - * @returns - */ - async get(key) { - return await c$2("plugin:store|get", { - path: this.path, - key, - }); - } - /** - * Returns `true` if the given `key` exists in the store. - * - * @param key - * @returns - */ - async has(key) { - return await c$2("plugin:store|has", { - path: this.path, - key, - }); - } - /** - * Removes a key-value pair from the store. - * - * @param key - * @returns - */ - async delete(key) { - return await c$2("plugin:store|delete", { - path: this.path, - key, - }); - } - /** - * Clears the store, removing all key-value pairs. - * - * Note: To clear the storage and reset it to it's `default` value, use `reset` instead. - * @returns - */ - async clear() { - return await c$2("plugin:store|clear", { - path: this.path, - }); - } - /** - * Resets the store to it's `default` value. - * - * If no default value has been set, this method behaves identical to `clear`. - * @returns - */ - async reset() { - return await c$2("plugin:store|reset", { - path: this.path, - }); - } - /** - * Returns a list of all key in the store. - * - * @returns - */ - async keys() { - return await c$2("plugin:store|keys", { - path: this.path, - }); - } - /** - * Returns a list of all values in the store. - * - * @returns - */ - async values() { - return await c$2("plugin:store|values", { - path: this.path, - }); - } - /** - * Returns a list of all entries in the store. - * - * @returns - */ - async entries() { - return await c$2("plugin:store|entries", { - path: this.path, - }); - } - /** - * Returns the number of key-value pairs in the store. - * - * @returns - */ - async length() { - return await c$2("plugin:store|length", { - path: this.path, - }); - } - /** - * Attempts to load the on-disk state at the stores `path` into memory. - * - * This method is useful if the on-disk state was edited by the user and you want to synchronize the changes. - * - * Note: This method does not emit change events. - * @returns - */ - async load() { - return await c$2("plugin:store|load", { - path: this.path, - }); - } - /** - * Saves the store to disk at the stores `path`. - * - * As the store is only persisted to disk before the apps exit, changes might be lost in a crash. - * This method lets you persist the store to disk whenever you deem necessary. - * @returns - */ - async save() { - return await c$2("plugin:store|save", { - path: this.path, - }); - } - /** - * Listen to changes on a store key. - * @param key - * @param cb - * @returns A promise resolving to a function to unlisten to the event. - */ - async onKeyChange(key, cb) { - return await b.listen("store://change", (event) => { - if (event.payload.path === this.path && event.payload.key === key) { - cb(event.payload.value); - } - }); - } - /** - * Listen to changes on the store. - * @param cb - * @returns A promise resolving to a function to unlisten to the event. - */ - async onChange(cb) { - return await b.listen("store://change", (event) => { - if (event.payload.path === this.path) { - cb(event.payload.key, event.payload.value); - } - }); - } -} - -export { Store }; -//# sourceMappingURL=index.min.js.map diff --git a/plugins/store/guest-js/dist/index.min.js.map b/plugins/store/guest-js/dist/index.min.js.map deleted file mode 100644 index a5e2f71f..00000000 --- a/plugins/store/guest-js/dist/index.min.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.min.js","sources":["../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-FEIY7W7S.js","../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-RCPA6UVN.js","../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-HNLFKTAJ.js","../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-3WDDWFXT.js","../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-QSWLDHGO.js","../index.ts"],"sourcesContent":["var d=Object.defineProperty;var e=(c,a)=>{for(var b in a)d(c,b,{get:a[b],enumerable:!0})};export{e as a};\n","import{a as d}from\"./chunk-FEIY7W7S.js\";var f={};d(f,{convertFileSrc:()=>w,invoke:()=>c,transformCallback:()=>s});function u(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function s(e,r=!1){let n=u(),t=`_${n}`;return Object.defineProperty(window,t,{value:o=>(r&&Reflect.deleteProperty(window,t),e==null?void 0:e(o)),writable:!1,configurable:!0}),n}async function c(e,r={}){return new Promise((n,t)=>{let o=s(i=>{n(i),Reflect.deleteProperty(window,`_${a}`)},!0),a=s(i=>{t(i),Reflect.deleteProperty(window,`_${o}`)},!0);window.__TAURI_IPC__({cmd:e,callback:o,error:a,...r})})}function w(e,r=\"asset\"){let n=encodeURIComponent(e);return navigator.userAgent.includes(\"Windows\")?`https://${r}.localhost/${n}`:`${r}://localhost/${n}`}export{s as a,c as b,w as c,f as d};\n","import{b as o}from\"./chunk-RCPA6UVN.js\";async function a(i){return o(\"tauri\",i)}export{a};\n","import{a}from\"./chunk-HNLFKTAJ.js\";import{a as l}from\"./chunk-RCPA6UVN.js\";import{a as d}from\"./chunk-FEIY7W7S.js\";var W={};d(W,{TauriEvent:()=>c,emit:()=>D,listen:()=>E,once:()=>_});async function s(n,t){return a({__tauriModule:\"Event\",message:{cmd:\"unlisten\",event:n,eventId:t}})}async function m(n,t,i){await a({__tauriModule:\"Event\",message:{cmd:\"emit\",event:n,windowLabel:t,payload:i}})}async function o(n,t,i){return a({__tauriModule:\"Event\",message:{cmd:\"listen\",event:n,windowLabel:t,handler:l(i)}}).then(r=>async()=>s(n,r))}async function u(n,t,i){return o(n,t,r=>{i(r),s(n,r.id).catch(()=>{})})}var c=(e=>(e.WINDOW_RESIZED=\"tauri://resize\",e.WINDOW_MOVED=\"tauri://move\",e.WINDOW_CLOSE_REQUESTED=\"tauri://close-requested\",e.WINDOW_CREATED=\"tauri://window-created\",e.WINDOW_DESTROYED=\"tauri://destroyed\",e.WINDOW_FOCUS=\"tauri://focus\",e.WINDOW_BLUR=\"tauri://blur\",e.WINDOW_SCALE_FACTOR_CHANGED=\"tauri://scale-change\",e.WINDOW_THEME_CHANGED=\"tauri://theme-changed\",e.WINDOW_FILE_DROP=\"tauri://file-drop\",e.WINDOW_FILE_DROP_HOVER=\"tauri://file-drop-hover\",e.WINDOW_FILE_DROP_CANCELLED=\"tauri://file-drop-cancelled\",e.MENU=\"tauri://menu\",e.CHECK_UPDATE=\"tauri://update\",e.UPDATE_AVAILABLE=\"tauri://update-available\",e.INSTALL_UPDATE=\"tauri://update-install\",e.STATUS_UPDATE=\"tauri://update-status\",e.DOWNLOAD_PROGRESS=\"tauri://update-download-progress\",e))(c||{});async function E(n,t){return o(n,null,t)}async function _(n,t){return u(n,null,t)}async function D(n,t){return m(n,void 0,t)}export{m as a,o as b,u as c,c as d,E as e,_ as f,D as g,W as h};\n","import{a as p,b as _,c as w}from\"./chunk-3WDDWFXT.js\";import{a as t}from\"./chunk-HNLFKTAJ.js\";import{a as v}from\"./chunk-FEIY7W7S.js\";var C={};v(C,{CloseRequestedEvent:()=>y,LogicalPosition:()=>c,LogicalSize:()=>m,PhysicalPosition:()=>o,PhysicalSize:()=>l,UserAttentionType:()=>W,WebviewWindow:()=>s,WebviewWindowHandle:()=>u,WindowManager:()=>h,appWindow:()=>b,availableMonitors:()=>T,currentMonitor:()=>E,getAll:()=>M,getCurrent:()=>f,primaryMonitor:()=>z});var m=class{constructor(e,a){this.type=\"Logical\";this.width=e,this.height=a}},l=class{constructor(e,a){this.type=\"Physical\";this.width=e,this.height=a}toLogical(e){return new m(this.width/e,this.height/e)}},c=class{constructor(e,a){this.type=\"Logical\";this.x=e,this.y=a}},o=class{constructor(e,a){this.type=\"Physical\";this.x=e,this.y=a}toLogical(e){return new c(this.x/e,this.y/e)}},W=(a=>(a[a.Critical=1]=\"Critical\",a[a.Informational=2]=\"Informational\",a))(W||{});function f(){return new s(window.__TAURI_METADATA__.__currentWindow.label,{skip:!0})}function M(){return window.__TAURI_METADATA__.__windows.map(i=>new s(i.label,{skip:!0}))}var P=[\"tauri://created\",\"tauri://error\"],u=class{constructor(e){this.label=e,this.listeners=Object.create(null)}async listen(e,a){return this._handleTauriEvent(e,a)?Promise.resolve(()=>{let n=this.listeners[e];n.splice(n.indexOf(a),1)}):_(e,this.label,a)}async once(e,a){return this._handleTauriEvent(e,a)?Promise.resolve(()=>{let n=this.listeners[e];n.splice(n.indexOf(a),1)}):w(e,this.label,a)}async emit(e,a){if(P.includes(e)){for(let n of this.listeners[e]||[])n({event:e,id:-1,windowLabel:this.label,payload:a});return Promise.resolve()}return p(e,this.label,a)}_handleTauriEvent(e,a){return P.includes(e)?(e in this.listeners?this.listeners[e].push(a):this.listeners[e]=[a],!0):!1}},h=class extends u{async scaleFactor(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"scaleFactor\"}}}})}async innerPosition(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"innerPosition\"}}}}).then(({x:e,y:a})=>new o(e,a))}async outerPosition(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"outerPosition\"}}}}).then(({x:e,y:a})=>new o(e,a))}async innerSize(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"innerSize\"}}}}).then(({width:e,height:a})=>new l(e,a))}async outerSize(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"outerSize\"}}}}).then(({width:e,height:a})=>new l(e,a))}async isFullscreen(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"isFullscreen\"}}}})}async isMaximized(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"isMaximized\"}}}})}async isDecorated(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"isDecorated\"}}}})}async isResizable(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"isResizable\"}}}})}async isVisible(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"isVisible\"}}}})}async theme(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"theme\"}}}})}async center(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"center\"}}}})}async requestUserAttention(e){let a=null;return e&&(e===1?a={type:\"Critical\"}:a={type:\"Informational\"}),t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"requestUserAttention\",payload:a}}}})}async setResizable(e){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setResizable\",payload:e}}}})}async setTitle(e){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setTitle\",payload:e}}}})}async maximize(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"maximize\"}}}})}async unmaximize(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"unmaximize\"}}}})}async toggleMaximize(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"toggleMaximize\"}}}})}async minimize(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"minimize\"}}}})}async unminimize(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"unminimize\"}}}})}async show(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"show\"}}}})}async hide(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"hide\"}}}})}async close(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"close\"}}}})}async setDecorations(e){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setDecorations\",payload:e}}}})}async setAlwaysOnTop(e){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setAlwaysOnTop\",payload:e}}}})}async setSize(e){if(!e||e.type!==\"Logical\"&&e.type!==\"Physical\")throw new Error(\"the `size` argument must be either a LogicalSize or a PhysicalSize instance\");return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setSize\",payload:{type:e.type,data:{width:e.width,height:e.height}}}}}})}async setMinSize(e){if(e&&e.type!==\"Logical\"&&e.type!==\"Physical\")throw new Error(\"the `size` argument must be either a LogicalSize or a PhysicalSize instance\");return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setMinSize\",payload:e?{type:e.type,data:{width:e.width,height:e.height}}:null}}}})}async setMaxSize(e){if(e&&e.type!==\"Logical\"&&e.type!==\"Physical\")throw new Error(\"the `size` argument must be either a LogicalSize or a PhysicalSize instance\");return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setMaxSize\",payload:e?{type:e.type,data:{width:e.width,height:e.height}}:null}}}})}async setPosition(e){if(!e||e.type!==\"Logical\"&&e.type!==\"Physical\")throw new Error(\"the `position` argument must be either a LogicalPosition or a PhysicalPosition instance\");return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setPosition\",payload:{type:e.type,data:{x:e.x,y:e.y}}}}}})}async setFullscreen(e){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setFullscreen\",payload:e}}}})}async setFocus(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setFocus\"}}}})}async setIcon(e){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setIcon\",payload:{icon:typeof e==\"string\"?e:Array.from(e)}}}}})}async setSkipTaskbar(e){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setSkipTaskbar\",payload:e}}}})}async setCursorGrab(e){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setCursorGrab\",payload:e}}}})}async setCursorVisible(e){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setCursorVisible\",payload:e}}}})}async setCursorIcon(e){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setCursorIcon\",payload:e}}}})}async setCursorPosition(e){if(!e||e.type!==\"Logical\"&&e.type!==\"Physical\")throw new Error(\"the `position` argument must be either a LogicalPosition or a PhysicalPosition instance\");return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setCursorPosition\",payload:{type:e.type,data:{x:e.x,y:e.y}}}}}})}async setIgnoreCursorEvents(e){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setIgnoreCursorEvents\",payload:e}}}})}async startDragging(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"startDragging\"}}}})}async onResized(e){return this.listen(\"tauri://resize\",e)}async onMoved(e){return this.listen(\"tauri://move\",e)}async onCloseRequested(e){return this.listen(\"tauri://close-requested\",a=>{let n=new y(a);Promise.resolve(e(n)).then(()=>{if(!n.isPreventDefault())return this.close()})})}async onFocusChanged(e){let a=await this.listen(\"tauri://focus\",d=>{e({...d,payload:!0})}),n=await this.listen(\"tauri://blur\",d=>{e({...d,payload:!1})});return()=>{a(),n()}}async onScaleChanged(e){return this.listen(\"tauri://scale-change\",e)}async onMenuClicked(e){return this.listen(\"tauri://menu\",e)}async onFileDropEvent(e){let a=await this.listen(\"tauri://file-drop\",r=>{e({...r,payload:{type:\"drop\",paths:r.payload}})}),n=await this.listen(\"tauri://file-drop-hover\",r=>{e({...r,payload:{type:\"hover\",paths:r.payload}})}),d=await this.listen(\"tauri://file-drop-cancelled\",r=>{e({...r,payload:{type:\"cancel\"}})});return()=>{a(),n(),d()}}async onThemeChanged(e){return this.listen(\"tauri://theme-changed\",e)}},y=class{constructor(e){this._preventDefault=!1;this.event=e.event,this.windowLabel=e.windowLabel,this.id=e.id}preventDefault(){this._preventDefault=!0}isPreventDefault(){return this._preventDefault}},s=class extends h{constructor(e,a={}){super(e),a!=null&&a.skip||t({__tauriModule:\"Window\",message:{cmd:\"createWebview\",data:{options:{label:e,...a}}}}).then(async()=>this.emit(\"tauri://created\")).catch(async n=>this.emit(\"tauri://error\",n))}static getByLabel(e){return M().some(a=>a.label===e)?new s(e,{skip:!0}):null}},b;\"__TAURI_METADATA__\"in window?b=new s(window.__TAURI_METADATA__.__currentWindow.label,{skip:!0}):(console.warn(`Could not find \"window.__TAURI_METADATA__\". The \"appWindow\" value will reference the \"main\" window label.\nNote that this is not an issue if running this frontend on a browser instead of a Tauri window.`),b=new s(\"main\",{skip:!0}));function g(i){return i===null?null:{name:i.name,scaleFactor:i.scaleFactor,position:new o(i.position.x,i.position.y),size:new l(i.size.width,i.size.height)}}async function E(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{cmd:{type:\"currentMonitor\"}}}}).then(g)}async function z(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{cmd:{type:\"primaryMonitor\"}}}}).then(g)}async function T(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{cmd:{type:\"availableMonitors\"}}}}).then(i=>i.map(g))}export{m as a,l as b,c,o as d,W as e,f,M as g,u as h,h as i,y as j,s as k,b as l,E as m,z as n,T as o,C as p};\n",null],"names":["f","d","c","s","u","o","W","E","m","l","v","_","w","p","t","a","invoke","appWindow"],"mappings":"AAAA,IAAI,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAC,CAAC;;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AAI;AAChB,SAAA,CAAC,CAAC;KACJ;AAED;;;;;AAKG;AACH,IAAA,MAAM,WAAW,CACf,GAAW,EACX,EAA6B,EAAA;QAE7B,OAAO,MAAMC,CAAS,CAAC,MAAM,CAC3B,gBAAgB,EAChB,CAAC,KAAK,KAAI;AACR,YAAA,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,KAAK,GAAG,EAAE;AACjE,gBAAA,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AACzB,aAAA;AACH,SAAC,CACF,CAAC;KACH;AAED;;;;AAIG;IACH,MAAM,QAAQ,CACZ,EAA0C,EAAA;QAE1C,OAAO,MAAMA,CAAS,CAAC,MAAM,CAC3B,gBAAgB,EAChB,CAAC,KAAK,KAAI;YACR,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE;AACpC,gBAAA,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC5C,aAAA;AACH,SAAC,CACF,CAAC;KACH;AACF;;;;"} \ No newline at end of file diff --git a/plugins/store/guest-js/dist/index.mjs b/plugins/store/guest-js/dist/index.mjs deleted file mode 100644 index 014fb4e6..00000000 --- a/plugins/store/guest-js/dist/index.mjs +++ /dev/null @@ -1,177 +0,0 @@ -import { invoke } from '@tauri-apps/api/tauri'; -import { appWindow } from '@tauri-apps/api/window'; - -// Copyright 2021 Tauri Programme within The Commons Conservancy -/** - * A key-value store persisted by the backend layer. - */ -class Store { - constructor(path) { - this.path = path; - } - /** - * Inserts a key-value pair into the store. - * - * @param key - * @param value - * @returns - */ - async set(key, value) { - return await invoke("plugin:store|set", { - path: this.path, - key, - value, - }); - } - /** - * Returns the value for the given `key` or `null` the key does not exist. - * - * @param key - * @returns - */ - async get(key) { - return await invoke("plugin:store|get", { - path: this.path, - key, - }); - } - /** - * Returns `true` if the given `key` exists in the store. - * - * @param key - * @returns - */ - async has(key) { - return await invoke("plugin:store|has", { - path: this.path, - key, - }); - } - /** - * Removes a key-value pair from the store. - * - * @param key - * @returns - */ - async delete(key) { - return await invoke("plugin:store|delete", { - path: this.path, - key, - }); - } - /** - * Clears the store, removing all key-value pairs. - * - * Note: To clear the storage and reset it to it's `default` value, use `reset` instead. - * @returns - */ - async clear() { - return await invoke("plugin:store|clear", { - path: this.path, - }); - } - /** - * Resets the store to it's `default` value. - * - * If no default value has been set, this method behaves identical to `clear`. - * @returns - */ - async reset() { - return await invoke("plugin:store|reset", { - path: this.path, - }); - } - /** - * Returns a list of all key in the store. - * - * @returns - */ - async keys() { - return await invoke("plugin:store|keys", { - path: this.path, - }); - } - /** - * Returns a list of all values in the store. - * - * @returns - */ - async values() { - return await invoke("plugin:store|values", { - path: this.path, - }); - } - /** - * Returns a list of all entries in the store. - * - * @returns - */ - async entries() { - return await invoke("plugin:store|entries", { - path: this.path, - }); - } - /** - * Returns the number of key-value pairs in the store. - * - * @returns - */ - async length() { - return await invoke("plugin:store|length", { - path: this.path, - }); - } - /** - * Attempts to load the on-disk state at the stores `path` into memory. - * - * This method is useful if the on-disk state was edited by the user and you want to synchronize the changes. - * - * Note: This method does not emit change events. - * @returns - */ - async load() { - return await invoke("plugin:store|load", { - path: this.path, - }); - } - /** - * Saves the store to disk at the stores `path`. - * - * As the store is only persisted to disk before the apps exit, changes might be lost in a crash. - * This method lets you persist the store to disk whenever you deem necessary. - * @returns - */ - async save() { - return await invoke("plugin:store|save", { - path: this.path, - }); - } - /** - * Listen to changes on a store key. - * @param key - * @param cb - * @returns A promise resolving to a function to unlisten to the event. - */ - async onKeyChange(key, cb) { - return await appWindow.listen("store://change", (event) => { - if (event.payload.path === this.path && event.payload.key === key) { - cb(event.payload.value); - } - }); - } - /** - * Listen to changes on the store. - * @param cb - * @returns A promise resolving to a function to unlisten to the event. - */ - async onChange(cb) { - return await appWindow.listen("store://change", (event) => { - if (event.payload.path === this.path) { - cb(event.payload.key, event.payload.value); - } - }); - } -} - -export { Store }; -//# sourceMappingURL=index.mjs.map diff --git a/plugins/store/guest-js/dist/index.mjs.map b/plugins/store/guest-js/dist/index.mjs.map deleted file mode 100644 index b62d6b44..00000000 --- a/plugins/store/guest-js/dist/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAAA;AAcA;;AAEG;MACU,KAAK,CAAA;AAEhB,IAAA,WAAA,CAAY,IAAY,EAAA;AACtB,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;KAClB;AAED;;;;;;AAMG;AACH,IAAA,MAAM,GAAG,CAAC,GAAW,EAAE,KAAc,EAAA;AACnC,QAAA,OAAO,MAAM,MAAM,CAAC,kBAAkB,EAAE;YACtC,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,GAAG;YACH,KAAK;AACN,SAAA,CAAC,CAAC;KACJ;AAED;;;;;AAKG;IACH,MAAM,GAAG,CAAI,GAAW,EAAA;AACtB,QAAA,OAAO,MAAM,MAAM,CAAC,kBAAkB,EAAE;YACtC,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,GAAG;AACJ,SAAA,CAAC,CAAC;KACJ;AAED;;;;;AAKG;IACH,MAAM,GAAG,CAAC,GAAW,EAAA;AACnB,QAAA,OAAO,MAAM,MAAM,CAAC,kBAAkB,EAAE;YACtC,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,GAAG;AACJ,SAAA,CAAC,CAAC;KACJ;AAED;;;;;AAKG;IACH,MAAM,MAAM,CAAC,GAAW,EAAA;AACtB,QAAA,OAAO,MAAM,MAAM,CAAC,qBAAqB,EAAE;YACzC,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,GAAG;AACJ,SAAA,CAAC,CAAC;KACJ;AAED;;;;;AAKG;AACH,IAAA,MAAM,KAAK,GAAA;AACT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AAED;;;;;AAKG;AACH,IAAA,MAAM,WAAW,CACf,GAAW,EACX,EAA6B,EAAA;QAE7B,OAAO,MAAM,SAAS,CAAC,MAAM,CAC3B,gBAAgB,EAChB,CAAC,KAAK,KAAI;AACR,YAAA,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,KAAK,GAAG,EAAE;AACjE,gBAAA,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AACzB,aAAA;AACH,SAAC,CACF,CAAC;KACH;AAED;;;;AAIG;IACH,MAAM,QAAQ,CACZ,EAA0C,EAAA;QAE1C,OAAO,MAAM,SAAS,CAAC,MAAM,CAC3B,gBAAgB,EAChB,CAAC,KAAK,KAAI;YACR,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE;AACpC,gBAAA,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC5C,aAAA;AACH,SAAC,CACF,CAAC;KACH;AACF;;;;"} \ No newline at end of file diff --git a/plugins/store/guest-js/rollup.config.mjs b/plugins/store/guest-js/rollup.config.mjs deleted file mode 100644 index ee885522..00000000 --- a/plugins/store/guest-js/rollup.config.mjs +++ /dev/null @@ -1,10 +0,0 @@ -import { readFileSync } from "fs"; - -import { createConfig } from "../../../shared/rollup.config.mjs"; - -export default createConfig({ - pkg: JSON.parse( - readFileSync(new URL("./package.json", import.meta.url), "utf8") - ), - external: [/^@tauri-apps\/api/], -}); diff --git a/plugins/store/guest-js/tsconfig.json b/plugins/store/guest-js/tsconfig.json deleted file mode 120000 index 9c2b2da2..00000000 --- a/plugins/store/guest-js/tsconfig.json +++ /dev/null @@ -1 +0,0 @@ -../../../shared/tsconfig.json \ No newline at end of file diff --git a/plugins/store/guest-js/package.json b/plugins/store/package.json similarity index 63% rename from plugins/store/guest-js/package.json rename to plugins/store/package.json index 1ec59784..cc55321f 100644 --- a/plugins/store/guest-js/package.json +++ b/plugins/store/package.json @@ -6,13 +6,13 @@ "Tauri Programme within The Commons Conservancy" ], "type": "module", - "browser": "dist/index.min.js", - "module": "dist/index.mjs", - "types": "dist/index.d.ts", + "browser": "guest-js/dist/index.min.js", + "module": "guest-js/dist/index.mjs", + "types": "guest-js/dist/index.d.ts", "exports": { - "import": "./dist/index.mjs", - "types": "./dist/index.d.ts", - "browser": "./dist/index.min.js" + "import": "./guest-js/dist/index.mjs", + "types": "./guest-js/dist/index.d.ts", + "browser": "./guest-js/dist/index.min.js" }, "scripts": { "build": "rollup -c" diff --git a/plugins/store/rollup.config.mjs b/plugins/store/rollup.config.mjs new file mode 100644 index 00000000..6555e98b --- /dev/null +++ b/plugins/store/rollup.config.mjs @@ -0,0 +1,11 @@ +import { readFileSync } from "fs"; + +import { createConfig } from "../../shared/rollup.config.mjs"; + +export default createConfig({ + input: "guest-js/index.ts", + pkg: JSON.parse( + readFileSync(new URL("./package.json", import.meta.url), "utf8") + ), + external: [/^@tauri-apps\/api/], +}); diff --git a/plugins/store/src/store.rs b/plugins/store/src/store.rs index 867bb0cd..af106e30 100644 --- a/plugins/store/src/store.rs +++ b/plugins/store/src/store.rs @@ -176,7 +176,7 @@ impl Store { .expect("failed to resolve app dir"); let store_path = app_dir.join(&self.path); - let bytes = read(&store_path)?; + let bytes = read(store_path)?; self.cache = (self.deserialize)(&bytes).map_err(Error::Deserialize)?; diff --git a/plugins/store/tsconfig.json b/plugins/store/tsconfig.json new file mode 120000 index 00000000..7cd38da8 --- /dev/null +++ b/plugins/store/tsconfig.json @@ -0,0 +1 @@ +../../shared/tsconfig.json \ No newline at end of file diff --git a/plugins/stronghold/.gitignore b/plugins/stronghold/.gitignore new file mode 100644 index 00000000..b512c09d --- /dev/null +++ b/plugins/stronghold/.gitignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/plugins/stronghold/README.md b/plugins/stronghold/README.md index 0f5158c4..3831aaa8 100644 --- a/plugins/stronghold/README.md +++ b/plugins/stronghold/README.md @@ -1,17 +1,59 @@ ![plugin-stronghold](banner.png) - +Store secrets and keys using the [IOTA Stronghold](https://github.com/iotaledger/stronghold.rs) encrypted database and secure runtime. ## Install +There are three general methods of installation that we can recommend. + +1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked) +2. Pull sources directly from Github using git tags / revision hashes (most secure) +3. Git submodule install this repo in your tauri project and then use file protocol to ingest the source (most secure, but inconvenient to use) + +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" } ``` +You can install the JavaScript Guest bindings using your preferred JavaScript package manager: + +> 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-stronghold +# or +npm add https://github.com/tauri-apps/tauri-plugin-stronghold +# or +yarn add https://github.com/tauri-apps/tauri-plugin-stronghold ``` ## Usage +First you need to register the core plugin with Tauri: + +`src-tauri/src/main.rs` +```rust +fn main() { + tauri::Builder::default() + .plugin(tauri_plugin_stronghold::Builder::new(|password| { + // TODO: hash the password here with e.g. argon2, blake2b or any other secure algorithm + todo!() + }) + .build()) + .run(tauri::generate_context!()) + .expect("error while running tauri application"); +} ``` +Afterwards all the plugin's APIs are available through the JavaScript guest bindings: + +```javascript +import { Stronghold, Location } from 'tauri-plugin-stronghold-api' + +// TODO ``` ## Contributing @@ -20,6 +62,7 @@ PRs accepted. Please make sure to read the Contributing Guide before making a pu ## License -Code: (c) 2015 - 2021 - 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. + diff --git a/plugins/stronghold/guest-js/dist/index.d.ts b/plugins/stronghold/guest-js/dist/index.d.ts deleted file mode 100644 index 4d96a57d..00000000 --- a/plugins/stronghold/guest-js/dist/index.d.ts +++ /dev/null @@ -1,99 +0,0 @@ -type BytesDto = string | number[]; -export type ClientPath = string | Iterable | ArrayLike | ArrayBuffer; -export type VaultPath = string | Iterable | ArrayLike | ArrayBuffer; -export type RecordPath = string | Iterable | ArrayLike | ArrayBuffer; -export type StoreKey = string | Iterable | ArrayLike | ArrayBuffer; -export interface ConnectionLimits { - maxPendingIncoming?: number; - maxPendingOutgoing?: number; - maxEstablishedIncoming?: number; - maxEstablishedOutgoing?: number; - maxEstablishedPerPeer?: number; - maxEstablishedTotal?: number; -} -export interface PeerAddress { - known: string[]; - use_relay_fallback: boolean; -} -export interface AddressInfo { - peers: Map; - relays: string[]; -} -export interface ClientAccess { - useVaultDefault?: boolean; - useVaultExceptions?: Map; - writeVaultDefault?: boolean; - writeVaultExceptions?: Map; - cloneVaultDefault?: boolean; - cloneVaultExceptions?: Map; - readStore?: boolean; - writeStore?: boolean; -} -export interface Permissions { - default?: ClientAccess; - exceptions?: Map; -} -export interface NetworkConfig { - requestTimeout?: Duration; - connectionTimeout?: Duration; - connectionsLimit?: ConnectionLimits; - enableMdns?: boolean; - enableRelay?: boolean; - addresses?: AddressInfo; - peerPermissions?: Map; - permissionsDefault?: Permissions; -} -export interface Duration { - secs: number; - nanos: number; -} -export declare class Location { - type: string; - payload: Record; - constructor(type: string, payload: Record); - static generic(vault: VaultPath, record: RecordPath): Location; - static counter(vault: VaultPath, counter: number): Location; -} -declare class ProcedureExecutor { - procedureArgs: Record; - constructor(procedureArgs: Record); - generateSLIP10Seed(outputLocation: Location, sizeBytes?: number): Promise; - deriveSLIP10(chain: number[], source: "Seed" | "Key", sourceLocation: Location, outputLocation: Location): Promise; - recoverBIP39(mnemonic: string, outputLocation: Location, passphrase?: string): Promise; - generateBIP39(outputLocation: Location, passphrase?: string): Promise; - getEd25519PublicKey(privateKeyLocation: Location): Promise; - signEd25519(privateKeyLocation: Location, msg: string): Promise; -} -export declare class Client { - path: string; - name: BytesDto; - constructor(path: string, name: ClientPath); - getVault(name: VaultPath): Vault; - getStore(): Store; -} -export declare class Store { - path: string; - client: BytesDto; - constructor(path: string, client: BytesDto); - get(key: StoreKey): Promise; - insert(key: StoreKey, value: number[], lifetime?: Duration): Promise; - remove(key: StoreKey): Promise; -} -export declare class Vault extends ProcedureExecutor { - path: string; - client: BytesDto; - name: BytesDto; - constructor(path: string, client: ClientPath, name: VaultPath); - insert(recordPath: RecordPath, secret: number[]): Promise; - remove(location: Location): Promise; -} -export declare class Stronghold { - path: string; - constructor(path: string, password: string); - private reload; - unload(): Promise; - loadClient(client: ClientPath): Promise; - createClient(client: ClientPath): Promise; - save(): Promise; -} -export {}; diff --git a/plugins/stronghold/guest-js/dist/index.min.js b/plugins/stronghold/guest-js/dist/index.min.js deleted file mode 100644 index 0cffa11d..00000000 --- a/plugins/stronghold/guest-js/dist/index.min.js +++ /dev/null @@ -1,217 +0,0 @@ -var d=Object.defineProperty;var e=(c,a)=>{for(var b in a)d(c,b,{get:a[b],enumerable:!0});}; - -var f={};e(f,{convertFileSrc:()=>w,invoke:()=>c,transformCallback:()=>s});function u(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function s(e,r=!1){let n=u(),t=`_${n}`;return Object.defineProperty(window,t,{value:o=>(r&&Reflect.deleteProperty(window,t),e==null?void 0:e(o)),writable:!1,configurable:!0}),n}async function c(e,r={}){return new Promise((n,t)=>{let o=s(i=>{n(i),Reflect.deleteProperty(window,`_${a}`);},!0),a=s(i=>{t(i),Reflect.deleteProperty(window,`_${o}`);},!0);window.__TAURI_IPC__({cmd:e,callback:o,error:a,...r});})}function w(e,r="asset"){let n=encodeURIComponent(e);return navigator.userAgent.includes("Windows")?`https://${r}.localhost/${n}`:`${r}://localhost/${n}`} - -function toBytesDto(v) { - if (typeof v === "string") { - return v; - } - return Array.from(v instanceof ArrayBuffer ? new Uint8Array(v) : v); -} -class Location { - constructor(type, payload) { - this.type = type; - this.payload = payload; - } - static generic(vault, record) { - return new Location("Generic", { - vault: toBytesDto(vault), - record: toBytesDto(record), - }); - } - static counter(vault, counter) { - return new Location("Counter", { - vault: toBytesDto(vault), - counter, - }); - } -} -class ProcedureExecutor { - constructor(procedureArgs) { - this.procedureArgs = procedureArgs; - } - async generateSLIP10Seed(outputLocation, sizeBytes) { - return await c("plugin:stronghold|execute_procedure", { - ...this.procedureArgs, - procedure: { - type: "SLIP10Generate", - payload: { - output: outputLocation, - sizeBytes, - }, - }, - }).then((n) => Uint8Array.from(n)); - } - async deriveSLIP10(chain, source, sourceLocation, outputLocation) { - return await c("plugin:stronghold|execute_procedure", { - ...this.procedureArgs, - procedure: { - type: "SLIP10Derive", - payload: { - chain, - input: { - type: source, - payload: sourceLocation, - }, - output: outputLocation, - }, - }, - }).then((n) => Uint8Array.from(n)); - } - async recoverBIP39(mnemonic, outputLocation, passphrase) { - return await c("plugin:stronghold|execute_procedure", { - ...this.procedureArgs, - procedure: { - type: "BIP39Recover", - payload: { - mnemonic, - passphrase, - output: outputLocation, - }, - }, - }).then((n) => Uint8Array.from(n)); - } - async generateBIP39(outputLocation, passphrase) { - return await c("plugin:stronghold|execute_procedure", { - ...this.procedureArgs, - procedure: { - type: "BIP39Generate", - payload: { - output: outputLocation, - passphrase, - }, - }, - }).then((n) => Uint8Array.from(n)); - } - async getEd25519PublicKey(privateKeyLocation) { - return await c("plugin:stronghold|execute_procedure", { - ...this.procedureArgs, - procedure: { - type: "PublicKey", - payload: { - type: "Ed25519", - privateKey: privateKeyLocation, - }, - }, - }).then((n) => Uint8Array.from(n)); - } - async signEd25519(privateKeyLocation, msg) { - return await c("plugin:stronghold|execute_procedure", { - ...this.procedureArgs, - procedure: { - type: "Ed25519Sign", - payload: { - privateKey: privateKeyLocation, - msg, - }, - }, - }).then((n) => Uint8Array.from(n)); - } -} -class Client { - constructor(path, name) { - this.path = path; - this.name = toBytesDto(name); - } - getVault(name) { - return new Vault(this.path, this.name, toBytesDto(name)); - } - getStore() { - return new Store(this.path, this.name); - } -} -class Store { - constructor(path, client) { - this.path = path; - this.client = client; - } - async get(key) { - return await c("plugin:stronghold|get_store_record", { - snapshotPath: this.path, - client: this.client, - key: toBytesDto(key), - }).then((v) => Uint8Array.from(v)); - } - async insert(key, value, lifetime) { - return await c("plugin:stronghold|save_store_record", { - snapshotPath: this.path, - client: this.client, - key: toBytesDto(key), - value, - lifetime, - }); - } - async remove(key) { - return await c("plugin:stronghold|remove_store_record", { - snapshotPath: this.path, - client: this.client, - key: toBytesDto(key), - }).then((v) => (v != null ? Uint8Array.from(v) : null)); - } -} -class Vault extends ProcedureExecutor { - constructor(path, client, name) { - super({ - snapshotPath: path, - client, - vault: name, - }); - this.path = path; - this.client = toBytesDto(client); - this.name = toBytesDto(name); - } - async insert(recordPath, secret) { - return await c("plugin:stronghold|save_secret", { - snapshotPath: this.path, - client: this.client, - vault: this.name, - recordPath: toBytesDto(recordPath), - secret, - }); - } - async remove(location) { - return await c("plugin:stronghold|remove_secret", { - snapshotPath: this.path, - client: this.client, - vault: this.name, - location, - }); - } -} -class Stronghold { - constructor(path, password) { - this.path = path; - void this.reload(password); - } - async reload(password) { - return await c("plugin:stronghold|initialize", { - snapshotPath: this.path, - password, - }); - } - async unload() { - return await c("plugin:stronghold|destroy", { - snapshotPath: this.path, - }); - } - async loadClient(client) { - return await c("plugin:stronghold|load_client", { - snapshotPath: this.path, - client: toBytesDto(client), - }).then(() => new Client(this.path, client)); - } - async createClient(client) { - return await c("plugin:stronghold|create_client", { - snapshotPath: this.path, - client: toBytesDto(client), - }).then(() => new Client(this.path, client)); - } - async save() { - return await c("plugin:stronghold|save", { - snapshotPath: this.path, - }); - } -} - -export { Client, Location, Store, Stronghold, Vault }; -//# sourceMappingURL=index.min.js.map diff --git a/plugins/stronghold/guest-js/dist/index.min.js.map b/plugins/stronghold/guest-js/dist/index.min.js.map deleted file mode 100644 index 4054f833..00000000 --- a/plugins/stronghold/guest-js/dist/index.min.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.min.js","sources":["../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-FEIY7W7S.js","../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-RCPA6UVN.js","../index.ts"],"sourcesContent":["var d=Object.defineProperty;var e=(c,a)=>{for(var b in a)d(c,b,{get:a[b],enumerable:!0})};export{e as a};\n","import{a as d}from\"./chunk-FEIY7W7S.js\";var f={};d(f,{convertFileSrc:()=>w,invoke:()=>c,transformCallback:()=>s});function u(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function s(e,r=!1){let n=u(),t=`_${n}`;return Object.defineProperty(window,t,{value:o=>(r&&Reflect.deleteProperty(window,t),e==null?void 0:e(o)),writable:!1,configurable:!0}),n}async function c(e,r={}){return new Promise((n,t)=>{let o=s(i=>{n(i),Reflect.deleteProperty(window,`_${a}`)},!0),a=s(i=>{t(i),Reflect.deleteProperty(window,`_${o}`)},!0);window.__TAURI_IPC__({cmd:e,callback:o,error:a,...r})})}function w(e,r=\"asset\"){let n=encodeURIComponent(e);return navigator.userAgent.includes(\"Windows\")?`https://${r}.localhost/${n}`:`${r}://localhost/${n}`}export{s as a,c as b,w as c,f as d};\n",null],"names":["d","invoke"],"mappings":"AAAA,IAAI,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAC,CAAC;;ACAjD,IAAI,CAAC,CAAC,EAAE,CAACA,CAAC,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,iBAAiB,CAAC,IAAI,CA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AAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;KAC9C;AAED,IAAA,MAAM,IAAI,GAAA;AACR,QAAA,OAAO,MAAMA,CAAM,CAAC,wBAAwB,EAAE;YAC5C,YAAY,EAAE,IAAI,CAAC,IAAI;AACxB,SAAA,CAAC,CAAC;KACJ;AACF;;;;"} \ No newline at end of file diff --git a/plugins/stronghold/guest-js/dist/index.mjs b/plugins/stronghold/guest-js/dist/index.mjs deleted file mode 100644 index fd30c04a..00000000 --- a/plugins/stronghold/guest-js/dist/index.mjs +++ /dev/null @@ -1,215 +0,0 @@ -import { invoke } from '@tauri-apps/api/tauri'; - -function toBytesDto(v) { - if (typeof v === "string") { - return v; - } - return Array.from(v instanceof ArrayBuffer ? new Uint8Array(v) : v); -} -class Location { - constructor(type, payload) { - this.type = type; - this.payload = payload; - } - static generic(vault, record) { - return new Location("Generic", { - vault: toBytesDto(vault), - record: toBytesDto(record), - }); - } - static counter(vault, counter) { - return new Location("Counter", { - vault: toBytesDto(vault), - counter, - }); - } -} -class ProcedureExecutor { - constructor(procedureArgs) { - this.procedureArgs = procedureArgs; - } - async generateSLIP10Seed(outputLocation, sizeBytes) { - return await invoke("plugin:stronghold|execute_procedure", { - ...this.procedureArgs, - procedure: { - type: "SLIP10Generate", - payload: { - output: outputLocation, - sizeBytes, - }, - }, - }).then((n) => Uint8Array.from(n)); - } - async deriveSLIP10(chain, source, sourceLocation, outputLocation) { - return await invoke("plugin:stronghold|execute_procedure", { - ...this.procedureArgs, - procedure: { - type: "SLIP10Derive", - payload: { - chain, - input: { - type: source, - payload: sourceLocation, - }, - output: outputLocation, - }, - }, - }).then((n) => Uint8Array.from(n)); - } - async recoverBIP39(mnemonic, outputLocation, passphrase) { - return await invoke("plugin:stronghold|execute_procedure", { - ...this.procedureArgs, - procedure: { - type: "BIP39Recover", - payload: { - mnemonic, - passphrase, - output: outputLocation, - }, - }, - }).then((n) => Uint8Array.from(n)); - } - async generateBIP39(outputLocation, passphrase) { - return await invoke("plugin:stronghold|execute_procedure", { - ...this.procedureArgs, - procedure: { - type: "BIP39Generate", - payload: { - output: outputLocation, - passphrase, - }, - }, - }).then((n) => Uint8Array.from(n)); - } - async getEd25519PublicKey(privateKeyLocation) { - return await invoke("plugin:stronghold|execute_procedure", { - ...this.procedureArgs, - procedure: { - type: "PublicKey", - payload: { - type: "Ed25519", - privateKey: privateKeyLocation, - }, - }, - }).then((n) => Uint8Array.from(n)); - } - async signEd25519(privateKeyLocation, msg) { - return await invoke("plugin:stronghold|execute_procedure", { - ...this.procedureArgs, - procedure: { - type: "Ed25519Sign", - payload: { - privateKey: privateKeyLocation, - msg, - }, - }, - }).then((n) => Uint8Array.from(n)); - } -} -class Client { - constructor(path, name) { - this.path = path; - this.name = toBytesDto(name); - } - getVault(name) { - return new Vault(this.path, this.name, toBytesDto(name)); - } - getStore() { - return new Store(this.path, this.name); - } -} -class Store { - constructor(path, client) { - this.path = path; - this.client = client; - } - async get(key) { - return await invoke("plugin:stronghold|get_store_record", { - snapshotPath: this.path, - client: this.client, - key: toBytesDto(key), - }).then((v) => Uint8Array.from(v)); - } - async insert(key, value, lifetime) { - return await invoke("plugin:stronghold|save_store_record", { - snapshotPath: this.path, - client: this.client, - key: toBytesDto(key), - value, - lifetime, - }); - } - async remove(key) { - return await invoke("plugin:stronghold|remove_store_record", { - snapshotPath: this.path, - client: this.client, - key: toBytesDto(key), - }).then((v) => (v != null ? Uint8Array.from(v) : null)); - } -} -class Vault extends ProcedureExecutor { - constructor(path, client, name) { - super({ - snapshotPath: path, - client, - vault: name, - }); - this.path = path; - this.client = toBytesDto(client); - this.name = toBytesDto(name); - } - async insert(recordPath, secret) { - return await invoke("plugin:stronghold|save_secret", { - snapshotPath: this.path, - client: this.client, - vault: this.name, - recordPath: toBytesDto(recordPath), - secret, - }); - } - async remove(location) { - return await invoke("plugin:stronghold|remove_secret", { - snapshotPath: this.path, - client: this.client, - vault: this.name, - location, - }); - } -} -class Stronghold { - constructor(path, password) { - this.path = path; - void this.reload(password); - } - async reload(password) { - return await invoke("plugin:stronghold|initialize", { - snapshotPath: this.path, - password, - }); - } - async unload() { - return await invoke("plugin:stronghold|destroy", { - snapshotPath: this.path, - }); - } - async loadClient(client) { - return await invoke("plugin:stronghold|load_client", { - snapshotPath: this.path, - client: toBytesDto(client), - }).then(() => new Client(this.path, client)); - } - async createClient(client) { - return await invoke("plugin:stronghold|create_client", { - snapshotPath: this.path, - client: toBytesDto(client), - }).then(() => new Client(this.path, client)); - } - async save() { - return await invoke("plugin:stronghold|save", { - snapshotPath: this.path, - }); - } -} - -export { Client, Location, Store, Stronghold, Vault }; -//# sourceMappingURL=index.mjs.map diff --git a/plugins/stronghold/guest-js/dist/index.mjs.map b/plugins/stronghold/guest-js/dist/index.mjs.map deleted file mode 100644 index e4650fa7..00000000 --- a/plugins/stronghold/guest-js/dist/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAwBA,SAAS,UAAU,CACjB,CAAiD,EAAA;AAEjD,IAAA,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE;AACzB,QAAA,OAAO,CAAC,CAAC;AACV,KAAA;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,YAAY,WAAW,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AACtE,CAAC;MAqDY,QAAQ,CAAA;IAInB,WAAY,CAAA,IAAY,EAAE,OAAgC,EAAA;AACxD,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;AACjB,QAAA,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;KACxB;AAED,IAAA,OAAO,OAAO,CAAC,KAAgB,EAAE,MAAkB,EAAA;AACjD,QAAA,OAAO,IAAI,QAAQ,CAAC,SAAS,EAAE;AAC7B,YAAA,KAAK,EAAE,UAAU,CAAC,KAAK,CAAC;AACxB,YAAA,MAAM,EAAE,UA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,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;KAC9C;IAED,MAAM,YAAY,CAAC,MAAkB,EAAA;AACnC,QAAA,OAAO,MAAM,MAAM,CAAC,iCAAiC,EAAE;YACrD,YAAY,EAAE,IAAI,CAAC,IAAI;AACvB,YAAA,MAAM,EAAE,UAAU,CAAC,MAAM,CAAC;AAC3B,SAAA,CAAC,CAAC,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;KAC9C;AAED,IAAA,MAAM,IAAI,GAAA;AACR,QAAA,OAAO,MAAM,MAAM,CAAC,wBAAwB,EAAE;YAC5C,YAAY,EAAE,IAAI,CAAC,IAAI;AACxB,SAAA,CAAC,CAAC;KACJ;AACF;;;;"} \ No newline at end of file diff --git a/plugins/stronghold/guest-js/rollup.config.mjs b/plugins/stronghold/guest-js/rollup.config.mjs deleted file mode 100644 index ee885522..00000000 --- a/plugins/stronghold/guest-js/rollup.config.mjs +++ /dev/null @@ -1,10 +0,0 @@ -import { readFileSync } from "fs"; - -import { createConfig } from "../../../shared/rollup.config.mjs"; - -export default createConfig({ - pkg: JSON.parse( - readFileSync(new URL("./package.json", import.meta.url), "utf8") - ), - external: [/^@tauri-apps\/api/], -}); diff --git a/plugins/stronghold/guest-js/tsconfig.json b/plugins/stronghold/guest-js/tsconfig.json deleted file mode 120000 index 9c2b2da2..00000000 --- a/plugins/stronghold/guest-js/tsconfig.json +++ /dev/null @@ -1 +0,0 @@ -../../../shared/tsconfig.json \ No newline at end of file diff --git a/plugins/stronghold/guest-js/package.json b/plugins/stronghold/package.json similarity index 63% rename from plugins/stronghold/guest-js/package.json rename to plugins/stronghold/package.json index 10ed1ba4..b929c2c2 100644 --- a/plugins/stronghold/guest-js/package.json +++ b/plugins/stronghold/package.json @@ -6,13 +6,13 @@ "Tauri Programme within The Commons Conservancy" ], "type": "module", - "browser": "dist/index.min.js", - "module": "dist/index.mjs", - "types": "dist/index.d.ts", + "browser": "guest-js/dist/index.min.js", + "module": "guest-js/dist/index.mjs", + "types": "guest-js/dist/index.d.ts", "exports": { - "import": "./dist/index.mjs", - "types": "./dist/index.d.ts", - "browser": "./dist/index.min.js" + "import": "./guest-js/dist/index.mjs", + "types": "./guest-js/dist/index.d.ts", + "browser": "./guest-js/dist/index.min.js" }, "scripts": { "build": "rollup -c" diff --git a/plugins/stronghold/rollup.config.mjs b/plugins/stronghold/rollup.config.mjs new file mode 100644 index 00000000..6555e98b --- /dev/null +++ b/plugins/stronghold/rollup.config.mjs @@ -0,0 +1,11 @@ +import { readFileSync } from "fs"; + +import { createConfig } from "../../shared/rollup.config.mjs"; + +export default createConfig({ + input: "guest-js/index.ts", + pkg: JSON.parse( + readFileSync(new URL("./package.json", import.meta.url), "utf8") + ), + external: [/^@tauri-apps\/api/], +}); diff --git a/plugins/stronghold/tsconfig.json b/plugins/stronghold/tsconfig.json new file mode 120000 index 00000000..7cd38da8 --- /dev/null +++ b/plugins/stronghold/tsconfig.json @@ -0,0 +1 @@ +../../shared/tsconfig.json \ No newline at end of file diff --git a/plugins/upload/.gitignore b/plugins/upload/.gitignore new file mode 100644 index 00000000..b512c09d --- /dev/null +++ b/plugins/upload/.gitignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/plugins/upload/README.md b/plugins/upload/README.md index 04bb3400..12bddc7c 100644 --- a/plugins/upload/README.md +++ b/plugins/upload/README.md @@ -1,17 +1,60 @@ ![plugin-upload](banner.png) - +Upload files from disk to a remote server over http. ## Install +There are three general methods of installation that we can recommend. + +1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked) +2. Pull sources directly from Github using git tags / revision hashes (most secure) +3. Git submodule install this repo in your tauri project and then use file protocol to ingest the source (most secure, but inconvenient to use) + +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" } ``` +You can install the JavaScript Guest bindings using your preferred JavaScript package manager: + +> 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-upload +# or +npm add https://github.com/tauri-apps/tauri-plugin-upload +# or +yarn add https://github.com/tauri-apps/tauri-plugin-upload ``` ## Usage +First you need to register the core plugin with Tauri: + +`src-tauri/src/main.rs` +```rust +fn main() { + tauri::Builder::default() + .plugin(tauri_plugin_upload::init()) + .run(tauri::generate_context!()) + .expect("error while running tauri application"); +} ``` +Afterwards all the plugin's APIs are available through the JavaScript guest bindings: + +```javascript +import { upload } from 'tauri-plugin-upload-api' + +upload( + 'https://example.com/file-upload' + './path/to/my/file.txt' + (progress, total) => console.log(`Downloaded ${progress} of ${total} bytes`) // a callback that will be called with the upload progress + { 'ContentType': 'text/plain' } // optional headers to send with the request +) ``` ## Contributing @@ -20,6 +63,6 @@ PRs accepted. Please make sure to read the Contributing Guide before making a pu ## License -Code: (c) 2015 - 2021 - 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. diff --git a/plugins/upload/guest-js/dist/index.d.ts b/plugins/upload/guest-js/dist/index.d.ts deleted file mode 100644 index a2da48ea..00000000 --- a/plugins/upload/guest-js/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -type ProgressHandler = (progress: number, total: number) => void; -export default function upload(url: string, filePath: string, progressHandler?: ProgressHandler, headers?: Map): Promise; -export {}; diff --git a/plugins/upload/guest-js/dist/index.min.js b/plugins/upload/guest-js/dist/index.min.js deleted file mode 100644 index 22b7a98f..00000000 --- a/plugins/upload/guest-js/dist/index.min.js +++ /dev/null @@ -1,46 +0,0 @@ -var d=Object.defineProperty;var e=(c,a)=>{for(var b in a)d(c,b,{get:a[b],enumerable:!0});}; - -var f$1={};e(f$1,{convertFileSrc:()=>w,invoke:()=>c$2,transformCallback:()=>s$2});function u$2(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function s$2(e,r=!1){let n=u$2(),t=`_${n}`;return Object.defineProperty(window,t,{value:o=>(r&&Reflect.deleteProperty(window,t),e==null?void 0:e(o)),writable:!1,configurable:!0}),n}async function c$2(e,r={}){return new Promise((n,t)=>{let o=s$2(i=>{n(i),Reflect.deleteProperty(window,`_${a}`);},!0),a=s$2(i=>{t(i),Reflect.deleteProperty(window,`_${o}`);},!0);window.__TAURI_IPC__({cmd:e,callback:o,error:a,...r});})}function w(e,r="asset"){let n=encodeURIComponent(e);return navigator.userAgent.includes("Windows")?`https://${r}.localhost/${n}`:`${r}://localhost/${n}`} - -async function a(i){return c$2("tauri",i)} - -var W$1={};e(W$1,{TauriEvent:()=>c$1,emit:()=>D,listen:()=>E$1,once:()=>_});async function s$1(n,t){return a({__tauriModule:"Event",message:{cmd:"unlisten",event:n,eventId:t}})}async function m$1(n,t,i){await a({__tauriModule:"Event",message:{cmd:"emit",event:n,windowLabel:t,payload:i}});}async function o$1(n,t,i){return a({__tauriModule:"Event",message:{cmd:"listen",event:n,windowLabel:t,handler:s$2(i)}}).then(r=>async()=>s$1(n,r))}async function u$1(n,t,i){return o$1(n,t,r=>{i(r),s$1(n,r.id).catch(()=>{});})}var c$1=(e=>(e.WINDOW_RESIZED="tauri://resize",e.WINDOW_MOVED="tauri://move",e.WINDOW_CLOSE_REQUESTED="tauri://close-requested",e.WINDOW_CREATED="tauri://window-created",e.WINDOW_DESTROYED="tauri://destroyed",e.WINDOW_FOCUS="tauri://focus",e.WINDOW_BLUR="tauri://blur",e.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",e.WINDOW_THEME_CHANGED="tauri://theme-changed",e.WINDOW_FILE_DROP="tauri://file-drop",e.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover",e.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled",e.MENU="tauri://menu",e.CHECK_UPDATE="tauri://update",e.UPDATE_AVAILABLE="tauri://update-available",e.INSTALL_UPDATE="tauri://update-install",e.STATUS_UPDATE="tauri://update-status",e.DOWNLOAD_PROGRESS="tauri://update-download-progress",e))(c$1||{});async function E$1(n,t){return o$1(n,null,t)}async function _(n,t){return u$1(n,null,t)}async function D(n,t){return m$1(n,void 0,t)} - -var C={};e(C,{CloseRequestedEvent:()=>y,LogicalPosition:()=>c,LogicalSize:()=>m,PhysicalPosition:()=>o,PhysicalSize:()=>l,UserAttentionType:()=>W,WebviewWindow:()=>s,WebviewWindowHandle:()=>u,WindowManager:()=>h,appWindow:()=>b,availableMonitors:()=>T,currentMonitor:()=>E,getAll:()=>M,getCurrent:()=>f,primaryMonitor:()=>z});var m=class{constructor(e,a){this.type="Logical";this.width=e,this.height=a;}},l=class{constructor(e,a){this.type="Physical";this.width=e,this.height=a;}toLogical(e){return new m(this.width/e,this.height/e)}},c=class{constructor(e,a){this.type="Logical";this.x=e,this.y=a;}},o=class{constructor(e,a){this.type="Physical";this.x=e,this.y=a;}toLogical(e){return new c(this.x/e,this.y/e)}},W=(a=>(a[a.Critical=1]="Critical",a[a.Informational=2]="Informational",a))(W||{});function f(){return new s(window.__TAURI_METADATA__.__currentWindow.label,{skip:!0})}function M(){return window.__TAURI_METADATA__.__windows.map(i=>new s(i.label,{skip:!0}))}var P=["tauri://created","tauri://error"],u=class{constructor(e){this.label=e,this.listeners=Object.create(null);}async listen(e,a){return this._handleTauriEvent(e,a)?Promise.resolve(()=>{let n=this.listeners[e];n.splice(n.indexOf(a),1);}):o$1(e,this.label,a)}async once(e,a){return this._handleTauriEvent(e,a)?Promise.resolve(()=>{let n=this.listeners[e];n.splice(n.indexOf(a),1);}):u$1(e,this.label,a)}async emit(e,a){if(P.includes(e)){for(let n of this.listeners[e]||[])n({event:e,id:-1,windowLabel:this.label,payload:a});return Promise.resolve()}return m$1(e,this.label,a)}_handleTauriEvent(e,a){return P.includes(e)?(e in this.listeners?this.listeners[e].push(a):this.listeners[e]=[a],!0):!1}},h=class extends u{async scaleFactor(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"scaleFactor"}}}})}async innerPosition(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"innerPosition"}}}}).then(({x:e,y:a})=>new o(e,a))}async outerPosition(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"outerPosition"}}}}).then(({x:e,y:a})=>new o(e,a))}async innerSize(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"innerSize"}}}}).then(({width:e,height:a})=>new l(e,a))}async outerSize(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"outerSize"}}}}).then(({width:e,height:a})=>new l(e,a))}async isFullscreen(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"isFullscreen"}}}})}async isMaximized(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"isMaximized"}}}})}async isDecorated(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"isDecorated"}}}})}async isResizable(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"isResizable"}}}})}async isVisible(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"isVisible"}}}})}async theme(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"theme"}}}})}async center(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"center"}}}})}async requestUserAttention(e){let a$1=null;return e&&(e===1?a$1={type:"Critical"}:a$1={type:"Informational"}),a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"requestUserAttention",payload:a$1}}}})}async setResizable(e){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setResizable",payload:e}}}})}async setTitle(e){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setTitle",payload:e}}}})}async maximize(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"maximize"}}}})}async unmaximize(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"unmaximize"}}}})}async toggleMaximize(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"toggleMaximize"}}}})}async minimize(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"minimize"}}}})}async unminimize(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"unminimize"}}}})}async show(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"show"}}}})}async hide(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"hide"}}}})}async close(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"close"}}}})}async setDecorations(e){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setDecorations",payload:e}}}})}async setAlwaysOnTop(e){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setAlwaysOnTop",payload:e}}}})}async setSize(e){if(!e||e.type!=="Logical"&&e.type!=="Physical")throw new Error("the `size` argument must be either a LogicalSize or a PhysicalSize instance");return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setSize",payload:{type:e.type,data:{width:e.width,height:e.height}}}}}})}async setMinSize(e){if(e&&e.type!=="Logical"&&e.type!=="Physical")throw new Error("the `size` argument must be either a LogicalSize or a PhysicalSize instance");return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setMinSize",payload:e?{type:e.type,data:{width:e.width,height:e.height}}:null}}}})}async setMaxSize(e){if(e&&e.type!=="Logical"&&e.type!=="Physical")throw new Error("the `size` argument must be either a LogicalSize or a PhysicalSize instance");return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setMaxSize",payload:e?{type:e.type,data:{width:e.width,height:e.height}}:null}}}})}async setPosition(e){if(!e||e.type!=="Logical"&&e.type!=="Physical")throw new Error("the `position` argument must be either a LogicalPosition or a PhysicalPosition instance");return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setPosition",payload:{type:e.type,data:{x:e.x,y:e.y}}}}}})}async setFullscreen(e){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setFullscreen",payload:e}}}})}async setFocus(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setFocus"}}}})}async setIcon(e){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setIcon",payload:{icon:typeof e=="string"?e:Array.from(e)}}}}})}async setSkipTaskbar(e){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setSkipTaskbar",payload:e}}}})}async setCursorGrab(e){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setCursorGrab",payload:e}}}})}async setCursorVisible(e){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setCursorVisible",payload:e}}}})}async setCursorIcon(e){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setCursorIcon",payload:e}}}})}async setCursorPosition(e){if(!e||e.type!=="Logical"&&e.type!=="Physical")throw new Error("the `position` argument must be either a LogicalPosition or a PhysicalPosition instance");return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setCursorPosition",payload:{type:e.type,data:{x:e.x,y:e.y}}}}}})}async setIgnoreCursorEvents(e){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"setIgnoreCursorEvents",payload:e}}}})}async startDragging(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{label:this.label,cmd:{type:"startDragging"}}}})}async onResized(e){return this.listen("tauri://resize",e)}async onMoved(e){return this.listen("tauri://move",e)}async onCloseRequested(e){return this.listen("tauri://close-requested",a=>{let n=new y(a);Promise.resolve(e(n)).then(()=>{if(!n.isPreventDefault())return this.close()});})}async onFocusChanged(e){let a=await this.listen("tauri://focus",d=>{e({...d,payload:!0});}),n=await this.listen("tauri://blur",d=>{e({...d,payload:!1});});return ()=>{a(),n();}}async onScaleChanged(e){return this.listen("tauri://scale-change",e)}async onMenuClicked(e){return this.listen("tauri://menu",e)}async onFileDropEvent(e){let a=await this.listen("tauri://file-drop",r=>{e({...r,payload:{type:"drop",paths:r.payload}});}),n=await this.listen("tauri://file-drop-hover",r=>{e({...r,payload:{type:"hover",paths:r.payload}});}),d=await this.listen("tauri://file-drop-cancelled",r=>{e({...r,payload:{type:"cancel"}});});return ()=>{a(),n(),d();}}async onThemeChanged(e){return this.listen("tauri://theme-changed",e)}},y=class{constructor(e){this._preventDefault=!1;this.event=e.event,this.windowLabel=e.windowLabel,this.id=e.id;}preventDefault(){this._preventDefault=!0;}isPreventDefault(){return this._preventDefault}},s=class extends h{constructor(e,a$1={}){super(e),a$1!=null&&a$1.skip||a({__tauriModule:"Window",message:{cmd:"createWebview",data:{options:{label:e,...a$1}}}}).then(async()=>this.emit("tauri://created")).catch(async n=>this.emit("tauri://error",n));}static getByLabel(e){return M().some(a=>a.label===e)?new s(e,{skip:!0}):null}},b;"__TAURI_METADATA__"in window?b=new s(window.__TAURI_METADATA__.__currentWindow.label,{skip:!0}):(console.warn(`Could not find "window.__TAURI_METADATA__". The "appWindow" value will reference the "main" window label. -Note that this is not an issue if running this frontend on a browser instead of a Tauri window.`),b=new s("main",{skip:!0}));function g(i){return i===null?null:{name:i.name,scaleFactor:i.scaleFactor,position:new o(i.position.x,i.position.y),size:new l(i.size.width,i.size.height)}}async function E(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{cmd:{type:"currentMonitor"}}}}).then(g)}async function z(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{cmd:{type:"primaryMonitor"}}}}).then(g)}async function T(){return a({__tauriModule:"Window",message:{cmd:"manage",data:{cmd:{type:"availableMonitors"}}}}).then(i=>i.map(g))} - -const handlers = new Map(); -let listening = false; -async function listenToUploadEventIfNeeded() { - if (listening) { - return await Promise.resolve(); - } - return await b - .listen("upload://progress", ({ payload }) => { - const handler = handlers.get(payload.id); - if (handler != null) { - handler(payload.progress, payload.total); - } - }) - .then(() => { - listening = true; - }); -} -async function upload(url, filePath, progressHandler, headers) { - const ids = new Uint32Array(1); - window.crypto.getRandomValues(ids); - const id = ids[0]; - if (progressHandler != null) { - handlers.set(id, progressHandler); - } - await listenToUploadEventIfNeeded(); - await c$2("plugin:upload|upload", { - id, - url, - filePath, - headers: headers !== null && headers !== void 0 ? headers : {}, - }); -} - -export { upload as default }; -//# sourceMappingURL=index.min.js.map diff --git a/plugins/upload/guest-js/dist/index.min.js.map b/plugins/upload/guest-js/dist/index.min.js.map deleted file mode 100644 index 039a83fd..00000000 --- a/plugins/upload/guest-js/dist/index.min.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.min.js","sources":["../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-FEIY7W7S.js","../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-RCPA6UVN.js","../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-HNLFKTAJ.js","../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-3WDDWFXT.js","../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-QSWLDHGO.js","../index.ts"],"sourcesContent":["var d=Object.defineProperty;var e=(c,a)=>{for(var b in a)d(c,b,{get:a[b],enumerable:!0})};export{e as a};\n","import{a as d}from\"./chunk-FEIY7W7S.js\";var f={};d(f,{convertFileSrc:()=>w,invoke:()=>c,transformCallback:()=>s});function u(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function s(e,r=!1){let n=u(),t=`_${n}`;return Object.defineProperty(window,t,{value:o=>(r&&Reflect.deleteProperty(window,t),e==null?void 0:e(o)),writable:!1,configurable:!0}),n}async function c(e,r={}){return new Promise((n,t)=>{let o=s(i=>{n(i),Reflect.deleteProperty(window,`_${a}`)},!0),a=s(i=>{t(i),Reflect.deleteProperty(window,`_${o}`)},!0);window.__TAURI_IPC__({cmd:e,callback:o,error:a,...r})})}function w(e,r=\"asset\"){let n=encodeURIComponent(e);return navigator.userAgent.includes(\"Windows\")?`https://${r}.localhost/${n}`:`${r}://localhost/${n}`}export{s as a,c as b,w as c,f as d};\n","import{b as o}from\"./chunk-RCPA6UVN.js\";async function a(i){return o(\"tauri\",i)}export{a};\n","import{a}from\"./chunk-HNLFKTAJ.js\";import{a as l}from\"./chunk-RCPA6UVN.js\";import{a as d}from\"./chunk-FEIY7W7S.js\";var W={};d(W,{TauriEvent:()=>c,emit:()=>D,listen:()=>E,once:()=>_});async function s(n,t){return a({__tauriModule:\"Event\",message:{cmd:\"unlisten\",event:n,eventId:t}})}async function m(n,t,i){await a({__tauriModule:\"Event\",message:{cmd:\"emit\",event:n,windowLabel:t,payload:i}})}async function o(n,t,i){return a({__tauriModule:\"Event\",message:{cmd:\"listen\",event:n,windowLabel:t,handler:l(i)}}).then(r=>async()=>s(n,r))}async function u(n,t,i){return o(n,t,r=>{i(r),s(n,r.id).catch(()=>{})})}var c=(e=>(e.WINDOW_RESIZED=\"tauri://resize\",e.WINDOW_MOVED=\"tauri://move\",e.WINDOW_CLOSE_REQUESTED=\"tauri://close-requested\",e.WINDOW_CREATED=\"tauri://window-created\",e.WINDOW_DESTROYED=\"tauri://destroyed\",e.WINDOW_FOCUS=\"tauri://focus\",e.WINDOW_BLUR=\"tauri://blur\",e.WINDOW_SCALE_FACTOR_CHANGED=\"tauri://scale-change\",e.WINDOW_THEME_CHANGED=\"tauri://theme-changed\",e.WINDOW_FILE_DROP=\"tauri://file-drop\",e.WINDOW_FILE_DROP_HOVER=\"tauri://file-drop-hover\",e.WINDOW_FILE_DROP_CANCELLED=\"tauri://file-drop-cancelled\",e.MENU=\"tauri://menu\",e.CHECK_UPDATE=\"tauri://update\",e.UPDATE_AVAILABLE=\"tauri://update-available\",e.INSTALL_UPDATE=\"tauri://update-install\",e.STATUS_UPDATE=\"tauri://update-status\",e.DOWNLOAD_PROGRESS=\"tauri://update-download-progress\",e))(c||{});async function E(n,t){return o(n,null,t)}async function _(n,t){return u(n,null,t)}async function D(n,t){return m(n,void 0,t)}export{m as a,o as b,u as c,c as d,E as e,_ as f,D as g,W as h};\n","import{a as p,b as _,c as w}from\"./chunk-3WDDWFXT.js\";import{a as t}from\"./chunk-HNLFKTAJ.js\";import{a as v}from\"./chunk-FEIY7W7S.js\";var C={};v(C,{CloseRequestedEvent:()=>y,LogicalPosition:()=>c,LogicalSize:()=>m,PhysicalPosition:()=>o,PhysicalSize:()=>l,UserAttentionType:()=>W,WebviewWindow:()=>s,WebviewWindowHandle:()=>u,WindowManager:()=>h,appWindow:()=>b,availableMonitors:()=>T,currentMonitor:()=>E,getAll:()=>M,getCurrent:()=>f,primaryMonitor:()=>z});var m=class{constructor(e,a){this.type=\"Logical\";this.width=e,this.height=a}},l=class{constructor(e,a){this.type=\"Physical\";this.width=e,this.height=a}toLogical(e){return new m(this.width/e,this.height/e)}},c=class{constructor(e,a){this.type=\"Logical\";this.x=e,this.y=a}},o=class{constructor(e,a){this.type=\"Physical\";this.x=e,this.y=a}toLogical(e){return new c(this.x/e,this.y/e)}},W=(a=>(a[a.Critical=1]=\"Critical\",a[a.Informational=2]=\"Informational\",a))(W||{});function f(){return new s(window.__TAURI_METADATA__.__currentWindow.label,{skip:!0})}function M(){return window.__TAURI_METADATA__.__windows.map(i=>new s(i.label,{skip:!0}))}var P=[\"tauri://created\",\"tauri://error\"],u=class{constructor(e){this.label=e,this.listeners=Object.create(null)}async listen(e,a){return this._handleTauriEvent(e,a)?Promise.resolve(()=>{let n=this.listeners[e];n.splice(n.indexOf(a),1)}):_(e,this.label,a)}async once(e,a){return this._handleTauriEvent(e,a)?Promise.resolve(()=>{let n=this.listeners[e];n.splice(n.indexOf(a),1)}):w(e,this.label,a)}async emit(e,a){if(P.includes(e)){for(let n of this.listeners[e]||[])n({event:e,id:-1,windowLabel:this.label,payload:a});return Promise.resolve()}return p(e,this.label,a)}_handleTauriEvent(e,a){return P.includes(e)?(e in this.listeners?this.listeners[e].push(a):this.listeners[e]=[a],!0):!1}},h=class extends u{async scaleFactor(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"scaleFactor\"}}}})}async innerPosition(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"innerPosition\"}}}}).then(({x:e,y:a})=>new o(e,a))}async outerPosition(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"outerPosition\"}}}}).then(({x:e,y:a})=>new o(e,a))}async innerSize(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"innerSize\"}}}}).then(({width:e,height:a})=>new l(e,a))}async outerSize(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"outerSize\"}}}}).then(({width:e,height:a})=>new l(e,a))}async isFullscreen(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"isFullscreen\"}}}})}async isMaximized(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"isMaximized\"}}}})}async isDecorated(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"isDecorated\"}}}})}async isResizable(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"isResizable\"}}}})}async isVisible(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"isVisible\"}}}})}async theme(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"theme\"}}}})}async center(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"center\"}}}})}async requestUserAttention(e){let a=null;return e&&(e===1?a={type:\"Critical\"}:a={type:\"Informational\"}),t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"requestUserAttention\",payload:a}}}})}async setResizable(e){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setResizable\",payload:e}}}})}async setTitle(e){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setTitle\",payload:e}}}})}async maximize(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"maximize\"}}}})}async unmaximize(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"unmaximize\"}}}})}async toggleMaximize(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"toggleMaximize\"}}}})}async minimize(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"minimize\"}}}})}async unminimize(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"unminimize\"}}}})}async show(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"show\"}}}})}async hide(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"hide\"}}}})}async close(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"close\"}}}})}async setDecorations(e){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setDecorations\",payload:e}}}})}async setAlwaysOnTop(e){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setAlwaysOnTop\",payload:e}}}})}async setSize(e){if(!e||e.type!==\"Logical\"&&e.type!==\"Physical\")throw new Error(\"the `size` argument must be either a LogicalSize or a PhysicalSize instance\");return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setSize\",payload:{type:e.type,data:{width:e.width,height:e.height}}}}}})}async setMinSize(e){if(e&&e.type!==\"Logical\"&&e.type!==\"Physical\")throw new Error(\"the `size` argument must be either a LogicalSize or a PhysicalSize instance\");return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setMinSize\",payload:e?{type:e.type,data:{width:e.width,height:e.height}}:null}}}})}async setMaxSize(e){if(e&&e.type!==\"Logical\"&&e.type!==\"Physical\")throw new Error(\"the `size` argument must be either a LogicalSize or a PhysicalSize instance\");return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setMaxSize\",payload:e?{type:e.type,data:{width:e.width,height:e.height}}:null}}}})}async setPosition(e){if(!e||e.type!==\"Logical\"&&e.type!==\"Physical\")throw new Error(\"the `position` argument must be either a LogicalPosition or a PhysicalPosition instance\");return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setPosition\",payload:{type:e.type,data:{x:e.x,y:e.y}}}}}})}async setFullscreen(e){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setFullscreen\",payload:e}}}})}async setFocus(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setFocus\"}}}})}async setIcon(e){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setIcon\",payload:{icon:typeof e==\"string\"?e:Array.from(e)}}}}})}async setSkipTaskbar(e){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setSkipTaskbar\",payload:e}}}})}async setCursorGrab(e){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setCursorGrab\",payload:e}}}})}async setCursorVisible(e){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setCursorVisible\",payload:e}}}})}async setCursorIcon(e){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setCursorIcon\",payload:e}}}})}async setCursorPosition(e){if(!e||e.type!==\"Logical\"&&e.type!==\"Physical\")throw new Error(\"the `position` argument must be either a LogicalPosition or a PhysicalPosition instance\");return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setCursorPosition\",payload:{type:e.type,data:{x:e.x,y:e.y}}}}}})}async setIgnoreCursorEvents(e){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"setIgnoreCursorEvents\",payload:e}}}})}async startDragging(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{label:this.label,cmd:{type:\"startDragging\"}}}})}async onResized(e){return this.listen(\"tauri://resize\",e)}async onMoved(e){return this.listen(\"tauri://move\",e)}async onCloseRequested(e){return this.listen(\"tauri://close-requested\",a=>{let n=new y(a);Promise.resolve(e(n)).then(()=>{if(!n.isPreventDefault())return this.close()})})}async onFocusChanged(e){let a=await this.listen(\"tauri://focus\",d=>{e({...d,payload:!0})}),n=await this.listen(\"tauri://blur\",d=>{e({...d,payload:!1})});return()=>{a(),n()}}async onScaleChanged(e){return this.listen(\"tauri://scale-change\",e)}async onMenuClicked(e){return this.listen(\"tauri://menu\",e)}async onFileDropEvent(e){let a=await this.listen(\"tauri://file-drop\",r=>{e({...r,payload:{type:\"drop\",paths:r.payload}})}),n=await this.listen(\"tauri://file-drop-hover\",r=>{e({...r,payload:{type:\"hover\",paths:r.payload}})}),d=await this.listen(\"tauri://file-drop-cancelled\",r=>{e({...r,payload:{type:\"cancel\"}})});return()=>{a(),n(),d()}}async onThemeChanged(e){return this.listen(\"tauri://theme-changed\",e)}},y=class{constructor(e){this._preventDefault=!1;this.event=e.event,this.windowLabel=e.windowLabel,this.id=e.id}preventDefault(){this._preventDefault=!0}isPreventDefault(){return this._preventDefault}},s=class extends h{constructor(e,a={}){super(e),a!=null&&a.skip||t({__tauriModule:\"Window\",message:{cmd:\"createWebview\",data:{options:{label:e,...a}}}}).then(async()=>this.emit(\"tauri://created\")).catch(async n=>this.emit(\"tauri://error\",n))}static getByLabel(e){return M().some(a=>a.label===e)?new s(e,{skip:!0}):null}},b;\"__TAURI_METADATA__\"in window?b=new s(window.__TAURI_METADATA__.__currentWindow.label,{skip:!0}):(console.warn(`Could not find \"window.__TAURI_METADATA__\". The \"appWindow\" value will reference the \"main\" window label.\nNote that this is not an issue if running this frontend on a browser instead of a Tauri window.`),b=new s(\"main\",{skip:!0}));function g(i){return i===null?null:{name:i.name,scaleFactor:i.scaleFactor,position:new o(i.position.x,i.position.y),size:new l(i.size.width,i.size.height)}}async function E(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{cmd:{type:\"currentMonitor\"}}}}).then(g)}async function z(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{cmd:{type:\"primaryMonitor\"}}}}).then(g)}async function T(){return t({__tauriModule:\"Window\",message:{cmd:\"manage\",data:{cmd:{type:\"availableMonitors\"}}}}).then(i=>i.map(g))}export{m as a,l as b,c,o as d,W as e,f,M as g,u as h,h as i,y as j,s as k,b as l,E as m,z as n,T as o,C as p};\n",null],"names":["f","d","c","s","u","o","W","E","m","l","v","_","w","p","t","a","appWindow","invoke"],"mappings":"AAAA,IAAI,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAC,CAAC;;ACAjD,IAAIA,GAAC,CAAC,EAAE,CAACC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Q,CAAC,GAAG,CAAC,EAAE,EAAE,eAAe,CAAC,CAAC;AACnC,KAAA;IAED,MAAM,2BAA2B,EAAE,CAAC;IAEpC,MAAMC,GAAM,CAAC,sBAAsB,EAAE;QACnC,EAAE;QACF,GAAG;QACH,QAAQ;AACR,QAAA,OAAO,EAAE,OAAO,KAAA,IAAA,IAAP,OAAO,KAAP,KAAA,CAAA,GAAA,OAAO,GAAI,EAAE;AACvB,KAAA,CAAC,CAAC;AACL;;;;"} \ No newline at end of file diff --git a/plugins/upload/guest-js/dist/index.mjs b/plugins/upload/guest-js/dist/index.mjs deleted file mode 100644 index 2ffee4b3..00000000 --- a/plugins/upload/guest-js/dist/index.mjs +++ /dev/null @@ -1,38 +0,0 @@ -import { invoke } from '@tauri-apps/api/tauri'; -import { appWindow } from '@tauri-apps/api/window'; - -const handlers = new Map(); -let listening = false; -async function listenToUploadEventIfNeeded() { - if (listening) { - return await Promise.resolve(); - } - return await appWindow - .listen("upload://progress", ({ payload }) => { - const handler = handlers.get(payload.id); - if (handler != null) { - handler(payload.progress, payload.total); - } - }) - .then(() => { - listening = true; - }); -} -async function upload(url, filePath, progressHandler, headers) { - const ids = new Uint32Array(1); - window.crypto.getRandomValues(ids); - const id = ids[0]; - if (progressHandler != null) { - handlers.set(id, progressHandler); - } - await listenToUploadEventIfNeeded(); - await invoke("plugin:upload|upload", { - id, - url, - filePath, - headers: headers !== null && headers !== void 0 ? headers : {}, - }); -} - -export { upload as default }; -//# sourceMappingURL=index.mjs.map diff --git a/plugins/upload/guest-js/dist/index.mjs.map b/plugins/upload/guest-js/dist/index.mjs.map deleted file mode 100644 index 3d37be93..00000000 --- a/plugins/upload/guest-js/dist/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAUA,MAAM,QAAQ,GAAiC,IAAI,GAAG,EAAE,CAAC;AACzD,IAAI,SAAS,GAAG,KAAK,CAAC;AAEtB,eAAe,2BAA2B,GAAA;AACxC,IAAA,IAAI,SAAS,EAAE;AACb,QAAA,OAAO,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;AAChC,KAAA;AACD,IAAA,OAAO,MAAM,SAAS;SACnB,MAAM,CAAkB,mBAAmB,EAAE,CAAC,EAAE,OAAO,EAAE,KAAI;QAC5D,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACzC,IAAI,OAAO,IAAI,IAAI,EAAE;YACnB,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;AAC1C,SAAA;AACH,KAAC,CAAC;SACD,IAAI,CAAC,MAAK;QACT,SAAS,GAAG,IAAI,CAAC;AACnB,KAAC,CAAC,CAAC;AACP,CAAC;AAEc,eAAe,MAAM,CAClC,GAAW,EACX,QAAgB,EAChB,eAAiC,EACjC,OAA6B,EAAA;AAE7B,IAAA,MAAM,GAAG,GAAG,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC;AAC/B,IAAA,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;AACnC,IAAA,MAAM,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;IAElB,IAAI,eAAe,IAAI,IAAI,EAAE;AAC3B,QAAA,QAAQ,CAAC,GAAG,CAAC,EAAE,EAAE,eAAe,CAAC,CAAC;AACnC,KAAA;IAED,MAAM,2BAA2B,EAAE,CAAC;IAEpC,MAAM,MAAM,CAAC,sBAAsB,EAAE;QACnC,EAAE;QACF,GAAG;QACH,QAAQ;AACR,QAAA,OAAO,EAAE,OAAO,KAAA,IAAA,IAAP,OAAO,KAAP,KAAA,CAAA,GAAA,OAAO,GAAI,EAAE;AACvB,KAAA,CAAC,CAAC;AACL;;;;"} \ No newline at end of file diff --git a/plugins/upload/guest-js/rollup.config.mjs b/plugins/upload/guest-js/rollup.config.mjs deleted file mode 100644 index ee885522..00000000 --- a/plugins/upload/guest-js/rollup.config.mjs +++ /dev/null @@ -1,10 +0,0 @@ -import { readFileSync } from "fs"; - -import { createConfig } from "../../../shared/rollup.config.mjs"; - -export default createConfig({ - pkg: JSON.parse( - readFileSync(new URL("./package.json", import.meta.url), "utf8") - ), - external: [/^@tauri-apps\/api/], -}); diff --git a/plugins/upload/guest-js/tsconfig.json b/plugins/upload/guest-js/tsconfig.json deleted file mode 120000 index 9c2b2da2..00000000 --- a/plugins/upload/guest-js/tsconfig.json +++ /dev/null @@ -1 +0,0 @@ -../../../shared/tsconfig.json \ No newline at end of file diff --git a/plugins/upload/guest-js/package.json b/plugins/upload/package.json similarity index 63% rename from plugins/upload/guest-js/package.json rename to plugins/upload/package.json index 8f8313c2..8ec9afaf 100644 --- a/plugins/upload/guest-js/package.json +++ b/plugins/upload/package.json @@ -6,13 +6,13 @@ "Tauri Programme within The Commons Conservancy" ], "type": "module", - "browser": "dist/index.min.js", - "module": "dist/index.mjs", - "types": "dist/index.d.ts", + "browser": "guest-js/dist/index.min.js", + "module": "guest-js/dist/index.mjs", + "types": "guest-js/dist/index.d.ts", "exports": { - "import": "./dist/index.mjs", - "types": "./dist/index.d.ts", - "browser": "./dist/index.min.js" + "import": "./guest-js/dist/index.mjs", + "types": "./guest-js/dist/index.d.ts", + "browser": "./guest-js/dist/index.min.js" }, "scripts": { "build": "rollup -c" diff --git a/plugins/upload/rollup.config.mjs b/plugins/upload/rollup.config.mjs new file mode 100644 index 00000000..6555e98b --- /dev/null +++ b/plugins/upload/rollup.config.mjs @@ -0,0 +1,11 @@ +import { readFileSync } from "fs"; + +import { createConfig } from "../../shared/rollup.config.mjs"; + +export default createConfig({ + input: "guest-js/index.ts", + pkg: JSON.parse( + readFileSync(new URL("./package.json", import.meta.url), "utf8") + ), + external: [/^@tauri-apps\/api/], +}); diff --git a/plugins/upload/tsconfig.json b/plugins/upload/tsconfig.json new file mode 120000 index 00000000..7cd38da8 --- /dev/null +++ b/plugins/upload/tsconfig.json @@ -0,0 +1 @@ +../../shared/tsconfig.json \ No newline at end of file diff --git a/plugins/websocket/.gitignore b/plugins/websocket/.gitignore new file mode 100644 index 00000000..b512c09d --- /dev/null +++ b/plugins/websocket/.gitignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/plugins/websocket/README.md b/plugins/websocket/README.md index a864895b..9d1abd6c 100644 --- a/plugins/websocket/README.md +++ b/plugins/websocket/README.md @@ -4,14 +4,56 @@ ## Install +There are three general methods of installation that we can recommend. + +1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked) +2. Pull sources directly from Github using git tags / revision hashes (most secure) +3. Git submodule install this repo in your tauri project and then use file protocol to ingest the source (most secure, but inconvenient to use) + +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" } ``` +You can install the JavaScript Guest bindings using your preferred JavaScript package manager: + +> 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-websocket +# or +npm add https://github.com/tauri-apps/tauri-plugin-websocket +# or +yarn add https://github.com/tauri-apps/tauri-plugin-websocket ``` ## Usage +First you need to register the core plugin with Tauri: + +`src-tauri/src/main.rs` +```rust +fn main() { + tauri::Builder::default() + .plugin(tauri_plugin_websocket::init()) + .run(tauri::generate_context!()) + .expect("error while running tauri application"); +} ``` +Afterwards all the plugin's APIs are available through the JavaScript guest bindings: + +```javascript +import { WebSocket } from 'tauri-plugin-websocket-api' + +const ws = await WebSocket.connect('wss://example.com') + +await ws.send('Hello World') + +await ws.disconnect() ``` ## Contributing @@ -20,6 +62,6 @@ PRs accepted. Please make sure to read the Contributing Guide before making a pu ## License -Code: (c) 2015 - 2021 - 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. diff --git a/plugins/websocket/guest-js/dist/index.d.ts b/plugins/websocket/guest-js/dist/index.d.ts deleted file mode 100644 index 2631651f..00000000 --- a/plugins/websocket/guest-js/dist/index.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -export interface MessageKind { - type: T; - data: D; -} -export interface CloseFrame { - code: number; - reason: string; -} -export type Message = MessageKind<"Text", string> | MessageKind<"Binary", number[]> | MessageKind<"Ping", number[]> | MessageKind<"Pong", number[]> | MessageKind<"Close", CloseFrame | null>; -export default class WebSocket { - id: number; - private readonly listeners; - constructor(id: number, listeners: Array<(arg: Message) => void>); - static connect(url: string, options?: unknown): Promise; - addListener(cb: (arg: Message) => void): void; - send(message: Message | string | number[]): Promise; - disconnect(): Promise; -} diff --git a/plugins/websocket/guest-js/dist/index.min.js b/plugins/websocket/guest-js/dist/index.min.js deleted file mode 100644 index 7504467d..00000000 --- a/plugins/websocket/guest-js/dist/index.min.js +++ /dev/null @@ -1,55 +0,0 @@ -var d=Object.defineProperty;var e=(c,a)=>{for(var b in a)d(c,b,{get:a[b],enumerable:!0});}; - -var f={};e(f,{convertFileSrc:()=>w,invoke:()=>c,transformCallback:()=>s});function u(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function s(e,r=!1){let n=u(),t=`_${n}`;return Object.defineProperty(window,t,{value:o=>(r&&Reflect.deleteProperty(window,t),e==null?void 0:e(o)),writable:!1,configurable:!0}),n}async function c(e,r={}){return new Promise((n,t)=>{let o=s(i=>{n(i),Reflect.deleteProperty(window,`_${a}`);},!0),a=s(i=>{t(i),Reflect.deleteProperty(window,`_${o}`);},!0);window.__TAURI_IPC__({cmd:e,callback:o,error:a,...r});})}function w(e,r="asset"){let n=encodeURIComponent(e);return navigator.userAgent.includes("Windows")?`https://${r}.localhost/${n}`:`${r}://localhost/${n}`} - -class WebSocket { - constructor(id, listeners) { - this.id = id; - this.listeners = listeners; - } - static async connect(url, options) { - const listeners = []; - const handler = (message) => { - listeners.forEach((l) => l(message)); - }; - return await c("plugin:websocket|connect", { - url, - callbackFunction: s(handler), - options, - }).then((id) => new WebSocket(id, listeners)); - } - addListener(cb) { - this.listeners.push(cb); - } - async send(message) { - let m; - if (typeof message === "string") { - m = { type: "Text", data: message }; - } - else if (typeof message === "object" && "type" in message) { - m = message; - } - else if (Array.isArray(message)) { - m = { type: "Binary", data: message }; - } - else { - throw new Error("invalid `message` type, expected a `{ type: string, data: any }` object, a string or a numeric array"); - } - return await c("plugin:websocket|send", { - id: this.id, - message: m, - }); - } - async disconnect() { - return await this.send({ - type: "Close", - data: { - code: 1000, - reason: "Disconnected by client", - }, - }); - } -} - -export { WebSocket as default }; -//# sourceMappingURL=index.min.js.map diff --git a/plugins/websocket/guest-js/dist/index.min.js.map b/plugins/websocket/guest-js/dist/index.min.js.map deleted file mode 100644 index a7b238ab..00000000 --- a/plugins/websocket/guest-js/dist/index.min.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.min.js","sources":["../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-FEIY7W7S.js","../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-RCPA6UVN.js","../index.ts"],"sourcesContent":["var d=Object.defineProperty;var e=(c,a)=>{for(var b in a)d(c,b,{get:a[b],enumerable:!0})};export{e as a};\n","import{a as d}from\"./chunk-FEIY7W7S.js\";var f={};d(f,{convertFileSrc:()=>w,invoke:()=>c,transformCallback:()=>s});function u(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function s(e,r=!1){let n=u(),t=`_${n}`;return Object.defineProperty(window,t,{value:o=>(r&&Reflect.deleteProperty(window,t),e==null?void 0:e(o)),writable:!1,configurable:!0}),n}async function c(e,r={}){return new Promise((n,t)=>{let o=s(i=>{n(i),Reflect.deleteProperty(window,`_${a}`)},!0),a=s(i=>{t(i),Reflect.deleteProperty(window,`_${o}`)},!0);window.__TAURI_IPC__({cmd:e,callback:o,error:a,...r})})}function w(e,r=\"asset\"){let n=encodeURIComponent(e);return navigator.userAgent.includes(\"Windows\")?`https://${r}.localhost/${n}`:`${r}://localhost/${n}`}export{s as a,c as b,w as c,f as d};\n",null],"names":["d","invoke","transformCallback"],"mappings":"AAAA,IAAI,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAC,CAAC;;ACAjD,IAAI,CAAC,CAAC,EAAE,CAACA,CAAC,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,OAAO,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,E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AAO;AACb,YAAA,IAAI,EAAE;AACJ,gBAAA,IAAI,EAAE,IAAI;AACV,gBAAA,MAAM,EAAE,wBAAwB;AACjC,aAAA;AACF,SAAA,CAAC,CAAC;KACJ;AACF;;;;"} \ No newline at end of file diff --git a/plugins/websocket/guest-js/dist/index.mjs b/plugins/websocket/guest-js/dist/index.mjs deleted file mode 100644 index e392f6a0..00000000 --- a/plugins/websocket/guest-js/dist/index.mjs +++ /dev/null @@ -1,53 +0,0 @@ -import { invoke, transformCallback } from '@tauri-apps/api/tauri'; - -class WebSocket { - constructor(id, listeners) { - this.id = id; - this.listeners = listeners; - } - static async connect(url, options) { - const listeners = []; - const handler = (message) => { - listeners.forEach((l) => l(message)); - }; - return await invoke("plugin:websocket|connect", { - url, - callbackFunction: transformCallback(handler), - options, - }).then((id) => new WebSocket(id, listeners)); - } - addListener(cb) { - this.listeners.push(cb); - } - async send(message) { - let m; - if (typeof message === "string") { - m = { type: "Text", data: message }; - } - else if (typeof message === "object" && "type" in message) { - m = message; - } - else if (Array.isArray(message)) { - m = { type: "Binary", data: message }; - } - else { - throw new Error("invalid `message` type, expected a `{ type: string, data: any }` object, a string or a numeric array"); - } - return await invoke("plugin:websocket|send", { - id: this.id, - message: m, - }); - } - async disconnect() { - return await this.send({ - type: "Close", - data: { - code: 1000, - reason: "Disconnected by client", - }, - }); - } -} - -export { WebSocket as default }; -//# sourceMappingURL=index.mjs.map diff --git a/plugins/websocket/guest-js/dist/index.mjs.map b/plugins/websocket/guest-js/dist/index.mjs.map deleted file mode 100644 index 3b5c8b71..00000000 --- a/plugins/websocket/guest-js/dist/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAmBc,MAAO,SAAS,CAAA;IAI5B,WAAY,CAAA,EAAU,EAAE,SAAwC,EAAA;AAC9D,QAAA,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;AACb,QAAA,IAAI,CAAC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,EAAE,EAAE,IAAI,CAAC,EAAE;AACX,YAAA,OAAO,EAAE,CAAC;AACX,SAAA,CAAC,CAAC;KACJ;AAED,IAAA,MAAM,UAAU,GAAA;AACd,QAAA,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC;AACrB,YAAA,IAAI,EAAE,OAAO;AACb,YAAA,IAAI,EAAE;AACJ,gBAAA,IAAI,EAAE,IAAI;AACV,gBAAA,MAAM,EAAE,wBAAwB;AACjC,aAAA;AACF,SAAA,CAAC,CAAC;KACJ;AACF;;;;"} \ No newline at end of file diff --git a/plugins/websocket/guest-js/rollup.config.mjs b/plugins/websocket/guest-js/rollup.config.mjs deleted file mode 100644 index ee885522..00000000 --- a/plugins/websocket/guest-js/rollup.config.mjs +++ /dev/null @@ -1,10 +0,0 @@ -import { readFileSync } from "fs"; - -import { createConfig } from "../../../shared/rollup.config.mjs"; - -export default createConfig({ - pkg: JSON.parse( - readFileSync(new URL("./package.json", import.meta.url), "utf8") - ), - external: [/^@tauri-apps\/api/], -}); diff --git a/plugins/websocket/guest-js/tsconfig.json b/plugins/websocket/guest-js/tsconfig.json deleted file mode 120000 index 9c2b2da2..00000000 --- a/plugins/websocket/guest-js/tsconfig.json +++ /dev/null @@ -1 +0,0 @@ -../../../shared/tsconfig.json \ No newline at end of file diff --git a/plugins/websocket/guest-js/package.json b/plugins/websocket/package.json similarity index 57% rename from plugins/websocket/guest-js/package.json rename to plugins/websocket/package.json index 7fd73a30..998252ba 100644 --- a/plugins/websocket/guest-js/package.json +++ b/plugins/websocket/package.json @@ -6,20 +6,20 @@ "Tauri Programme within The Commons Conservancy" ], "type": "module", - "browser": "dist/index.min.js", - "module": "dist/index.mjs", - "types": "dist/index.d.ts", + "browser": "guest-js/dist/index.min.js", + "module": "guest-js/dist/index.mjs", + "types": "guest-js/dist/index.d.ts", "exports": { - "import": "./dist/index.mjs", - "types": "./dist/index.d.ts", - "browser": "./dist/index.min.js" + "import": "./guest-js/dist/index.mjs", + "types": "./guest-js/dist/index.d.ts", + "browser": "./guest-js/dist/index.min.js" }, "scripts": { "build": "rollup -c" }, "files": [ - "dist", - "!dist/**/*.map", + "guest-js/dist", + "!guest-js/dist/**/*.map", "README.md", "LICENSE" ], diff --git a/plugins/websocket/rollup.config.mjs b/plugins/websocket/rollup.config.mjs new file mode 100644 index 00000000..6555e98b --- /dev/null +++ b/plugins/websocket/rollup.config.mjs @@ -0,0 +1,11 @@ +import { readFileSync } from "fs"; + +import { createConfig } from "../../shared/rollup.config.mjs"; + +export default createConfig({ + input: "guest-js/index.ts", + pkg: JSON.parse( + readFileSync(new URL("./package.json", import.meta.url), "utf8") + ), + external: [/^@tauri-apps\/api/], +}); diff --git a/plugins/websocket/src/lib.rs b/plugins/websocket/src/lib.rs index dccea1ec..c3e08ace 100644 --- a/plugins/websocket/src/lib.rs +++ b/plugins/websocket/src/lib.rs @@ -1,10 +1,9 @@ use futures_util::{stream::SplitSink, SinkExt, StreamExt}; use serde::{ser::Serializer, Deserialize, Serialize}; -use serde_json::Value as JsonValue; use tauri::{ api::ipc::{format_callback, CallbackFn}, - plugin::Plugin, - AppHandle, Invoke, Manager, Runtime, State, Window, + plugin::{Builder as PluginBuilder, TauriPlugin}, + Manager, Runtime, State, Window, }; use tokio::{net::TcpStream, sync::Mutex}; use tokio_tungstenite::{ @@ -161,29 +160,12 @@ async fn send( } } -pub struct TauriWebsocket { - invoke_handler: Box) + Send + Sync>, -} - -impl Default for TauriWebsocket { - fn default() -> Self { - Self { - invoke_handler: Box::new(tauri::generate_handler![connect, send]), - } - } -} - -impl Plugin for TauriWebsocket { - fn name(&self) -> &'static str { - "websocket" - } - - fn initialize(&mut self, app: &AppHandle, _config: JsonValue) -> tauri::plugin::Result<()> { - app.manage(ConnectionManager::default()); - Ok(()) - } - - fn extend_api(&mut self, invoke: Invoke) { - (self.invoke_handler)(invoke) - } +pub fn init() -> TauriPlugin { + PluginBuilder::new("websocket") + .invoke_handler(tauri::generate_handler![connect, send]) + .setup(|app| { + app.manage(ConnectionManager::default()); + Ok(()) + }) + .build() } diff --git a/plugins/websocket/tsconfig.json b/plugins/websocket/tsconfig.json new file mode 120000 index 00000000..7cd38da8 --- /dev/null +++ b/plugins/websocket/tsconfig.json @@ -0,0 +1 @@ +../../shared/tsconfig.json \ No newline at end of file diff --git a/plugins/window-state/README.md b/plugins/window-state/README.md index 3f2619a2..1ef7019d 100644 --- a/plugins/window-state/README.md +++ b/plugins/window-state/README.md @@ -1,17 +1,55 @@ ![plugin-window-state](banner.png) +Save window positions and sizse and restore them when the app is reopened. + ## Install -``` +There are three general methods of installation that we can recommend. + +1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked) +2. Pull sources directly from Github using git tags / revision hashes (most secure) +3. Git submodule install this repo in your tauri project and then use file protocol to ingest the source (most secure, but inconvenient to use) +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" } ``` ## Usage +First you need to register the core plugin with Tauri: + +`src-tauri/src/main.rs` +```rust +fn main() { + tauri::Builder::default() + .plugin(tauri_plugin_window_state::Builder::default().build()) + .run(tauri::generate_context!()) + .expect("error while running tauri application"); +} ``` +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; + +// `tauri::AppHandle` now has the following additional method +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}; + +// all `Window` types now have the following additional method +window.restore_state(ShowMode::LastSaved); // will restore the windows state from disk ``` ## Contributing @@ -20,6 +58,6 @@ PRs accepted. Please make sure to read the Contributing Guide before making a pu ## License -Code: (c) 2015 - 2021 - 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. diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 572fc642..cb7e05a8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -33,7 +33,7 @@ importers: rollup: 3.7.4 typescript: 4.9.4 - plugins/authenticator/guest-js: + plugins/authenticator: specifiers: "@tauri-apps/api": ^1.2.0 tslib: ^2.4.1 @@ -42,7 +42,7 @@ importers: devDependencies: tslib: 2.4.1 - plugins/autostart/guest-js: + plugins/autostart: specifiers: "@tauri-apps/api": ^1.2.0 tslib: ^2.4.1 @@ -51,7 +51,7 @@ importers: devDependencies: tslib: 2.4.1 - plugins/fs-extra/guest-js: + plugins/fs-extra: specifiers: "@tauri-apps/api": ^1.2.0 tslib: ^2.4.1 @@ -60,7 +60,7 @@ importers: devDependencies: tslib: 2.4.1 - plugins/fs-watch/guest-js: + plugins/fs-watch: specifiers: "@tauri-apps/api": ^1.2.0 tslib: ^2.4.1 @@ -69,7 +69,7 @@ importers: devDependencies: tslib: 2.4.1 - plugins/log/guest-js: + plugins/log: specifiers: "@tauri-apps/api": ^1.2.0 tslib: ^2.4.1 @@ -78,7 +78,7 @@ importers: devDependencies: tslib: 2.4.1 - plugins/positioner/guest-js: + plugins/positioner: specifiers: "@tauri-apps/api": ^1.2.0 tslib: ^2.4.1 @@ -87,7 +87,7 @@ importers: devDependencies: tslib: 2.4.1 - plugins/sql/guest-js: + plugins/sql: specifiers: "@tauri-apps/api": ^1.2.0 tslib: ^2.4.1 @@ -96,7 +96,7 @@ importers: devDependencies: tslib: 2.4.1 - plugins/store/guest-js: + plugins/store: specifiers: "@tauri-apps/api": ^1.2.0 tslib: ^2.4.1 @@ -105,7 +105,7 @@ importers: devDependencies: tslib: 2.4.1 - plugins/stronghold/guest-js: + plugins/stronghold: specifiers: "@tauri-apps/api": ^1.2.0 tslib: ^2.4.1 @@ -114,7 +114,7 @@ importers: devDependencies: tslib: 2.4.1 - plugins/upload/guest-js: + plugins/upload: specifiers: "@tauri-apps/api": ^1.2.0 tslib: ^2.4.1 @@ -123,7 +123,7 @@ importers: devDependencies: tslib: 2.4.1 - plugins/websocket/guest-js: + plugins/websocket: specifiers: "@tauri-apps/api": ^1.2.0 tslib: ^2.4.1 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 7f54532a..0fa0c2c8 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -1,2 +1,2 @@ packages: - - plugins/*/guest-js + - plugins/* diff --git a/shared/rollup.config.mjs b/shared/rollup.config.mjs index 7ec69d2a..9595b929 100644 --- a/shared/rollup.config.mjs +++ b/shared/rollup.config.mjs @@ -10,10 +10,10 @@ import resolve from "@rollup/plugin-node-resolve"; * @param {string[]} external Imported package.json * @returns {import('rollup').RollupOptions} */ -export function createConfig({ pkg, external = [] }) { +export function createConfig({ input = "index.ts", pkg, external = [] }) { return [ { - input: "index.ts", + input, external: Object.keys(pkg.dependencies || {}) .concat(Object.keys(pkg.peerDependencies || {})) .concat(builtinModules) @@ -30,7 +30,7 @@ export function createConfig({ pkg, external = [] }) { plugins: [typescript({ sourceMap: true })], }, { - input: "index.ts", + input, onwarn: (warning) => { throw Object.assign(new Error(), warning); }, diff --git a/shared/template/README.md b/shared/template/README.md index 97196018..5823ab98 100644 --- a/shared/template/README.md +++ b/shared/template/README.md @@ -1,17 +1,53 @@ -{{name}} +![{{plugin name}}](banner.jpg) ## Install +There are three general methods of installation that we can recommend. + +1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked) +2. Pull sources directly from Github using git tags / revision hashes (most secure) +3. Git submodule install this repo in your tauri project and then use file protocol to ingest the source (most secure, but inconvenient to use) + +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" } ``` +You can install the JavaScript Guest bindings using your preferred JavaScript package manager: + +> 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 +# or +npm add +# or +yarn add ``` ## Usage +First you need to register the core plugin with Tauri: + +`src-tauri/src/main.rs` +```rust +fn main() { + tauri::Builder::default() + .plugin() + .run(tauri::generate_context!()) + .expect("error while running tauri application"); +} ``` +Afterwards all the plugin's APIs are available through the JavaScript guest bindings: + +```javascript + ``` ## Contributing @@ -20,6 +56,6 @@ PRs accepted. Please make sure to read the Contributing Guide before making a pu ## License -Code: (c) 2015 - 2021 - 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. diff --git a/shared/tsconfig.json b/shared/tsconfig.json index 7911d822..5098169a 100644 --- a/shared/tsconfig.json +++ b/shared/tsconfig.json @@ -1,4 +1,4 @@ { - "extends": "../../../tsconfig.base.json", - "include": ["*.ts", "types/**/*"] + "extends": "../../tsconfig.base.json", + "include": ["guest-js/*.ts"] }