mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-06-16 14:30:06 +02:00
Compare commits
33 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| fb62d03f73 | |||
| 7e5e34420b | |||
| f12d35609a | |||
| 44273b9889 | |||
| 2f7e32b5e0 | |||
| 30bcf5dcc2 | |||
| 68579934c9 | |||
| 04459afbb6 | |||
| 3b2bd3065d | |||
| f930505de4 | |||
| 34319bd977 | |||
| 34737186fe | |||
| 4bd1f15bb9 | |||
| aabc4d3a24 | |||
| fc9b189e83 | |||
| b7ff3a6bdb | |||
| 04a0aea0ab | |||
| e564e2aa91 | |||
| 118f6b4334 | |||
| fd0a52aa86 | |||
| 52e3bdab26 | |||
| dd09e3c3f4 | |||
| 2797954799 | |||
| 025210be28 | |||
| 221f50f53b | |||
| 6bf1bd8d44 | |||
| 41fe9053a0 | |||
| 27bb5d9a27 | |||
| 3168e17603 | |||
| dd514e7a88 | |||
| 6e142b4230 | |||
| fd1c7c8dbb | |||
| 59c63f31cc |
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"cli": patch
|
||||
---
|
||||
|
||||
Expose `Matches`, `SubcommandMatches` and `ArgData` structs.
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"deep-link": patch
|
||||
---
|
||||
|
||||
Fix fails to start when having spaces in the main binary path on Windows
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"dialog": patch
|
||||
---
|
||||
|
||||
Update rfd to 0.15
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
sql: patch
|
||||
---
|
||||
|
||||
It is now possible to enable multiple SQL backends at the same time. There will be no compile error anymore if no backends are enabled!
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
fs: patch
|
||||
---
|
||||
|
||||
Fix failing to deserialize capability file when using an OS specific path in the scope that is not available on the current OS.
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"dialog": patch:breaking
|
||||
---
|
||||
|
||||
Changed `MessageDialogBuilder::ok_button_label` and `MessageDialogBuilder::cancel_button_label` to `MessageDialogBuilder::buttons` which takes an enum now
|
||||
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"positioner": patch
|
||||
"positioner-js": patch
|
||||
---
|
||||
|
||||
`handleIconState` function for use in JavaScript event handlers. This allows one to update the TrayIcon state through JavaScript and fully create and handle the TrayIcon without requiring Rust (and the side-effect of creating a TrayIcon).
|
||||
@@ -4,18 +4,23 @@
|
||||
".changes/android-dialog-save.md",
|
||||
".changes/barcode-dependencies.md",
|
||||
".changes/barcode-scanner-validate-plist.md",
|
||||
".changes/cli-hidden-structs.md",
|
||||
".changes/consolidate-permission-state.md",
|
||||
".changes/deep-link-event.md",
|
||||
".changes/deep-link-get-current-desktop.md",
|
||||
".changes/deep-link-on-new-url.md",
|
||||
".changes/deep-link-register-all.md",
|
||||
".changes/deep-link-space-in-path.md",
|
||||
".changes/dialog-asset-scope.md",
|
||||
".changes/dialog-file-response-non-exhaustive.md",
|
||||
".changes/dialog-return-path.md",
|
||||
".changes/dialog-rfd-015.md",
|
||||
".changes/feat-multiple-sql-backends.md",
|
||||
".changes/fix-barcodae-scanner-imports.md",
|
||||
".changes/fix-clipboard-warnings-sdk.md",
|
||||
".changes/fix-deep-link-config.md",
|
||||
".changes/fix-fs-app-scopes.md",
|
||||
".changes/fix-fs-scope-unknown-path.md",
|
||||
".changes/fix-fs-write-file-android.md",
|
||||
".changes/fix-http-plugin-abort.md",
|
||||
".changes/fix-ios-file-dialog-default-mode.md",
|
||||
@@ -37,17 +42,22 @@
|
||||
".changes/haptics-release.md",
|
||||
".changes/iife-varname-spacing.md",
|
||||
".changes/ios-dialog-save.md",
|
||||
".changes/native-dialog-button-text.md",
|
||||
".changes/notification-body-optional-ios.md",
|
||||
".changes/notification-permission-type-change.md",
|
||||
".changes/positioner-v2-handleIconState.md",
|
||||
".changes/rc.md",
|
||||
".changes/remove-target-sdk.md",
|
||||
".changes/resolve-content-uris.md",
|
||||
".changes/shell-open-regex-match-string.md",
|
||||
".changes/shell-regex-match-string.md",
|
||||
".changes/shell-schema-required-sidcar.md",
|
||||
".changes/single-instance-deep-link.md",
|
||||
".changes/single-instance-optional-deep-link.md",
|
||||
".changes/single-instance-windows-sys.0.59.md",
|
||||
".changes/sql-uuid-type.md",
|
||||
".changes/store-api-refactor.md",
|
||||
".changes/store-auto-save.md",
|
||||
".changes/store-remove-mobile-plugin.md",
|
||||
".changes/swift-build-older-versions.md",
|
||||
".changes/tauri-rc-8.md",
|
||||
@@ -55,6 +65,9 @@
|
||||
".changes/update-geolocation-api.md",
|
||||
".changes/update-tauri-rc-12.md",
|
||||
".changes/update-tauri-rc-3.md",
|
||||
".changes/updater-endpoint-version-encoded.md",
|
||||
".changes/updater-endpoints-result.md",
|
||||
".changes/updater-insecure-transport-protocol.md",
|
||||
".changes/updater-js-headers-download-crate.md",
|
||||
".changes/updater-js-headers-download.md",
|
||||
".changes/window-state-physical-size.md"
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"shell": "patch"
|
||||
---
|
||||
|
||||
Fix the plugin schema requiring to set `sidecar` property when it is in fact optional.
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"store-js": patch
|
||||
---
|
||||
|
||||
**Breaking change**: Removed the `Store` constructor and added the `createStore` API.
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
"store": patch
|
||||
---
|
||||
|
||||
Add a setting `auto_save` to enable a store to debounce save on modification (on calls like set, clear, delete, reset)
|
||||
|
||||
**Breaking change**: Removed the `with_store` API and added `StoreExt::store_builder`.
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'updater': 'patch'
|
||||
---
|
||||
|
||||
Encode `+` when making updater requests which can be cause incorrectly interpolating the endpoint when using `{{current_version}}` in the endpoint where the current version contains a build number, for example `1.8.0+1`.
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"updater": patch
|
||||
---
|
||||
|
||||
**Breaking change**, Changed `UpdaterBuilder::endpoints` method to return a `Result`.
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"updater": patch
|
||||
---
|
||||
|
||||
Add `dangerousInsecureTransportProtocol` config option to allow using insecure transport protocols, like `http`
|
||||
@@ -148,13 +148,7 @@ jobs:
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
|
||||
- name: clippy ${{ matrix.package }}
|
||||
if: matrix.package != 'tauri-plugin-sql'
|
||||
run: cargo clippy --package ${{ matrix.package }} --all-targets -- -D warnings
|
||||
|
||||
- name: clippy ${{ matrix.package }} mysql
|
||||
if: matrix.package == 'tauri-plugin-sql'
|
||||
run: cargo clippy --package ${{ matrix.package }} --all-targets --no-default-features --features mysql -- -D warnings
|
||||
|
||||
- name: clippy ${{ matrix.package }} postgres
|
||||
if: matrix.package == 'tauri-plugin-sql'
|
||||
run: cargo clippy --package ${{ matrix.package }} --all-targets --no-default-features --features postgres -- -D warnings
|
||||
- name: clippy ${{ matrix.package }} --all-features
|
||||
run: cargo clippy --package ${{ matrix.package }} --all-targets --all-features -- -D warnings
|
||||
|
||||
@@ -215,21 +215,9 @@ jobs:
|
||||
run: cargo +stable install cross --git https://github.com/cross-rs/cross
|
||||
|
||||
- name: test ${{ matrix.package }}
|
||||
if: matrix.package != 'tauri-plugin-sql' && matrix.package != 'tauri-plugin-http'
|
||||
if: matrix.package != 'tauri-plugin-http'
|
||||
run: ${{ matrix.platform.runner }} ${{ matrix.platform.command }} --package ${{ matrix.package }} --target ${{ matrix.platform.target }} --all-targets --all-features
|
||||
|
||||
- name: test ${{ matrix.package }}
|
||||
if: matrix.package == 'tauri-plugin-http'
|
||||
run: ${{ matrix.platform.runner }} ${{ matrix.platform.command }} --package ${{ matrix.package }} --target ${{ matrix.platform.target }} --all-targets
|
||||
|
||||
- name: test ${{ matrix.package }} sqlite
|
||||
if: matrix.package == 'tauri-plugin-sql'
|
||||
run: ${{ matrix.platform.runner }} ${{ matrix.platform.command }} --package ${{ matrix.package }} --target ${{ matrix.platform.target }} --all-targets --features sqlite
|
||||
|
||||
- name: test ${{ matrix.package }} mysql
|
||||
if: matrix.package == 'tauri-plugin-sql'
|
||||
run: ${{ matrix.platform.runner }} ${{ matrix.platform.command }} --package ${{ matrix.package }} --target ${{ matrix.platform.target }} --all-targets --features mysql
|
||||
|
||||
- name: test ${{ matrix.package }} postgres
|
||||
if: matrix.package == 'tauri-plugin-sql'
|
||||
run: ${{ matrix.platform.runner }} ${{ matrix.platform.command }} --package ${{ matrix.package }} --target ${{ matrix.platform.target }} --all-targets --features postgres
|
||||
|
||||
Generated
+309
-369
File diff suppressed because it is too large
Load Diff
+4
-4
@@ -11,10 +11,10 @@ resolver = "2"
|
||||
[workspace.dependencies]
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
log = "0.4"
|
||||
tauri = { version = "2.0.0-rc.14", default-features = false }
|
||||
tauri-build = "2.0.0-rc.11"
|
||||
tauri-plugin = "2.0.0-rc.11"
|
||||
tauri-utils = "2.0.0-rc.11"
|
||||
tauri = { version = "2.0.0-rc.16", default-features = false }
|
||||
tauri-build = "2.0.0-rc.13"
|
||||
tauri-plugin = "2.0.0-rc.13"
|
||||
tauri-utils = "2.0.0-rc.13"
|
||||
serde_json = "1"
|
||||
thiserror = "1"
|
||||
url = "2"
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# Changelog
|
||||
|
||||
## \[2.0.0-rc.5]
|
||||
|
||||
### Dependencies
|
||||
|
||||
- Upgraded to `store-js@2.0.0-rc.2`
|
||||
|
||||
## \[2.0.0-rc.4]
|
||||
|
||||
### Dependencies
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "svelte-app",
|
||||
"private": true,
|
||||
"version": "2.0.0-rc.4",
|
||||
"version": "2.0.0-rc.5",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite --clearScreen false",
|
||||
@@ -9,14 +9,14 @@
|
||||
"serve": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "2.0.0-rc.4",
|
||||
"@tauri-apps/api": "2.0.0-rc.6",
|
||||
"@tauri-apps/plugin-barcode-scanner": "2.0.0-rc.2",
|
||||
"@tauri-apps/plugin-biometric": "2.0.0-rc.1",
|
||||
"@tauri-apps/plugin-cli": "2.0.0-rc.1",
|
||||
"@tauri-apps/plugin-clipboard-manager": "2.0.0-rc.2",
|
||||
"@tauri-apps/plugin-dialog": "2.0.0-rc.1",
|
||||
"@tauri-apps/plugin-fs": "2.0.0-rc.2",
|
||||
"@tauri-apps/plugin-geolocation": "2.0.0-rc.1",
|
||||
"@tauri-apps/plugin-geolocation": "2.0.0-rc.2",
|
||||
"@tauri-apps/plugin-global-shortcut": "2.0.0-rc.1",
|
||||
"@tauri-apps/plugin-haptics": "2.0.0-rc.1",
|
||||
"@tauri-apps/plugin-http": "2.0.0-rc.2",
|
||||
@@ -25,18 +25,18 @@
|
||||
"@tauri-apps/plugin-os": "2.0.0-rc.1",
|
||||
"@tauri-apps/plugin-process": "2.0.0-rc.1",
|
||||
"@tauri-apps/plugin-shell": "2.0.0-rc.1",
|
||||
"@tauri-apps/plugin-store": "2.0.0-rc.1",
|
||||
"@tauri-apps/plugin-store": "2.0.0-rc.2",
|
||||
"@tauri-apps/plugin-updater": "2.0.0-rc.2",
|
||||
"@zerodevx/svelte-json-view": "1.0.10"
|
||||
"@zerodevx/svelte-json-view": "1.0.11"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@iconify-json/codicon": "^1.1.37",
|
||||
"@iconify-json/ph": "^1.1.8",
|
||||
"@sveltejs/vite-plugin-svelte": "^3.0.1",
|
||||
"@tauri-apps/cli": "2.0.0-rc.15",
|
||||
"@unocss/extractor-svelte": "^0.62.0",
|
||||
"@tauri-apps/cli": "2.0.0-rc.17",
|
||||
"@unocss/extractor-svelte": "^0.63.0",
|
||||
"svelte": "^4.2.19",
|
||||
"unocss": "^0.62.0",
|
||||
"vite": "^5.0.13"
|
||||
"unocss": "^0.63.0",
|
||||
"vite": "^5.4.7"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
# Changelog
|
||||
|
||||
## \[2.0.0-rc.8]
|
||||
|
||||
### Dependencies
|
||||
|
||||
- Upgraded to `cli@2.0.0-rc.2`
|
||||
- Upgraded to `dialog@2.0.0-rc.8`
|
||||
- Upgraded to `fs@2.0.0-rc.6`
|
||||
- Upgraded to `shell@2.0.0-rc.4`
|
||||
- Upgraded to `store@2.0.0-rc.4`
|
||||
- Upgraded to `updater@2.0.0-rc.4`
|
||||
- Upgraded to `http@2.0.0-rc.6`
|
||||
|
||||
## \[2.0.0-rc.7]
|
||||
|
||||
### Dependencies
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "api"
|
||||
publish = false
|
||||
version = "2.0.0-rc.7"
|
||||
version = "2.0.0-rc.8"
|
||||
description = "An example Tauri Application showcasing the api"
|
||||
edition = "2021"
|
||||
rust-version = { workspace = true }
|
||||
@@ -20,21 +20,21 @@ serde = { workspace = true }
|
||||
tiny_http = "0.12"
|
||||
log = { workspace = true }
|
||||
tauri-plugin-log = { path = "../../../plugins/log", version = "2.0.0-rc.2" }
|
||||
tauri-plugin-fs = { path = "../../../plugins/fs", version = "2.0.0-rc.5", features = [
|
||||
tauri-plugin-fs = { path = "../../../plugins/fs", version = "2.0.0-rc.6", features = [
|
||||
"watch",
|
||||
] }
|
||||
tauri-plugin-clipboard-manager = { path = "../../../plugins/clipboard-manager", version = "2.0.0-rc.4" }
|
||||
tauri-plugin-dialog = { path = "../../../plugins/dialog", version = "2.0.0-rc.7" }
|
||||
tauri-plugin-dialog = { path = "../../../plugins/dialog", version = "2.0.0-rc.8" }
|
||||
tauri-plugin-http = { path = "../../../plugins/http", features = [
|
||||
"multipart",
|
||||
], version = "2.0.0-rc.5" }
|
||||
], version = "2.0.0-rc.6" }
|
||||
tauri-plugin-notification = { path = "../../../plugins/notification", version = "2.0.0-rc.5", features = [
|
||||
"windows7-compat",
|
||||
] }
|
||||
tauri-plugin-os = { path = "../../../plugins/os", version = "2.0.0-rc.1" }
|
||||
tauri-plugin-process = { path = "../../../plugins/process", version = "2.0.0-rc.1" }
|
||||
tauri-plugin-shell = { path = "../../../plugins/shell", version = "2.0.0-rc.3" }
|
||||
tauri-plugin-store = { path = "../../../plugins/store", version = "2.0.0-rc.3" }
|
||||
tauri-plugin-shell = { path = "../../../plugins/shell", version = "2.0.0-rc.4" }
|
||||
tauri-plugin-store = { path = "../../../plugins/store", version = "2.0.0-rc.4" }
|
||||
|
||||
[dependencies.tauri]
|
||||
workspace = true
|
||||
@@ -50,9 +50,9 @@ features = [
|
||||
]
|
||||
|
||||
[target."cfg(any(target_os = \"macos\", windows, target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies]
|
||||
tauri-plugin-cli = { path = "../../../plugins/cli", version = "2.0.0-rc.1" }
|
||||
tauri-plugin-cli = { path = "../../../plugins/cli", version = "2.0.0-rc.2" }
|
||||
tauri-plugin-global-shortcut = { path = "../../../plugins/global-shortcut", version = "2.0.0-rc.2" }
|
||||
tauri-plugin-updater = { path = "../../../plugins/updater", version = "2.0.0-rc.3" }
|
||||
tauri-plugin-updater = { path = "../../../plugins/updater", version = "2.0.0-rc.4" }
|
||||
tauri-plugin-window-state = { path = "../../../plugins/window-state", version = "2.0.0-rc.3" }
|
||||
|
||||
[target."cfg(any(target_os = \"android\", target_os = \"ios\"))".dependencies]
|
||||
|
||||
+6
-6
@@ -10,20 +10,20 @@
|
||||
"format:check": "prettier --check ."
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "9.10.0",
|
||||
"@rollup/plugin-node-resolve": "15.2.3",
|
||||
"@eslint/js": "9.11.1",
|
||||
"@rollup/plugin-node-resolve": "15.3.0",
|
||||
"@rollup/plugin-terser": "0.4.4",
|
||||
"@rollup/plugin-typescript": "11.1.6",
|
||||
"@types/eslint__js": "8.42.3",
|
||||
"covector": "^0.12.0",
|
||||
"eslint": "9.10.0",
|
||||
"covector": "^0.12.3",
|
||||
"eslint": "9.11.1",
|
||||
"eslint-config-prettier": "9.1.0",
|
||||
"eslint-plugin-security": "3.0.1",
|
||||
"prettier": "3.3.3",
|
||||
"rollup": "4.21.3",
|
||||
"rollup": "4.22.4",
|
||||
"tslib": "2.7.0",
|
||||
"typescript": "5.6.2",
|
||||
"typescript-eslint": "8.5.0"
|
||||
"typescript-eslint": "8.7.0"
|
||||
},
|
||||
"resolutions": {
|
||||
"semver": ">=7.5.2",
|
||||
|
||||
@@ -13,6 +13,13 @@ links = "tauri-plugin-autostart"
|
||||
rustc-args = ["--cfg", "docsrs"]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
|
||||
[package.metadata.platforms.support]
|
||||
windows = { level = "full", notes = "" }
|
||||
linux = { level = "full", notes = "" }
|
||||
macos = { level = "full", notes = "" }
|
||||
android = { level = "none", notes = "" }
|
||||
ios = { level = "none", notes = "" }
|
||||
|
||||
[build-dependencies]
|
||||
tauri-plugin = { workspace = true, features = ["build"] }
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ disable the automatic start on boot.
|
||||
- `allow-disable`
|
||||
- `allow-is-enabled`
|
||||
|
||||
## Permission Table
|
||||
## Permission Table
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
|
||||
@@ -14,6 +14,14 @@ rustc-args = ["--cfg", "docsrs"]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
targets = ["x86_64-linux-android"]
|
||||
|
||||
[package.metadata.platforms.support]
|
||||
windows = { level = "none", notes = "" }
|
||||
linux = { level = "none", notes = "" }
|
||||
macos = { level = "none", notes = "" }
|
||||
android = { level = "full", notes = "" }
|
||||
ios = { level = "full", notes = "" }
|
||||
|
||||
|
||||
[build-dependencies]
|
||||
tauri-plugin = { workspace = true, features = ["build"] }
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
if("__TAURI__"in window){var __TAURI_PLUGIN_BARCODE_SCANNER__=function(n){"use strict";async function e(n,e={},r){return window.__TAURI_INTERNALS__.invoke(n,e,r)}var r;return"function"==typeof SuppressedError&&SuppressedError,n.Format=void 0,(r=n.Format||(n.Format={})).QRCode="QR_CODE",r.UPC_A="UPC_A",r.UPC_E="UPC_E",r.EAN8="EAN_8",r.EAN13="EAN_13",r.Code39="CODE_39",r.Code93="CODE_93",r.Code128="CODE_128",r.Codabar="CODABAR",r.ITF="ITF",r.Aztec="AZTEC",r.DataMatrix="DATA_MATRIX",r.PDF417="PDF_417",n.cancel=async function(){await e("plugin:barcode-scanner|cancel")},n.checkPermissions=async function(){return await async function(n){return e(`plugin:${n}|request_permissions`)}("barcode-scanner").then((n=>n.camera))},n.openAppSettings=async function(){await e("plugin:barcode-scanner|open_app_settings")},n.requestPermissions=async function(){return await async function(n){return e(`plugin:${n}|check_permissions`)}("barcode-scanner").then((n=>n.camera))},n.scan=async function(n){return await e("plugin:barcode-scanner|scan",{...n})},n}({});Object.defineProperty(window.__TAURI__,"barcodeScanner",{value:__TAURI_PLUGIN_BARCODE_SCANNER__})}
|
||||
if("__TAURI__"in window){var __TAURI_PLUGIN_BARCODE_SCANNER__=function(n){"use strict";async function e(n,e={},r){return window.__TAURI_INTERNALS__.invoke(n,e,r)}var r;return"function"==typeof SuppressedError&&SuppressedError,n.Format=void 0,(r=n.Format||(n.Format={})).QRCode="QR_CODE",r.UPC_A="UPC_A",r.UPC_E="UPC_E",r.EAN8="EAN_8",r.EAN13="EAN_13",r.Code39="CODE_39",r.Code93="CODE_93",r.Code128="CODE_128",r.Codabar="CODABAR",r.ITF="ITF",r.Aztec="AZTEC",r.DataMatrix="DATA_MATRIX",r.PDF417="PDF_417",n.cancel=async function(){await e("plugin:barcode-scanner|cancel")},n.checkPermissions=async function(){return await async function(n){return e(`plugin:${n}|check_permissions`)}("barcode-scanner").then((n=>n.camera))},n.openAppSettings=async function(){await e("plugin:barcode-scanner|open_app_settings")},n.requestPermissions=async function(){return await async function(n){return e(`plugin:${n}|request_permissions`)}("barcode-scanner").then((n=>n.camera))},n.scan=async function(n){return await e("plugin:barcode-scanner|scan",{...n})},n}({});Object.defineProperty(window.__TAURI__,"barcodeScanner",{value:__TAURI_PLUGIN_BARCODE_SCANNER__})}
|
||||
|
||||
@@ -16,7 +16,7 @@ It allows all barcode related features.
|
||||
- `allow-scan`
|
||||
- `allow-vibrate`
|
||||
|
||||
## Permission Table
|
||||
## Permission Table
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
|
||||
@@ -13,6 +13,14 @@ rustc-args = ["--cfg", "docsrs"]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
targets = ["x86_64-linux-android"]
|
||||
|
||||
[package.metadata.platforms.support]
|
||||
windows = { level = "none", notes = "" }
|
||||
linux = { level = "none", notes = "" }
|
||||
macos = { level = "none", notes = "" }
|
||||
android = { level = "full", notes = "" }
|
||||
ios = { level = "full", notes = "" }
|
||||
|
||||
|
||||
[build-dependencies]
|
||||
tauri-plugin = { workspace = true, features = ["build"] }
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ It allows acccess to all biometric commands.
|
||||
- `allow-authenticate`
|
||||
- `allow-status`
|
||||
|
||||
## Permission Table
|
||||
## Permission Table
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
# Changelog
|
||||
|
||||
## \[2.0.0-rc.2]
|
||||
|
||||
- [`68579934`](https://github.com/tauri-apps/plugins-workspace/commit/68579934c93f6ed2edbc97474560d6a8a00e8f70) ([#1856](https://github.com/tauri-apps/plugins-workspace/pull/1856) by [@amrbashir](https://github.com/tauri-apps/plugins-workspace/../../amrbashir)) Expose `Matches`, `SubcommandMatches` and `ArgData` structs.
|
||||
|
||||
## \[2.0.0-rc.1]
|
||||
|
||||
- [`e2e97db5`](https://github.com/tauri-apps/plugins-workspace/commit/e2e97db51983267f5be84d4f6f0278d58834d1f5) ([#1701](https://github.com/tauri-apps/plugins-workspace/pull/1701) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri 2.0.0-rc.8
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "tauri-plugin-cli"
|
||||
version = "2.0.0-rc.1"
|
||||
version = "2.0.0-rc.2"
|
||||
description = "Parse arguments from your Tauri application's command line interface."
|
||||
edition = { workspace = true }
|
||||
authors = { workspace = true }
|
||||
@@ -13,6 +13,14 @@ links = "tauri-plugin-cli"
|
||||
rustc-args = ["--cfg", "docsrs"]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
|
||||
[package.metadata.platforms.support]
|
||||
windows = { level = "full", notes = "" }
|
||||
linux = { level = "full", notes = "" }
|
||||
macos = { level = "full", notes = "" }
|
||||
android = { level = "none", notes = "" }
|
||||
ios = { level = "none", notes = "" }
|
||||
|
||||
|
||||
[build-dependencies]
|
||||
tauri-plugin = { workspace = true, features = ["build"] }
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ Allows reading the CLI matches
|
||||
|
||||
- `allow-cli-matches`
|
||||
|
||||
## Permission Table
|
||||
## Permission Table
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
|
||||
@@ -18,3 +18,5 @@ impl Serialize for Error {
|
||||
serializer.serialize_str(self.to_string().as_ref())
|
||||
}
|
||||
}
|
||||
|
||||
pub type Result<T> = std::result::Result<T, Error>;
|
||||
|
||||
@@ -23,8 +23,9 @@ mod error;
|
||||
mod parser;
|
||||
|
||||
use config::{Arg, Config};
|
||||
pub use error::Error;
|
||||
type Result<T> = std::result::Result<T, Error>;
|
||||
|
||||
pub use error::{Error, Result};
|
||||
pub use parser::{ArgData, Matches, SubcommandMatches};
|
||||
|
||||
pub struct Cli<R: Runtime>(PluginApi<R, Config>);
|
||||
|
||||
|
||||
@@ -14,6 +14,14 @@ rustc-args = ["--cfg", "docsrs"]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
targets = ["x86_64-unknown-linux-gnu", "x86_64-linux-android"]
|
||||
|
||||
[package.metadata.platforms.support]
|
||||
windows = { level = "full", notes = "" }
|
||||
linux = { level = "full", notes = "" }
|
||||
macos = { level = "full", notes = "" }
|
||||
android = { level = "partial", notes = "Only plain-text content support" }
|
||||
ios = { level = "partial", notes = "Only plain-text content support" }
|
||||
|
||||
|
||||
[build-dependencies]
|
||||
tauri-plugin = { workspace = true, features = ["build"] }
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ Clipboard interaction needs to be explicitly enabled.
|
||||
|
||||
|
||||
|
||||
## Permission Table
|
||||
## Permission Table
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
# Changelog
|
||||
|
||||
## \[2.0.0-rc.7]
|
||||
|
||||
- [`3168e176`](https://github.com/tauri-apps/plugins-workspace/commit/3168e176031a61215be542595ba90ca51f8f2d97) ([#1806](https://github.com/tauri-apps/plugins-workspace/pull/1806) by [@auggiebennett](https://github.com/tauri-apps/plugins-workspace/../../auggiebennett)) Fix fails to start when having spaces in the main binary path on Windows
|
||||
|
||||
## \[2.0.0-rc.6]
|
||||
|
||||
- [`6f3f6679`](https://github.com/tauri-apps/plugins-workspace/commit/6f3f66794a87ef9d1c16667c425d5ad7091a9c2f) ([#1780](https://github.com/tauri-apps/plugins-workspace/pull/1780)) Added `DeepLink::on_open_url` function to match the JavaScript API implementation,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "tauri-plugin-deep-link"
|
||||
version = "2.0.0-rc.6"
|
||||
version = "2.0.0-rc.7"
|
||||
description = "Set your Tauri application as the default handler for an URL"
|
||||
authors = { workspace = true }
|
||||
license = { workspace = true }
|
||||
@@ -14,6 +14,13 @@ rustc-args = ["--cfg", "docsrs"]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
targets = ["x86_64-linux-android"]
|
||||
|
||||
[package.metadata.platforms.support]
|
||||
windows = { level = "full", notes = "" }
|
||||
linux = { level = "full", notes = "" }
|
||||
macos = { level = "partial", notes = "Runtime deep link registration is not supported" }
|
||||
android = { level = "partial", notes = "Runtime deep link registration is not supported" }
|
||||
ios = { level = "partial", notes = "Runtime deep link registration is not supported" }
|
||||
|
||||
[build-dependencies]
|
||||
serde = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
@@ -31,7 +38,7 @@ url = { workspace = true }
|
||||
|
||||
[target."cfg(windows)".dependencies]
|
||||
dunce = "1"
|
||||
windows-registry = "0.2"
|
||||
windows-registry = "0.3"
|
||||
windows-result = "0.2"
|
||||
|
||||
[target."cfg(target_os = \"linux\")".dependencies]
|
||||
|
||||
@@ -10,12 +10,12 @@
|
||||
"tauri": "tauri"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "2.0.0-rc.4",
|
||||
"@tauri-apps/api": "2.0.0-rc.6",
|
||||
"@tauri-apps/plugin-deep-link": "2.0.0-rc.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tauri-apps/cli": "2.0.0-rc.15",
|
||||
"@tauri-apps/cli": "2.0.0-rc.17",
|
||||
"typescript": "^5.2.2",
|
||||
"vite": "^5.0.13"
|
||||
"vite": "^5.4.7"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ Allows reading the opened deep link via the get_current command
|
||||
|
||||
- `allow-get-current`
|
||||
|
||||
## Permission Table
|
||||
## Permission Table
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
|
||||
@@ -274,11 +274,11 @@ mod imp {
|
||||
key_reg.set_string("URL Protocol", "")?;
|
||||
|
||||
let icon_reg = CURRENT_USER.create(format!("{key_base}\\DefaultIcon"))?;
|
||||
icon_reg.set_string("", &format!("{},0", &exe))?;
|
||||
icon_reg.set_string("", &format!("{exe},0"))?;
|
||||
|
||||
let cmd_reg = CURRENT_USER.create(format!("{key_base}\\shell\\open\\command"))?;
|
||||
|
||||
cmd_reg.set_string("", &format!("{} \"%1\"", &exe))?;
|
||||
cmd_reg.set_string("", &format!("\"{exe}\" \"%1\""))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -408,13 +408,13 @@ mod imp {
|
||||
_protocol.as_ref()
|
||||
))?;
|
||||
|
||||
let registered_cmd: String = cmd_reg.get_string("")?;
|
||||
let registered_cmd = cmd_reg.get_string("")?;
|
||||
|
||||
let exe = dunce::simplified(&tauri::utils::platform::current_exe()?)
|
||||
.display()
|
||||
.to_string();
|
||||
|
||||
Ok(registered_cmd == format!("{} \"%1\"", &exe))
|
||||
Ok(registered_cmd == format!("\"{exe}\" \"%1\""))
|
||||
}
|
||||
#[cfg(target_os = "linux")]
|
||||
{
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
# Changelog
|
||||
|
||||
## \[2.0.0-rc.8]
|
||||
|
||||
- [`6bf1bd8d`](https://github.com/tauri-apps/plugins-workspace/commit/6bf1bd8d44bb95618590aa066e638509b014e0f9) ([#1805](https://github.com/tauri-apps/plugins-workspace/pull/1805) by [@renovate](https://github.com/tauri-apps/plugins-workspace/../../renovate)) Update rfd to 0.15
|
||||
|
||||
### Dependencies
|
||||
|
||||
- Upgraded to `fs@2.0.0-rc.6`
|
||||
|
||||
### breaking
|
||||
|
||||
- [`04459afb`](https://github.com/tauri-apps/plugins-workspace/commit/04459afbb67aafa5cd57e6a148c2beb0a8d3e04a) ([#1842](https://github.com/tauri-apps/plugins-workspace/pull/1842) by [@Legend-Master](https://github.com/tauri-apps/plugins-workspace/../../Legend-Master)) Changed `MessageDialogBuilder::ok_button_label` and `MessageDialogBuilder::cancel_button_label` to `MessageDialogBuilder::buttons` which takes an enum now
|
||||
|
||||
## \[2.0.0-rc.7]
|
||||
|
||||
### Dependencies
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "tauri-plugin-dialog"
|
||||
version = "2.0.0-rc.7"
|
||||
version = "2.0.0-rc.8"
|
||||
description = "Native system dialogs for opening and saving files along with message dialogs on your Tauri application."
|
||||
edition = { workspace = true }
|
||||
authors = { workspace = true }
|
||||
@@ -14,6 +14,13 @@ rustc-args = ["--cfg", "docsrs"]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
targets = ["x86_64-unknown-linux-gnu", "x86_64-linux-android"]
|
||||
|
||||
[package.metadata.platforms.support]
|
||||
windows = { level = "full", notes = "" }
|
||||
linux = { level = "full", notes = "" }
|
||||
macos = { level = "full", notes = "" }
|
||||
android = { level = "partial", notes = "Does not support folder picker" }
|
||||
ios = { level = "partial", notes = "Does not support folder picker" }
|
||||
|
||||
[build-dependencies]
|
||||
tauri-plugin = { workspace = true, features = ["build"] }
|
||||
|
||||
@@ -27,13 +34,13 @@ tauri = { workspace = true }
|
||||
log = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
url = { workspace = true }
|
||||
tauri-plugin-fs = { path = "../fs", version = "2.0.0-rc.5" }
|
||||
tauri-plugin-fs = { path = "../fs", version = "2.0.0-rc.6" }
|
||||
|
||||
[target.'cfg(target_os = "ios")'.dependencies]
|
||||
tauri = { workspace = true, features = ["wry"] }
|
||||
|
||||
[target."cfg(any(target_os = \"macos\", windows, target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies]
|
||||
rfd = { version = "0.14", default-features = false, features = [
|
||||
rfd = { version = "0.15", default-features = false, features = [
|
||||
"tokio",
|
||||
"gtk3",
|
||||
"common-controls-v6",
|
||||
|
||||
@@ -16,7 +16,7 @@ All dialog types are enabled.
|
||||
- `allow-save`
|
||||
- `allow-open`
|
||||
|
||||
## Permission Table
|
||||
## Permission Table
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
|
||||
@@ -8,7 +8,10 @@ use serde::{Deserialize, Serialize};
|
||||
use tauri::{command, Manager, Runtime, State, Window};
|
||||
use tauri_plugin_fs::FsExt;
|
||||
|
||||
use crate::{Dialog, FileDialogBuilder, FilePath, MessageDialogKind, Result};
|
||||
use crate::{
|
||||
Dialog, FileDialogBuilder, FilePath, MessageDialogButtons, MessageDialogKind, Result, CANCEL,
|
||||
OK,
|
||||
};
|
||||
|
||||
#[derive(Serialize)]
|
||||
#[serde(untagged)]
|
||||
@@ -205,7 +208,7 @@ pub(crate) async fn save<R: Runtime>(
|
||||
options: SaveDialogOptions,
|
||||
) -> Result<Option<FilePath>> {
|
||||
let mut dialog_builder = dialog.file();
|
||||
#[cfg(any(windows, target_os = "macos"))]
|
||||
#[cfg(desktop)]
|
||||
{
|
||||
dialog_builder = dialog_builder.set_parent(&window);
|
||||
}
|
||||
@@ -244,16 +247,17 @@ fn message_dialog<R: Runtime>(
|
||||
title: Option<String>,
|
||||
message: String,
|
||||
kind: Option<MessageDialogKind>,
|
||||
ok_button_label: Option<String>,
|
||||
cancel_button_label: Option<String>,
|
||||
buttons: MessageDialogButtons,
|
||||
) -> bool {
|
||||
let mut builder = dialog.message(message);
|
||||
|
||||
builder = builder.buttons(buttons);
|
||||
|
||||
if let Some(title) = title {
|
||||
builder = builder.title(title);
|
||||
}
|
||||
|
||||
#[cfg(any(windows, target_os = "macos"))]
|
||||
#[cfg(desktop)]
|
||||
{
|
||||
builder = builder.parent(&window);
|
||||
}
|
||||
@@ -262,14 +266,6 @@ fn message_dialog<R: Runtime>(
|
||||
builder = builder.kind(kind);
|
||||
}
|
||||
|
||||
if let Some(ok) = ok_button_label {
|
||||
builder = builder.ok_button_label(ok);
|
||||
}
|
||||
|
||||
if let Some(cancel) = cancel_button_label {
|
||||
builder = builder.cancel_button_label(cancel);
|
||||
}
|
||||
|
||||
builder.blocking_show()
|
||||
}
|
||||
|
||||
@@ -288,8 +284,11 @@ pub(crate) async fn message<R: Runtime>(
|
||||
title,
|
||||
message,
|
||||
kind,
|
||||
ok_button_label,
|
||||
None,
|
||||
if let Some(ok_button_label) = ok_button_label {
|
||||
MessageDialogButtons::OkCustom(ok_button_label)
|
||||
} else {
|
||||
MessageDialogButtons::Ok
|
||||
},
|
||||
))
|
||||
}
|
||||
|
||||
@@ -309,8 +308,7 @@ pub(crate) async fn ask<R: Runtime>(
|
||||
title,
|
||||
message,
|
||||
kind,
|
||||
Some(ok_button_label.unwrap_or_else(|| "Yes".into())),
|
||||
Some(cancel_button_label.unwrap_or_else(|| "No".into())),
|
||||
get_ok_cancel_type(ok_button_label, cancel_button_label),
|
||||
))
|
||||
}
|
||||
|
||||
@@ -330,7 +328,22 @@ pub(crate) async fn confirm<R: Runtime>(
|
||||
title,
|
||||
message,
|
||||
kind,
|
||||
Some(ok_button_label.unwrap_or_else(|| "Ok".into())),
|
||||
Some(cancel_button_label.unwrap_or_else(|| "Cancel".into())),
|
||||
get_ok_cancel_type(ok_button_label, cancel_button_label),
|
||||
))
|
||||
}
|
||||
|
||||
fn get_ok_cancel_type(
|
||||
ok_button_label: Option<String>,
|
||||
cancel_button_label: Option<String>,
|
||||
) -> MessageDialogButtons {
|
||||
if let Some(ok_button_label) = ok_button_label {
|
||||
MessageDialogButtons::OkCancelCustom(
|
||||
ok_button_label,
|
||||
cancel_button_label.unwrap_or(CANCEL.to_string()),
|
||||
)
|
||||
} else if let Some(cancel_button_label) = cancel_button_label {
|
||||
MessageDialogButtons::OkCancelCustom(OK.to_string(), cancel_button_label)
|
||||
} else {
|
||||
MessageDialogButtons::OkCancel
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,14 +8,12 @@
|
||||
//! to give results back. This is particularly useful when running dialogs from the main thread.
|
||||
//! When using on asynchronous contexts such as async commands, the [`blocking`] APIs are recommended.
|
||||
|
||||
use raw_window_handle::{HasWindowHandle, RawWindowHandle};
|
||||
use raw_window_handle::{HasDisplayHandle, HasWindowHandle, RawDisplayHandle, RawWindowHandle};
|
||||
use rfd::{AsyncFileDialog, AsyncMessageDialog};
|
||||
use serde::de::DeserializeOwned;
|
||||
use tauri::{plugin::PluginApi, AppHandle, Runtime};
|
||||
|
||||
use crate::{models::*, FileDialogBuilder, FilePath, MessageDialogBuilder};
|
||||
|
||||
const OK: &str = "Ok";
|
||||
use crate::{models::*, FileDialogBuilder, FilePath, MessageDialogBuilder, OK};
|
||||
|
||||
pub fn init<R: Runtime, C: DeserializeOwned>(
|
||||
app: &AppHandle<R>,
|
||||
@@ -50,13 +48,34 @@ impl From<MessageDialogKind> for rfd::MessageLevel {
|
||||
}
|
||||
}
|
||||
|
||||
struct WindowHandle(RawWindowHandle);
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct WindowHandle {
|
||||
window_handle: RawWindowHandle,
|
||||
display_handle: RawDisplayHandle,
|
||||
}
|
||||
|
||||
impl WindowHandle {
|
||||
pub(crate) fn new(window_handle: RawWindowHandle, display_handle: RawDisplayHandle) -> Self {
|
||||
Self {
|
||||
window_handle,
|
||||
display_handle,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl HasWindowHandle for WindowHandle {
|
||||
fn window_handle(
|
||||
&self,
|
||||
) -> Result<raw_window_handle::WindowHandle<'_>, raw_window_handle::HandleError> {
|
||||
Ok(unsafe { raw_window_handle::WindowHandle::borrow_raw(self.0) })
|
||||
Ok(unsafe { raw_window_handle::WindowHandle::borrow_raw(self.window_handle) })
|
||||
}
|
||||
}
|
||||
|
||||
impl HasDisplayHandle for WindowHandle {
|
||||
fn display_handle(
|
||||
&self,
|
||||
) -> Result<raw_window_handle::DisplayHandle<'_>, raw_window_handle::HandleError> {
|
||||
Ok(unsafe { raw_window_handle::DisplayHandle::borrow_raw(self.display_handle) })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +98,7 @@ impl<R: Runtime> From<FileDialogBuilder<R>> for AsyncFileDialog {
|
||||
}
|
||||
#[cfg(desktop)]
|
||||
if let Some(parent) = d.parent {
|
||||
builder = builder.set_parent(&WindowHandle(parent));
|
||||
builder = builder.set_parent(&parent);
|
||||
}
|
||||
|
||||
builder = builder.set_can_create_directories(d.can_create_directories.unwrap_or(true));
|
||||
@@ -88,25 +107,27 @@ impl<R: Runtime> From<FileDialogBuilder<R>> for AsyncFileDialog {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<MessageDialogButtons> for rfd::MessageButtons {
|
||||
fn from(value: MessageDialogButtons) -> Self {
|
||||
match value {
|
||||
MessageDialogButtons::Ok => Self::Ok,
|
||||
MessageDialogButtons::OkCancel => Self::OkCancel,
|
||||
MessageDialogButtons::OkCustom(ok) => Self::OkCustom(ok),
|
||||
MessageDialogButtons::OkCancelCustom(ok, cancel) => Self::OkCancelCustom(ok, cancel),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<R: Runtime> From<MessageDialogBuilder<R>> for AsyncMessageDialog {
|
||||
fn from(d: MessageDialogBuilder<R>) -> Self {
|
||||
let mut dialog = AsyncMessageDialog::new()
|
||||
.set_title(&d.title)
|
||||
.set_description(&d.message)
|
||||
.set_level(d.kind.into());
|
||||
|
||||
let buttons = match (d.ok_button_label, d.cancel_button_label) {
|
||||
(Some(ok), Some(cancel)) => Some(rfd::MessageButtons::OkCancelCustom(ok, cancel)),
|
||||
(Some(ok), None) => Some(rfd::MessageButtons::OkCustom(ok)),
|
||||
(None, Some(cancel)) => Some(rfd::MessageButtons::OkCancelCustom(OK.into(), cancel)),
|
||||
(None, None) => None,
|
||||
};
|
||||
if let Some(buttons) = buttons {
|
||||
dialog = dialog.set_buttons(buttons);
|
||||
}
|
||||
.set_level(d.kind.into())
|
||||
.set_buttons(d.buttons.into());
|
||||
|
||||
if let Some(parent) = d.parent {
|
||||
dialog = dialog.set_parent(&WindowHandle(parent));
|
||||
dialog = dialog.set_parent(&parent);
|
||||
}
|
||||
|
||||
dialog
|
||||
@@ -192,7 +213,11 @@ pub fn show_message_dialog<R: Runtime, F: FnOnce(bool) + Send + 'static>(
|
||||
) {
|
||||
use rfd::MessageDialogResult;
|
||||
|
||||
let ok_label = dialog.ok_button_label.clone();
|
||||
let ok_label = match &dialog.buttons {
|
||||
MessageDialogButtons::OkCustom(ok) => Some(ok.clone()),
|
||||
MessageDialogButtons::OkCancelCustom(ok, _) => Some(ok.clone()),
|
||||
_ => None,
|
||||
};
|
||||
let f = move |res| {
|
||||
f(match res {
|
||||
MessageDialogResult::Ok | MessageDialogResult::Yes => true,
|
||||
|
||||
+52
-37
@@ -41,6 +41,9 @@ use desktop::*;
|
||||
#[cfg(mobile)]
|
||||
use mobile::*;
|
||||
|
||||
pub(crate) const OK: &str = "Ok";
|
||||
pub(crate) const CANCEL: &str = "Cancel";
|
||||
|
||||
macro_rules! blocking_fn {
|
||||
($self:ident, $fn:ident) => {{
|
||||
let (tx, rx) = sync_channel(0);
|
||||
@@ -89,14 +92,13 @@ impl<R: Runtime> Dialog<R> {
|
||||
/// - Ask dialog:
|
||||
///
|
||||
/// ```
|
||||
/// use tauri_plugin_dialog::DialogExt;
|
||||
/// use tauri_plugin_dialog::{DialogExt, MessageDialogButtons};
|
||||
///
|
||||
/// tauri::Builder::default()
|
||||
/// .setup(|app| {
|
||||
/// app.dialog()
|
||||
/// .message("Are you sure?")
|
||||
/// .ok_button_label("Yes")
|
||||
/// .cancel_button_label("No")
|
||||
/// .buttons(MessageDialogButtons::OkCancelCustom("Yes", "No"))
|
||||
/// .show(|yes| {
|
||||
/// println!("user said {}", if yes { "yes" } else { "no" });
|
||||
/// });
|
||||
@@ -107,13 +109,13 @@ impl<R: Runtime> Dialog<R> {
|
||||
/// - Message dialog with OK button:
|
||||
///
|
||||
/// ```
|
||||
/// use tauri_plugin_dialog::DialogExt;
|
||||
/// use tauri_plugin_dialog::{DialogExt, MessageDialogButtons};
|
||||
///
|
||||
/// tauri::Builder::default()
|
||||
/// .setup(|app| {
|
||||
/// app.dialog()
|
||||
/// .message("Job completed successfully")
|
||||
/// .ok_button_label("Ok")
|
||||
/// .buttons(MessageDialogButtons::Ok)
|
||||
/// .show(|_| {
|
||||
/// println!("dialog closed");
|
||||
/// });
|
||||
@@ -129,7 +131,7 @@ impl<R: Runtime> Dialog<R> {
|
||||
/// but note that it cannot be executed on the main thread as it will freeze your application.
|
||||
///
|
||||
/// ```
|
||||
/// use tauri_plugin_dialog::DialogExt;
|
||||
/// use tauri_plugin_dialog::{DialogExt, MessageDialogButtons};
|
||||
///
|
||||
/// tauri::Builder::default()
|
||||
/// .setup(|app| {
|
||||
@@ -137,8 +139,7 @@ impl<R: Runtime> Dialog<R> {
|
||||
/// std::thread::spawn(move || {
|
||||
/// let yes = handle.dialog()
|
||||
/// .message("Are you sure?")
|
||||
/// .ok_button_label("Yes")
|
||||
/// .cancel_button_label("No")
|
||||
/// .buttons(MessageDialogButtons::OkCancelCustom("Yes", "No"))
|
||||
/// .blocking_show();
|
||||
/// });
|
||||
///
|
||||
@@ -196,10 +197,9 @@ pub struct MessageDialogBuilder<R: Runtime> {
|
||||
pub(crate) title: String,
|
||||
pub(crate) message: String,
|
||||
pub(crate) kind: MessageDialogKind,
|
||||
pub(crate) ok_button_label: Option<String>,
|
||||
pub(crate) cancel_button_label: Option<String>,
|
||||
pub(crate) buttons: MessageDialogButtons,
|
||||
#[cfg(desktop)]
|
||||
pub(crate) parent: Option<raw_window_handle::RawWindowHandle>,
|
||||
pub(crate) parent: Option<crate::desktop::WindowHandle>,
|
||||
}
|
||||
|
||||
/// Payload for the message dialog mobile API.
|
||||
@@ -210,8 +210,8 @@ pub(crate) struct MessageDialogPayload<'a> {
|
||||
title: &'a String,
|
||||
message: &'a String,
|
||||
kind: &'a MessageDialogKind,
|
||||
ok_button_label: &'a Option<String>,
|
||||
cancel_button_label: &'a Option<String>,
|
||||
ok_button_label: Option<&'a str>,
|
||||
cancel_button_label: Option<&'a str>,
|
||||
}
|
||||
|
||||
// raw window handle :(
|
||||
@@ -225,8 +225,7 @@ impl<R: Runtime> MessageDialogBuilder<R> {
|
||||
title: title.into(),
|
||||
message: message.into(),
|
||||
kind: Default::default(),
|
||||
ok_button_label: None,
|
||||
cancel_button_label: None,
|
||||
buttons: Default::default(),
|
||||
#[cfg(desktop)]
|
||||
parent: None,
|
||||
}
|
||||
@@ -234,12 +233,20 @@ impl<R: Runtime> MessageDialogBuilder<R> {
|
||||
|
||||
#[cfg(mobile)]
|
||||
pub(crate) fn payload(&self) -> MessageDialogPayload<'_> {
|
||||
let (ok_button_label, cancel_button_label) = match &self.buttons {
|
||||
MessageDialogButtons::Ok => (Some(OK), None),
|
||||
MessageDialogButtons::OkCancel => (Some(OK), Some(CANCEL)),
|
||||
MessageDialogButtons::OkCustom(ok) => (Some(ok.as_str()), Some(CANCEL)),
|
||||
MessageDialogButtons::OkCancelCustom(ok, cancel) => {
|
||||
(Some(ok.as_str()), Some(cancel.as_str()))
|
||||
}
|
||||
};
|
||||
MessageDialogPayload {
|
||||
title: &self.title,
|
||||
message: &self.message,
|
||||
kind: &self.kind,
|
||||
ok_button_label: &self.ok_button_label,
|
||||
cancel_button_label: &self.cancel_button_label,
|
||||
ok_button_label,
|
||||
cancel_button_label,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -250,27 +257,25 @@ impl<R: Runtime> MessageDialogBuilder<R> {
|
||||
}
|
||||
|
||||
/// Set parent windows explicitly (optional)
|
||||
///
|
||||
/// ## Platform-specific
|
||||
///
|
||||
/// - **Linux:** Unsupported.
|
||||
#[cfg(desktop)]
|
||||
pub fn parent<W: raw_window_handle::HasWindowHandle>(mut self, parent: &W) -> Self {
|
||||
if let Ok(h) = parent.window_handle() {
|
||||
self.parent.replace(h.as_raw());
|
||||
pub fn parent<W: raw_window_handle::HasWindowHandle + raw_window_handle::HasDisplayHandle>(
|
||||
mut self,
|
||||
parent: &W,
|
||||
) -> Self {
|
||||
if let (Ok(window_handle), Ok(display_handle)) =
|
||||
(parent.window_handle(), parent.display_handle())
|
||||
{
|
||||
self.parent.replace(crate::desktop::WindowHandle::new(
|
||||
window_handle.as_raw(),
|
||||
display_handle.as_raw(),
|
||||
));
|
||||
}
|
||||
self
|
||||
}
|
||||
|
||||
/// Sets the label for the OK button.
|
||||
pub fn ok_button_label(mut self, label: impl Into<String>) -> Self {
|
||||
self.ok_button_label.replace(label.into());
|
||||
self
|
||||
}
|
||||
|
||||
/// Sets the label for the Cancel button.
|
||||
pub fn cancel_button_label(mut self, label: impl Into<String>) -> Self {
|
||||
self.cancel_button_label.replace(label.into());
|
||||
/// Sets the dialog buttons.
|
||||
pub fn buttons(mut self, buttons: MessageDialogButtons) -> Self {
|
||||
self.buttons = buttons;
|
||||
self
|
||||
}
|
||||
|
||||
@@ -314,7 +319,7 @@ pub struct FileDialogBuilder<R: Runtime> {
|
||||
pub(crate) title: Option<String>,
|
||||
pub(crate) can_create_directories: Option<bool>,
|
||||
#[cfg(desktop)]
|
||||
pub(crate) parent: Option<raw_window_handle::RawWindowHandle>,
|
||||
pub(crate) parent: Option<crate::desktop::WindowHandle>,
|
||||
}
|
||||
|
||||
#[cfg(mobile)]
|
||||
@@ -380,9 +385,19 @@ impl<R: Runtime> FileDialogBuilder<R> {
|
||||
/// Sets the parent window of the dialog.
|
||||
#[cfg(desktop)]
|
||||
#[must_use]
|
||||
pub fn set_parent<W: raw_window_handle::HasWindowHandle>(mut self, parent: &W) -> Self {
|
||||
if let Ok(h) = parent.window_handle() {
|
||||
self.parent.replace(h.as_raw());
|
||||
pub fn set_parent<
|
||||
W: raw_window_handle::HasWindowHandle + raw_window_handle::HasDisplayHandle,
|
||||
>(
|
||||
mut self,
|
||||
parent: &W,
|
||||
) -> Self {
|
||||
if let (Ok(window_handle), Ok(display_handle)) =
|
||||
(parent.window_handle(), parent.display_handle())
|
||||
{
|
||||
self.parent.replace(crate::desktop::WindowHandle::new(
|
||||
window_handle.as_raw(),
|
||||
display_handle.as_raw(),
|
||||
));
|
||||
}
|
||||
self
|
||||
}
|
||||
|
||||
@@ -49,3 +49,18 @@ impl Serialize for MessageDialogKind {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Set of button that will be displayed on the dialog
|
||||
#[non_exhaustive]
|
||||
#[derive(Debug, Default, Clone)]
|
||||
pub enum MessageDialogButtons {
|
||||
#[default]
|
||||
/// A single `Ok` button with OS default dialog text
|
||||
Ok,
|
||||
/// 2 buttons `Ok` and `Cancel` with OS default dialog texts
|
||||
OkCancel,
|
||||
/// A single `Ok` button with custom text
|
||||
OkCustom(String),
|
||||
/// 2 buttons `Ok` and `Cancel` with custom texts
|
||||
OkCancelCustom(String, String),
|
||||
}
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
# Changelog
|
||||
|
||||
## \[2.0.0-rc.6]
|
||||
|
||||
- [`fc9b189e`](https://github.com/tauri-apps/plugins-workspace/commit/fc9b189e83a29bd750714ec6336133c6eabdfa20) ([#1837](https://github.com/tauri-apps/plugins-workspace/pull/1837) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Fix failing to deserialize capability file when using an OS specific path in the scope that is not available on the current OS.
|
||||
|
||||
## \[2.0.0-rc.5]
|
||||
|
||||
- [`cc03ccf5`](https://github.com/tauri-apps/plugins-workspace/commit/cc03ccf5e0e4be8bbf50bbdebe957c84be7f779b) ([#1774](https://github.com/tauri-apps/plugins-workspace/pull/1774)) Fix `scope-app`, `scope-app-recursive` and `scope-index` not properly enabling the application paths.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "tauri-plugin-fs"
|
||||
version = "2.0.0-rc.5"
|
||||
version = "2.0.0-rc.6"
|
||||
description = "Access the file system."
|
||||
authors = { workspace = true }
|
||||
license = { workspace = true }
|
||||
@@ -13,6 +13,13 @@ links = "tauri-plugin-fs"
|
||||
rustc-args = ["--cfg", "docsrs"]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
|
||||
[package.metadata.platforms.support]
|
||||
windows = { level = "full", notes = "" }
|
||||
linux = { level = "full", notes = "No write access to `$RESOURCES` folder" }
|
||||
macos = { level = "full", notes = "No write access to `$RESOURCES` folder" }
|
||||
android = { level = "partial", notes = "Access is restricted to Application folder by default" }
|
||||
ios = { level = "partial", notes = "Access is restricted to Application folder by default" }
|
||||
|
||||
[build-dependencies]
|
||||
tauri-plugin = { workspace = true, features = ["build"] }
|
||||
schemars = { workspace = true }
|
||||
|
||||
+10
-8
@@ -24,14 +24,16 @@ enum FsScopeEntry {
|
||||
},
|
||||
}
|
||||
|
||||
// Ensure scope entry is kept up to date
|
||||
impl From<FsScopeEntry> for scope::EntryRaw {
|
||||
fn from(value: FsScopeEntry) -> Self {
|
||||
match value {
|
||||
FsScopeEntry::Value(path) => scope::EntryRaw::Value(path),
|
||||
FsScopeEntry::Object { path } => scope::EntryRaw::Object { path },
|
||||
}
|
||||
}
|
||||
// Ensure `FsScopeEntry` and `scope::EntryRaw` is kept in sync
|
||||
fn _f() {
|
||||
match scope::EntryRaw::Value(PathBuf::new()) {
|
||||
scope::EntryRaw::Value(path) => FsScopeEntry::Value(path),
|
||||
scope::EntryRaw::Object { path } => FsScopeEntry::Object { path },
|
||||
};
|
||||
match FsScopeEntry::Value(PathBuf::new()) {
|
||||
FsScopeEntry::Value(path) => scope::EntryRaw::Value(path),
|
||||
FsScopeEntry::Object { path } => scope::EntryRaw::Object { path },
|
||||
};
|
||||
}
|
||||
|
||||
const BASE_DIR_VARS: &[&str] = &[
|
||||
|
||||
@@ -30,7 +30,7 @@ On Windows the webview data folder access is denied.
|
||||
- `read-app-specific-dirs-recursive`
|
||||
- `deny-default`
|
||||
|
||||
## Permission Table
|
||||
## Permission Table
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
|
||||
@@ -993,8 +993,8 @@ pub fn resolve_path<R: Runtime>(
|
||||
.unwrap()
|
||||
.clone()
|
||||
.into_iter()
|
||||
.chain(global_scope.allows().iter().map(|e| e.path.clone()))
|
||||
.chain(command_scope.allows().iter().map(|e| e.path.clone()))
|
||||
.chain(global_scope.allows().iter().filter_map(|e| e.path.clone()))
|
||||
.chain(command_scope.allows().iter().filter_map(|e| e.path.clone()))
|
||||
.collect(),
|
||||
deny: webview
|
||||
.fs_scope()
|
||||
@@ -1003,8 +1003,8 @@ pub fn resolve_path<R: Runtime>(
|
||||
.unwrap()
|
||||
.clone()
|
||||
.into_iter()
|
||||
.chain(global_scope.denies().iter().map(|e| e.path.clone()))
|
||||
.chain(command_scope.denies().iter().map(|e| e.path.clone()))
|
||||
.chain(global_scope.denies().iter().filter_map(|e| e.path.clone()))
|
||||
.chain(command_scope.denies().iter().filter_map(|e| e.path.clone()))
|
||||
.collect(),
|
||||
require_literal_leading_dot: webview.fs_scope().require_literal_leading_dot,
|
||||
},
|
||||
|
||||
@@ -35,7 +35,7 @@ pub enum SafeFilePath {
|
||||
}
|
||||
|
||||
impl FilePath {
|
||||
/// Get a reference to the contaiend [`Path`] if the variant is [`FilePath::Path`].
|
||||
/// Get a reference to the contained [`Path`] if the variant is [`FilePath::Path`].
|
||||
///
|
||||
/// Use [`FilePath::into_path`] to try to convert the [`FilePath::Url`] variant as well.
|
||||
#[inline]
|
||||
@@ -73,7 +73,7 @@ impl FilePath {
|
||||
}
|
||||
|
||||
impl SafeFilePath {
|
||||
/// Get a reference to the contaiend [`Path`] if the variant is [`SafeFilePath::Path`].
|
||||
/// Get a reference to the contained [`Path`] if the variant is [`SafeFilePath::Path`].
|
||||
///
|
||||
/// Use [`SafeFilePath::into_path`] to try to convert the [`SafeFilePath::Url`] variant as well.
|
||||
#[inline]
|
||||
|
||||
@@ -353,17 +353,17 @@ impl ScopeObject for scope::Entry {
|
||||
app: &AppHandle<R>,
|
||||
raw: Value,
|
||||
) -> std::result::Result<Self, Self::Error> {
|
||||
let entry = serde_json::from_value(raw.into()).map(|raw| {
|
||||
let path = match raw {
|
||||
scope::EntryRaw::Value(path) => path,
|
||||
scope::EntryRaw::Object { path } => path,
|
||||
};
|
||||
Self { path }
|
||||
let path = serde_json::from_value(raw.into()).map(|raw| match raw {
|
||||
scope::EntryRaw::Value(path) => path,
|
||||
scope::EntryRaw::Object { path } => path,
|
||||
})?;
|
||||
|
||||
Ok(Self {
|
||||
path: app.path().parse(entry.path)?,
|
||||
})
|
||||
match app.path().parse(path) {
|
||||
Ok(path) => Ok(Self { path: Some(path) }),
|
||||
#[cfg(not(target_os = "android"))]
|
||||
Err(tauri::Error::UnknownPath) => Ok(Self { path: None }),
|
||||
Err(err) => Err(err.into()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,17 +13,16 @@ use std::{
|
||||
|
||||
use serde::Deserialize;
|
||||
|
||||
#[doc(hidden)]
|
||||
#[derive(Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum EntryRaw {
|
||||
pub(crate) enum EntryRaw {
|
||||
Value(PathBuf),
|
||||
Object { path: PathBuf },
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Entry {
|
||||
pub path: PathBuf,
|
||||
pub path: Option<PathBuf>,
|
||||
}
|
||||
|
||||
pub type EventId = u32;
|
||||
|
||||
@@ -13,6 +13,13 @@ rustc-args = ["--cfg", "docsrs"]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
targets = ["x86_64-linux-android"]
|
||||
|
||||
[package.metadata.platforms.support]
|
||||
windows = { level = "none", notes = "" }
|
||||
linux = { level = "none", notes = "" }
|
||||
macos = { level = "none", notes = "" }
|
||||
android = { level = "full", notes = "" }
|
||||
ios = { level = "full", notes = "" }
|
||||
|
||||
[build-dependencies]
|
||||
tauri-plugin = { workspace = true, features = ["build"] }
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
## Permission Table
|
||||
## Permission Table
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
|
||||
@@ -13,6 +13,13 @@ links = "tauri-plugin-global-shortcut"
|
||||
rustc-args = ["--cfg", "docsrs"]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
|
||||
[package.metadata.platforms.support]
|
||||
windows = { level = "full", notes = "" }
|
||||
linux = { level = "full", notes = "" }
|
||||
macos = { level = "full", notes = "" }
|
||||
android = { level = "none", notes = "" }
|
||||
ios = { level = "none", notes = "" }
|
||||
|
||||
[build-dependencies]
|
||||
tauri-plugin = { workspace = true, features = ["build"] }
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ registered or unregistered.
|
||||
|
||||
|
||||
|
||||
## Permission Table
|
||||
## Permission Table
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
|
||||
@@ -13,6 +13,13 @@ rustc-args = ["--cfg", "docsrs"]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
targets = ["x86_64-linux-android"]
|
||||
|
||||
[package.metadata.platforms.support]
|
||||
windows = { level = "none", notes = "" }
|
||||
linux = { level = "none", notes = "" }
|
||||
macos = { level = "none", notes = "" }
|
||||
android = { level = "full", notes = "" }
|
||||
ios = { level = "full", notes = "" }
|
||||
|
||||
[build-dependencies]
|
||||
tauri-plugin = { workspace = true, features = ["build"] }
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
## Permission Table
|
||||
## Permission Table
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# Changelog
|
||||
|
||||
## \[2.0.0-rc.6]
|
||||
|
||||
### Dependencies
|
||||
|
||||
- Upgraded to `fs@2.0.0-rc.6`
|
||||
|
||||
## \[2.0.0-rc.5]
|
||||
|
||||
### Dependencies
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "tauri-plugin-http"
|
||||
version = "2.0.0-rc.5"
|
||||
version = "2.0.0-rc.6"
|
||||
description = "Access an HTTP client written in Rust."
|
||||
edition = { workspace = true }
|
||||
authors = { workspace = true }
|
||||
@@ -13,6 +13,13 @@ links = "tauri-plugin-http"
|
||||
rustc-args = ["--cfg", "docsrs"]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
|
||||
[package.metadata.platforms.support]
|
||||
windows = { level = "full", notes = "" }
|
||||
linux = { level = "full", notes = "" }
|
||||
macos = { level = "full", notes = "" }
|
||||
android = { level = "none", notes = "" }
|
||||
ios = { level = "none", notes = "" }
|
||||
|
||||
[build-dependencies]
|
||||
tauri-plugin = { workspace = true, features = ["build"] }
|
||||
schemars = { workspace = true }
|
||||
@@ -27,7 +34,7 @@ serde_json = { workspace = true }
|
||||
tauri = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
tokio = { version = "1", features = ["sync", "macros"] }
|
||||
tauri-plugin-fs = { path = "../fs", version = "2.0.0-rc.5" }
|
||||
tauri-plugin-fs = { path = "../fs", version = "2.0.0-rc.6" }
|
||||
urlpattern = "0.3"
|
||||
regex = "1"
|
||||
http = "1"
|
||||
|
||||
+10
-17
@@ -47,23 +47,16 @@ enum HttpScopeEntry {
|
||||
},
|
||||
}
|
||||
|
||||
// Ensure scope entry is kept up to date
|
||||
impl From<HttpScopeEntry> for scope::Entry {
|
||||
fn from(value: HttpScopeEntry) -> Self {
|
||||
let url = match value {
|
||||
HttpScopeEntry::Value(url) => url,
|
||||
HttpScopeEntry::Object { url } => url,
|
||||
};
|
||||
|
||||
scope::Entry {
|
||||
url: urlpattern::UrlPattern::parse(
|
||||
urlpattern::UrlPatternInit::parse_constructor_string::<regex::Regex>(&url, None)
|
||||
.unwrap(),
|
||||
Default::default(),
|
||||
)
|
||||
.unwrap(),
|
||||
}
|
||||
}
|
||||
// Ensure `HttpScopeEntry` and `scope::EntryRaw` is kept in sync
|
||||
fn _f() {
|
||||
match scope::EntryRaw::Value(String::new()) {
|
||||
scope::EntryRaw::Value(url) => HttpScopeEntry::Value(url),
|
||||
scope::EntryRaw::Object { url } => HttpScopeEntry::Object { url },
|
||||
};
|
||||
match HttpScopeEntry::Value(String::new()) {
|
||||
HttpScopeEntry::Value(url) => scope::EntryRaw::Value(url),
|
||||
HttpScopeEntry::Object { url } => scope::EntryRaw::Object { url },
|
||||
};
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
||||
@@ -18,7 +18,7 @@ All fetch operations are enabled.
|
||||
- `allow-fetch-read-body`
|
||||
- `allow-fetch-send`
|
||||
|
||||
## Permission Table
|
||||
## Permission Table
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
|
||||
@@ -33,18 +33,18 @@ fn parse_url_pattern(s: &str) -> Result<UrlPattern, urlpattern::quirks::Error> {
|
||||
UrlPattern::parse(init, Default::default())
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub(crate) enum EntryRaw {
|
||||
Value(String),
|
||||
Object { url: String },
|
||||
}
|
||||
|
||||
impl<'de> Deserialize<'de> for Entry {
|
||||
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
|
||||
where
|
||||
D: Deserializer<'de>,
|
||||
{
|
||||
#[derive(Deserialize)]
|
||||
#[serde(untagged)]
|
||||
enum EntryRaw {
|
||||
Value(String),
|
||||
Object { url: String },
|
||||
}
|
||||
|
||||
EntryRaw::deserialize(deserializer).and_then(|raw| {
|
||||
let url = match raw {
|
||||
EntryRaw::Value(url) => url,
|
||||
|
||||
@@ -12,6 +12,13 @@ repository = { workspace = true }
|
||||
rustc-args = ["--cfg", "docsrs"]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
|
||||
[package.metadata.platforms.support]
|
||||
windows = { level = "full", notes = "" }
|
||||
linux = { level = "full", notes = "" }
|
||||
macos = { level = "full", notes = "" }
|
||||
android = { level = "none", notes = "" }
|
||||
ios = { level = "none", notes = "" }
|
||||
|
||||
[dependencies]
|
||||
serde = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
|
||||
@@ -74,7 +74,7 @@ impl Builder {
|
||||
let asset_resolver = app.asset_resolver();
|
||||
std::thread::spawn(move || {
|
||||
let server =
|
||||
Server::http(&format!("localhost:{port}")).expect("Unable to spawn server");
|
||||
Server::http(format!("localhost:{port}")).expect("Unable to spawn server");
|
||||
for req in server.incoming_requests() {
|
||||
let path = req
|
||||
.url()
|
||||
|
||||
@@ -13,6 +13,13 @@ links = "tauri-plugin-log"
|
||||
rustc-args = ["--cfg", "docsrs"]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
|
||||
[package.metadata.platforms.support]
|
||||
windows = { level = "full", notes = "" }
|
||||
linux = { level = "full", notes = "" }
|
||||
macos = { level = "full", notes = "" }
|
||||
android = { level = "unknown", notes = "" }
|
||||
ios = { level = "unknown", notes = "" }
|
||||
|
||||
[build-dependencies]
|
||||
tauri-plugin = { workspace = true, features = ["build"] }
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ Allows the log command
|
||||
|
||||
- `allow-log`
|
||||
|
||||
## Permission Table
|
||||
## Permission Table
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
|
||||
@@ -13,6 +13,13 @@ rustc-args = ["--cfg", "docsrs"]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
targets = ["x86_64-linux-android"]
|
||||
|
||||
[package.metadata.platforms.support]
|
||||
windows = { level = "none", notes = "" }
|
||||
linux = { level = "none", notes = "" }
|
||||
macos = { level = "none", notes = "" }
|
||||
android = { level = "full", notes = "" }
|
||||
ios = { level = "full", notes = "" }
|
||||
|
||||
[build-dependencies]
|
||||
tauri-plugin = { workspace = true, features = ["build"] }
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ Writing to tags needs to be manually enabled.
|
||||
- `allow-is-available`
|
||||
- `allow-scan`
|
||||
|
||||
## Permission Table
|
||||
## Permission Table
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
|
||||
@@ -14,6 +14,13 @@ rustc-args = ["--cfg", "docsrs"]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
targets = ["x86_64-unknown-linux-gnu", "x86_64-linux-android"]
|
||||
|
||||
[package.metadata.platforms.support]
|
||||
windows = { level = "full", notes = "" }
|
||||
linux = { level = "full", notes = "" }
|
||||
macos = { level = "full", notes = "" }
|
||||
android = { level = "full", notes = "" }
|
||||
ios = { level = "full", notes = "" }
|
||||
|
||||
[build-dependencies]
|
||||
tauri-plugin = { workspace = true, features = ["build"] }
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ It allows all notification related features.
|
||||
- `allow-create-channel`
|
||||
- `allow-permission-state`
|
||||
|
||||
## Permission Table
|
||||
## Permission Table
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
|
||||
@@ -13,6 +13,13 @@ links = "tauri-plugin-os"
|
||||
rustc-args = ["--cfg", "docsrs"]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
|
||||
[package.metadata.platforms.support]
|
||||
windows = { level = "full", notes = "" }
|
||||
linux = { level = "full", notes = "" }
|
||||
macos = { level = "full", notes = "" }
|
||||
android = { level = "full", notes = "" }
|
||||
ios = { level = "full", notes = "" }
|
||||
|
||||
[build-dependencies]
|
||||
tauri-plugin = { workspace = true, features = ["build"] }
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ All information except the host name are available.
|
||||
- `allow-platform`
|
||||
- `allow-version`
|
||||
|
||||
## Permission Table
|
||||
## Permission Table
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# Changelog
|
||||
|
||||
## \[2.0.0-rc.6]
|
||||
|
||||
### Dependencies
|
||||
|
||||
- Upgraded to `fs@2.0.0-rc.6`
|
||||
|
||||
## \[2.0.0-rc.5]
|
||||
|
||||
### Dependencies
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "tauri-plugin-persisted-scope"
|
||||
version = "2.0.0-rc.5"
|
||||
version = "2.0.0-rc.6"
|
||||
description = "Save filesystem and asset scopes and restore them when the app is reopened."
|
||||
authors = { workspace = true }
|
||||
license = { workspace = true }
|
||||
@@ -12,6 +12,13 @@ repository = { workspace = true }
|
||||
rustc-args = ["--cfg", "docsrs"]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
|
||||
[package.metadata.platforms.support]
|
||||
windows = { level = "full", notes = "" }
|
||||
linux = { level = "full", notes = "" }
|
||||
macos = { level = "full", notes = "" }
|
||||
android = { level = "none", notes = "" }
|
||||
ios = { level = "none", notes = "" }
|
||||
|
||||
[dependencies]
|
||||
serde = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
@@ -20,7 +27,7 @@ log = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
aho-corasick = "1"
|
||||
bincode = "1"
|
||||
tauri-plugin-fs = { path = "../fs", version = "2.0.0-rc.5" }
|
||||
tauri-plugin-fs = { path = "../fs", version = "2.0.0-rc.6" }
|
||||
|
||||
[features]
|
||||
protocol-asset = ["tauri/protocol-asset"]
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
# Changelog
|
||||
|
||||
## \[2.0.0-rc.2]
|
||||
|
||||
- [`2f7e32b5`](https://github.com/tauri-apps/plugins-workspace/commit/2f7e32b5e07454d6c0cf3ab03f8af8da74c4a8a7) ([#1822](https://github.com/tauri-apps/plugins-workspace/pull/1822) by [@jbolda](https://github.com/tauri-apps/plugins-workspace/../../jbolda)) `handleIconState` function for use in JavaScript event handlers. This allows one to update the TrayIcon state through JavaScript and fully create and handle the TrayIcon without requiring Rust (and the side-effect of creating a TrayIcon).
|
||||
|
||||
## \[2.0.0-rc.1]
|
||||
|
||||
- [`e2e97db5`](https://github.com/tauri-apps/plugins-workspace/commit/e2e97db51983267f5be84d4f6f0278d58834d1f5) ([#1701](https://github.com/tauri-apps/plugins-workspace/pull/1701) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri 2.0.0-rc.8
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "tauri-plugin-positioner"
|
||||
version = "2.0.0-rc.1"
|
||||
version = "2.0.0-rc.2"
|
||||
description = "Position your windows at well-known locations."
|
||||
authors = { workspace = true }
|
||||
license = { workspace = true }
|
||||
@@ -13,6 +13,13 @@ links = "tauri-plugin-positioner"
|
||||
rustc-args = ["--cfg", "docsrs"]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
|
||||
[package.metadata.platforms.support]
|
||||
windows = { level = "full", notes = "" }
|
||||
linux = { level = "full", notes = "" }
|
||||
macos = { level = "full", notes = "" }
|
||||
android = { level = "none", notes = "" }
|
||||
ios = { level = "none", notes = "" }
|
||||
|
||||
[build-dependencies]
|
||||
tauri-plugin = { workspace = true, features = ["build"] }
|
||||
|
||||
|
||||
@@ -58,6 +58,7 @@ fn main() {
|
||||
.plugin(tauri_plugin_positioner::init())
|
||||
// This is required to get tray-relative positions to work
|
||||
.setup(|app| {
|
||||
// note that this will create a new TrayIcon
|
||||
TrayIconBuilder::new()
|
||||
.on_tray_icon_event(|app, event| {
|
||||
tauri_plugin_positioner::on_tray_event(app.app_handle(), &event);
|
||||
@@ -70,6 +71,40 @@ fn main() {
|
||||
}
|
||||
```
|
||||
|
||||
Alternatively, you may handle the tray events through JavaScript. Register the plugin as previously noted.
|
||||
|
||||
```rust
|
||||
fn main() {
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_positioner::init())
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
```
|
||||
|
||||
And in JavaScript, the `action` passed to the TrayIcon should include the handler.
|
||||
|
||||
```javascript
|
||||
import {
|
||||
moveWindow,
|
||||
Position,
|
||||
handleIconState,
|
||||
} from "@tauri-apps/plugin-positioner";
|
||||
|
||||
const action = async (event: TrayIconEvent) => {
|
||||
// add the handle in the action to update the state
|
||||
await handleIconState(event);
|
||||
if ("click" in event) {
|
||||
const { click } = event;
|
||||
// note this option requires enabling the `tray-icon`
|
||||
// feature in the Cargo.toml
|
||||
await moveWindow(Position.TrayLeft);
|
||||
}
|
||||
};
|
||||
|
||||
const tray = await TrayIcon.new({ id: "main", action });
|
||||
```
|
||||
|
||||
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
|
||||
|
||||
```javascript
|
||||
|
||||
@@ -1 +1 @@
|
||||
if("__TAURI__"in window){var __TAURI_PLUGIN_POSITIONER__=function(t){"use strict";var o;return"function"==typeof SuppressedError&&SuppressedError,t.Position=void 0,(o=t.Position||(t.Position={}))[o.TopLeft=0]="TopLeft",o[o.TopRight=1]="TopRight",o[o.BottomLeft=2]="BottomLeft",o[o.BottomRight=3]="BottomRight",o[o.TopCenter=4]="TopCenter",o[o.BottomCenter=5]="BottomCenter",o[o.LeftCenter=6]="LeftCenter",o[o.RightCenter=7]="RightCenter",o[o.Center=8]="Center",o[o.TrayLeft=9]="TrayLeft",o[o.TrayBottomLeft=10]="TrayBottomLeft",o[o.TrayRight=11]="TrayRight",o[o.TrayBottomRight=12]="TrayBottomRight",o[o.TrayCenter=13]="TrayCenter",o[o.TrayBottomCenter=14]="TrayBottomCenter",t.moveWindow=async function(t){await async function(t,o={},e){return window.__TAURI_INTERNALS__.invoke(t,o,e)}("plugin:positioner|move_window",{position:t})},t}({});Object.defineProperty(window.__TAURI__,"positioner",{value:__TAURI_PLUGIN_POSITIONER__})}
|
||||
if("__TAURI__"in window){var __TAURI_PLUGIN_POSITIONER__=function(t){"use strict";async function o(t,o={},e){return window.__TAURI_INTERNALS__.invoke(t,o,e)}var e;return"function"==typeof SuppressedError&&SuppressedError,t.Position=void 0,(e=t.Position||(t.Position={}))[e.TopLeft=0]="TopLeft",e[e.TopRight=1]="TopRight",e[e.BottomLeft=2]="BottomLeft",e[e.BottomRight=3]="BottomRight",e[e.TopCenter=4]="TopCenter",e[e.BottomCenter=5]="BottomCenter",e[e.LeftCenter=6]="LeftCenter",e[e.RightCenter=7]="RightCenter",e[e.Center=8]="Center",e[e.TrayLeft=9]="TrayLeft",e[e.TrayBottomLeft=10]="TrayBottomLeft",e[e.TrayRight=11]="TrayRight",e[e.TrayBottomRight=12]="TrayBottomRight",e[e.TrayCenter=13]="TrayCenter",e[e.TrayBottomCenter=14]="TrayBottomCenter",t.handleIconState=async function(t){await async function(t){await o("plugin:positioner|set_tray_icon_state",{position:t.position,size:t.size})}(t.rect)},t.moveWindow=async function(t){await o("plugin:positioner|move_window",{position:t})},t}({});Object.defineProperty(window.__TAURI__,"positioner",{value:__TAURI_PLUGIN_POSITIONER__})}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import { invoke } from '@tauri-apps/api/core'
|
||||
import type { TrayIconEvent } from '@tauri-apps/api/tray'
|
||||
|
||||
/**
|
||||
* Well known window positions.
|
||||
@@ -37,3 +38,14 @@ export async function moveWindow(to: Position): Promise<void> {
|
||||
position: to
|
||||
})
|
||||
}
|
||||
|
||||
export async function handleIconState(event: TrayIconEvent): Promise<void> {
|
||||
await invokeSetTrayIconState(event.rect)
|
||||
}
|
||||
|
||||
async function invokeSetTrayIconState(rect: TrayIconEvent['rect']) {
|
||||
await invoke('plugin:positioner|set_tray_icon_state', {
|
||||
position: rect.position,
|
||||
size: rect.size
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@tauri-apps/plugin-positioner",
|
||||
"version": "2.0.0-rc.1",
|
||||
"version": "2.0.0-rc.2",
|
||||
"description": "Position your windows at well-known locations.",
|
||||
"license": "MIT or APACHE-2.0",
|
||||
"authors": [
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
# Automatically generated - DO NOT EDIT!
|
||||
|
||||
"$schema" = "../../schemas/schema.json"
|
||||
|
||||
[[permission]]
|
||||
identifier = "allow-set-tray-icon-state"
|
||||
description = "Enables the set_tray_icon_state to handle events and set the TrayIcon state."
|
||||
commands.allow = ["set_tray_icon_state"]
|
||||
@@ -3,8 +3,9 @@
|
||||
Allows the move_window command
|
||||
|
||||
- `allow-move-window`
|
||||
- `set-tray-icon-state`
|
||||
|
||||
## Permission Table
|
||||
## Permission Table
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
@@ -36,6 +37,19 @@ Enables the move_window command without any pre-configured scope.
|
||||
|
||||
Denies the move_window command without any pre-configured scope.
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
`positioner:allow-set-tray-icon-state`
|
||||
|
||||
</td>
|
||||
<td>
|
||||
|
||||
Enables the set_tray_icon_state to handle events and set the TrayIcon state.
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"$schema" = "schemas/schema.json"
|
||||
[default]
|
||||
description = "Allows the move_window command"
|
||||
permissions = ["allow-move-window"]
|
||||
permissions = ["allow-move-window", "set-tray-icon-state"]
|
||||
|
||||
@@ -304,6 +304,11 @@
|
||||
"type": "string",
|
||||
"const": "deny-move-window"
|
||||
},
|
||||
{
|
||||
"description": "Enables the set_tray_icon_state to handle events and set the TrayIcon state.",
|
||||
"type": "string",
|
||||
"const": "allow-set-tray-icon-state"
|
||||
},
|
||||
{
|
||||
"description": "Allows the move_window command",
|
||||
"type": "string",
|
||||
|
||||
@@ -63,10 +63,27 @@ async fn move_window<R: Runtime>(window: tauri::Window<R>, position: Position) -
|
||||
window.move_window(position)
|
||||
}
|
||||
|
||||
#[cfg(feature = "tray-icon")]
|
||||
#[tauri::command]
|
||||
fn set_tray_icon_state<R: Runtime>(
|
||||
app: AppHandle<R>,
|
||||
position: PhysicalPosition<f64>,
|
||||
size: PhysicalSize<f64>,
|
||||
) {
|
||||
app.state::<Tray>()
|
||||
.0
|
||||
.lock()
|
||||
.unwrap()
|
||||
.replace((position, size));
|
||||
}
|
||||
|
||||
/// The Tauri plugin that exposes [`WindowExt::move_window`] to the webview.
|
||||
pub fn init<R: Runtime>() -> TauriPlugin<R> {
|
||||
let plugin =
|
||||
plugin::Builder::new("positioner").invoke_handler(tauri::generate_handler![move_window]);
|
||||
let plugin = plugin::Builder::new("positioner").invoke_handler(tauri::generate_handler![
|
||||
move_window,
|
||||
#[cfg(feature = "tray-icon")]
|
||||
set_tray_icon_state
|
||||
]);
|
||||
|
||||
#[cfg(feature = "tray-icon")]
|
||||
let plugin = plugin.setup(|app_handle, _api| {
|
||||
|
||||
@@ -13,6 +13,13 @@ links = "tauri-plugin-process"
|
||||
rustc-args = ["--cfg", "docsrs"]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
|
||||
[package.metadata.platforms.support]
|
||||
windows = { level = "full", notes = "" }
|
||||
linux = { level = "full", notes = "" }
|
||||
macos = { level = "full", notes = "" }
|
||||
android = { level = "none", notes = "" }
|
||||
ios = { level = "none", notes = "" }
|
||||
|
||||
[build-dependencies]
|
||||
tauri-plugin = { workspace = true, features = ["build"] }
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ the application.
|
||||
- `allow-exit`
|
||||
- `allow-restart`
|
||||
|
||||
## Permission Table
|
||||
## Permission Table
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
# Changelog
|
||||
|
||||
## \[2.0.0-rc.4]
|
||||
|
||||
- [`44273b98`](https://github.com/tauri-apps/plugins-workspace/commit/44273b988957a254eff715d6be7547d2ace882e1) ([#1839](https://github.com/tauri-apps/plugins-workspace/pull/1839) by [@amrbashir](https://github.com/tauri-apps/plugins-workspace/../../amrbashir)) Fix the plugin schema requiring to set `sidecar` property when it is in fact optional.
|
||||
|
||||
## \[2.0.0-rc.1]
|
||||
|
||||
- [`e2e97db5`](https://github.com/tauri-apps/plugins-workspace/commit/e2e97db51983267f5be84d4f6f0278d58834d1f5) ([#1701](https://github.com/tauri-apps/plugins-workspace/pull/1701) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Update to tauri 2.0.0-rc.8
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "tauri-plugin-shell"
|
||||
version = "2.0.0-rc.3"
|
||||
version = "2.0.0-rc.4"
|
||||
description = "Access the system shell. Allows you to spawn child processes and manage files and URLs using their default application."
|
||||
edition = { workspace = true }
|
||||
authors = { workspace = true }
|
||||
@@ -13,6 +13,13 @@ links = "tauri-plugin-shell"
|
||||
rustc-args = ["--cfg", "docsrs"]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
|
||||
[package.metadata.platforms.support]
|
||||
windows = { level = "full", notes = "" }
|
||||
linux = { level = "full", notes = "" }
|
||||
macos = { level = "full", notes = "" }
|
||||
android = { level = "partial", notes = "Only allows to open URLs via `open`" }
|
||||
ios = { level = "partial", notes = "Only allows to open URLs via `open`" }
|
||||
|
||||
[build-dependencies]
|
||||
tauri-plugin = { workspace = true, features = ["build"] }
|
||||
schemars = { workspace = true }
|
||||
@@ -20,7 +27,6 @@ serde = { workspace = true }
|
||||
|
||||
[dependencies]
|
||||
serde = { workspace = true }
|
||||
schemars = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
tauri = { workspace = true }
|
||||
tokio = { version = "1", features = ["time"] }
|
||||
|
||||
+159
-1
@@ -2,15 +2,173 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
use std::path::PathBuf;
|
||||
|
||||
use schemars::JsonSchema;
|
||||
|
||||
#[path = "src/scope_entry.rs"]
|
||||
mod scope_entry;
|
||||
|
||||
/// A command argument allowed to be executed by the webview API.
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Hash, schemars::JsonSchema)]
|
||||
#[serde(untagged, deny_unknown_fields)]
|
||||
#[non_exhaustive]
|
||||
pub enum ShellScopeEntryAllowedArg {
|
||||
/// A non-configurable argument that is passed to the command in the order it was specified.
|
||||
Fixed(String),
|
||||
|
||||
/// A variable that is set while calling the command from the webview API.
|
||||
///
|
||||
Var {
|
||||
/// [regex] validator to require passed values to conform to an expected input.
|
||||
///
|
||||
/// This will require the argument value passed to this variable to match the `validator` regex
|
||||
/// before it will be executed.
|
||||
///
|
||||
/// The regex string is by default surrounded by `^...$` to match the full string.
|
||||
/// For example the `https?://\w+` regex would be registered as `^https?://\w+$`.
|
||||
///
|
||||
/// [regex]: <https://docs.rs/regex/latest/regex/#syntax>
|
||||
validator: String,
|
||||
|
||||
/// Marks the validator as a raw regex, meaning the plugin should not make any modification at runtime.
|
||||
///
|
||||
/// This means the regex will not match on the entire string by default, which might
|
||||
/// be exploited if your regex allow unexpected input to be considered valid.
|
||||
/// When using this option, make sure your regex is correct.
|
||||
#[serde(default)]
|
||||
raw: bool,
|
||||
},
|
||||
}
|
||||
|
||||
/// A set of command arguments allowed to be executed by the webview API.
|
||||
///
|
||||
/// A value of `true` will allow any arguments to be passed to the command. `false` will disable all
|
||||
/// arguments. A list of [`ShellScopeEntryAllowedArg`] will set those arguments as the only valid arguments to
|
||||
/// be passed to the attached command configuration.
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Hash, JsonSchema)]
|
||||
#[serde(untagged, deny_unknown_fields)]
|
||||
#[non_exhaustive]
|
||||
pub enum ShellScopeEntryAllowedArgs {
|
||||
/// Use a simple boolean to allow all or disable all arguments to this command configuration.
|
||||
Flag(bool),
|
||||
|
||||
/// A specific set of [`ShellScopeEntryAllowedArg`] that are valid to call for the command configuration.
|
||||
List(Vec<ShellScopeEntryAllowedArg>),
|
||||
}
|
||||
|
||||
impl Default for ShellScopeEntryAllowedArgs {
|
||||
fn default() -> Self {
|
||||
Self::Flag(false)
|
||||
}
|
||||
}
|
||||
|
||||
/// Shell scope entry.
|
||||
#[derive(JsonSchema)]
|
||||
#[serde(untagged, deny_unknown_fields)]
|
||||
#[allow(unused)]
|
||||
pub(crate) enum ShellScopeEntry {
|
||||
Command {
|
||||
/// The name for this allowed shell command configuration.
|
||||
///
|
||||
/// This name will be used inside of the webview API to call this command along with
|
||||
/// any specified arguments.
|
||||
name: String,
|
||||
/// The command name.
|
||||
/// It can start with a variable that resolves to a system base directory.
|
||||
/// The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`,
|
||||
/// `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`,
|
||||
/// `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`,
|
||||
/// `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.
|
||||
// use default just so the schema doesn't flag it as required
|
||||
#[serde(rename = "cmd")]
|
||||
command: PathBuf,
|
||||
/// The allowed arguments for the command execution.
|
||||
#[serde(default)]
|
||||
args: ShellScopeEntryAllowedArgs,
|
||||
},
|
||||
Sidecar {
|
||||
/// The name for this allowed shell command configuration.
|
||||
///
|
||||
/// This name will be used inside of the webview API to call this command along with
|
||||
/// any specified arguments.
|
||||
name: String,
|
||||
/// The allowed arguments for the command execution.
|
||||
#[serde(default)]
|
||||
args: ShellScopeEntryAllowedArgs,
|
||||
/// If this command is a sidecar command.
|
||||
sidecar: bool,
|
||||
},
|
||||
}
|
||||
|
||||
// Ensure `ShellScopeEntry` and `scope_entry::EntryRaw`
|
||||
// and `ShellScopeEntryAllowedArg` and `ShellAllowedArg`
|
||||
// and `ShellScopeEntryAllowedArgs` and `ShellAllowedArgs`
|
||||
// are kept in sync
|
||||
#[allow(clippy::unnecessary_operation)]
|
||||
fn _f() {
|
||||
match (ShellScopeEntry::Sidecar {
|
||||
name: String::new(),
|
||||
args: ShellScopeEntryAllowedArgs::Flag(false),
|
||||
sidecar: true,
|
||||
}) {
|
||||
ShellScopeEntry::Command {
|
||||
name,
|
||||
command,
|
||||
args,
|
||||
} => scope_entry::EntryRaw {
|
||||
name,
|
||||
command: Some(command),
|
||||
args: match args {
|
||||
ShellScopeEntryAllowedArgs::Flag(flag) => scope_entry::ShellAllowedArgs::Flag(flag),
|
||||
ShellScopeEntryAllowedArgs::List(vec) => scope_entry::ShellAllowedArgs::List(
|
||||
vec.into_iter()
|
||||
.map(|s| match s {
|
||||
ShellScopeEntryAllowedArg::Fixed(fixed) => {
|
||||
scope_entry::ShellAllowedArg::Fixed(fixed)
|
||||
}
|
||||
ShellScopeEntryAllowedArg::Var { validator, raw } => {
|
||||
scope_entry::ShellAllowedArg::Var { validator, raw }
|
||||
}
|
||||
})
|
||||
.collect(),
|
||||
),
|
||||
},
|
||||
sidecar: false,
|
||||
},
|
||||
ShellScopeEntry::Sidecar {
|
||||
name,
|
||||
args,
|
||||
sidecar,
|
||||
} => scope_entry::EntryRaw {
|
||||
name,
|
||||
command: None,
|
||||
args: match args {
|
||||
ShellScopeEntryAllowedArgs::Flag(flag) => scope_entry::ShellAllowedArgs::Flag(flag),
|
||||
ShellScopeEntryAllowedArgs::List(vec) => scope_entry::ShellAllowedArgs::List(
|
||||
vec.into_iter()
|
||||
.map(|s| match s {
|
||||
ShellScopeEntryAllowedArg::Fixed(fixed) => {
|
||||
scope_entry::ShellAllowedArg::Fixed(fixed)
|
||||
}
|
||||
ShellScopeEntryAllowedArg::Var { validator, raw } => {
|
||||
scope_entry::ShellAllowedArg::Var { validator, raw }
|
||||
}
|
||||
})
|
||||
.collect(),
|
||||
),
|
||||
},
|
||||
sidecar,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const COMMANDS: &[&str] = &["execute", "spawn", "stdin_write", "kill", "open"];
|
||||
|
||||
fn main() {
|
||||
tauri_plugin::Builder::new(COMMANDS)
|
||||
.global_api_script_path("./api-iife.js")
|
||||
.global_scope_schema(schemars::schema_for!(scope_entry::Entry))
|
||||
.global_scope_schema(schemars::schema_for!(ShellScopeEntry))
|
||||
.android_path("android")
|
||||
.ios_path("ios")
|
||||
.build();
|
||||
|
||||
@@ -12,7 +12,7 @@ scope pre-configured. It will allow opening `http(s)://`,
|
||||
|
||||
- `allow-open`
|
||||
|
||||
## Permission Table
|
||||
## Permission Table
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
|
||||
@@ -7,29 +7,23 @@ use serde::{de::Error as DeError, Deserialize, Deserializer};
|
||||
use std::path::PathBuf;
|
||||
|
||||
/// A command allowed to be executed by the webview API.
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash, schemars::JsonSchema)]
|
||||
pub struct Entry {
|
||||
/// The name for this allowed shell command configuration.
|
||||
///
|
||||
/// This name will be used inside of the webview API to call this command along with
|
||||
/// any specified arguments.
|
||||
pub name: String,
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub(crate) struct Entry {
|
||||
pub(crate) name: String,
|
||||
pub(crate) command: PathBuf,
|
||||
pub(crate) args: ShellAllowedArgs,
|
||||
pub(crate) sidecar: bool,
|
||||
}
|
||||
|
||||
/// The command name.
|
||||
/// It can start with a variable that resolves to a system base directory.
|
||||
/// The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`,
|
||||
/// `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`,
|
||||
/// `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`,
|
||||
/// `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.
|
||||
// use default just so the schema doesn't flag it as required
|
||||
#[derive(Deserialize)]
|
||||
pub(crate) struct EntryRaw {
|
||||
pub(crate) name: String,
|
||||
#[serde(rename = "cmd")]
|
||||
pub command: PathBuf,
|
||||
|
||||
/// The allowed arguments for the command execution.
|
||||
pub args: ShellAllowedArgs,
|
||||
|
||||
/// If this command is a sidecar command.
|
||||
pub sidecar: bool,
|
||||
pub(crate) command: Option<PathBuf>,
|
||||
#[serde(default)]
|
||||
pub(crate) args: ShellAllowedArgs,
|
||||
#[serde(default)]
|
||||
pub(crate) sidecar: bool,
|
||||
}
|
||||
|
||||
impl<'de> Deserialize<'de> for Entry {
|
||||
@@ -37,18 +31,7 @@ impl<'de> Deserialize<'de> for Entry {
|
||||
where
|
||||
D: Deserializer<'de>,
|
||||
{
|
||||
#[derive(Deserialize)]
|
||||
struct InnerEntry {
|
||||
name: String,
|
||||
#[serde(rename = "cmd")]
|
||||
command: Option<PathBuf>,
|
||||
#[serde(default)]
|
||||
args: ShellAllowedArgs,
|
||||
#[serde(default)]
|
||||
sidecar: bool,
|
||||
}
|
||||
|
||||
let config = InnerEntry::deserialize(deserializer)?;
|
||||
let config = EntryRaw::deserialize(deserializer)?;
|
||||
|
||||
if !config.sidecar && config.command.is_none() {
|
||||
return Err(DeError::custom(
|
||||
@@ -65,19 +48,11 @@ impl<'de> Deserialize<'de> for Entry {
|
||||
}
|
||||
}
|
||||
|
||||
/// A set of command arguments allowed to be executed by the webview API.
|
||||
///
|
||||
/// A value of `true` will allow any arguments to be passed to the command. `false` will disable all
|
||||
/// arguments. A list of [`ShellAllowedArg`] will set those arguments as the only valid arguments to
|
||||
/// be passed to the attached command configuration.
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Hash, Deserialize, schemars::JsonSchema)]
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Hash, Deserialize)]
|
||||
#[serde(untagged, deny_unknown_fields)]
|
||||
#[non_exhaustive]
|
||||
pub enum ShellAllowedArgs {
|
||||
/// Use a simple boolean to allow all or disable all arguments to this command configuration.
|
||||
Flag(bool),
|
||||
|
||||
/// A specific set of [`ShellAllowedArg`] that are valid to call for the command configuration.
|
||||
List(Vec<ShellAllowedArg>),
|
||||
}
|
||||
|
||||
@@ -87,33 +62,13 @@ impl Default for ShellAllowedArgs {
|
||||
}
|
||||
}
|
||||
|
||||
/// A command argument allowed to be executed by the webview API.
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Hash, Deserialize, schemars::JsonSchema)]
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Hash, Deserialize)]
|
||||
#[serde(untagged, deny_unknown_fields)]
|
||||
#[non_exhaustive]
|
||||
pub enum ShellAllowedArg {
|
||||
/// A non-configurable argument that is passed to the command in the order it was specified.
|
||||
Fixed(String),
|
||||
|
||||
/// A variable that is set while calling the command from the webview API.
|
||||
///
|
||||
Var {
|
||||
/// [regex] validator to require passed values to conform to an expected input.
|
||||
///
|
||||
/// This will require the argument value passed to this variable to match the `validator` regex
|
||||
/// before it will be executed.
|
||||
///
|
||||
/// The regex string is by default surrounded by `^...$` to match the full string.
|
||||
/// For example the `https?://\w+` regex would be registered as `^https?://\w+$`.
|
||||
///
|
||||
/// [regex]: <https://docs.rs/regex/latest/regex/#syntax>
|
||||
validator: String,
|
||||
|
||||
/// Marks the validator as a raw regex, meaning the plugin should not make any modification at runtime.
|
||||
///
|
||||
/// This means the regex will not match on the entire string by default, which might
|
||||
/// be exploited if your regex allow unexpected input to be considered valid.
|
||||
/// When using this option, make sure your regex is correct.
|
||||
#[serde(default)]
|
||||
raw: bool,
|
||||
},
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# Changelog
|
||||
|
||||
## \[2.0.0-rc.5]
|
||||
|
||||
### Dependencies
|
||||
|
||||
- Upgraded to `deep-link@2.0.0-rc.7`
|
||||
|
||||
## \[2.0.0-rc.4]
|
||||
|
||||
### Dependencies
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "tauri-plugin-single-instance"
|
||||
version = "2.0.0-rc.4"
|
||||
version = "2.0.0-rc.5"
|
||||
description = "Ensure a single instance of your tauri app is running."
|
||||
authors = { workspace = true }
|
||||
license = { workspace = true }
|
||||
@@ -13,13 +13,20 @@ exclude = ["/examples"]
|
||||
rustc-args = ["--cfg", "docsrs"]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
|
||||
[package.metadata.platforms.support]
|
||||
windows = { level = "full", notes = "" }
|
||||
linux = { level = "full", notes = "" }
|
||||
macos = { level = "full", notes = "" }
|
||||
android = { level = "none", notes = "" }
|
||||
ios = { level = "none", notes = "" }
|
||||
|
||||
[dependencies]
|
||||
serde = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
tauri = { workspace = true }
|
||||
log = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
tauri-plugin-deep-link = { path = "../deep-link", version = "2.0.0-rc.6", optional = true }
|
||||
tauri-plugin-deep-link = { path = "../deep-link", version = "2.0.0-rc.7", optional = true }
|
||||
semver = { version = "1", optional = true }
|
||||
|
||||
[target."cfg(target_os = \"windows\")".dependencies.windows-sys]
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user