Compare commits

...
Author SHA1 Message Date
renovate[bot]andGitHub 01198111d1 chore(deps): update rust crate reqwest to v0.13.4 2026-08-05 07:51:44 +00:00
TonyandGitHub f8053e659e docs: cargo features (#3527)
* dialog

* fs

* geolocation

* haptic

* log

* single instance

* notification

* updater

* ##

* persisted scopes

* stronghold

* sql

* upload

* websocket

* http
(this one was too long that I generated through codex, didn't review yet)

* add change file

* no persisted-scope-js

* add `://`

* Merge branch 'v2' into document-cargo-features

* update system-proxy docs

* finish http docs

* notification doesn't need version bumps

* clean up docs
2026-08-05 15:48:11 +08:00
TonyandGitHub 19fb3926fd feat(http): add system-proxy feature (#3528)
* feat(http): add `system-proxy` feature

* require reqwest 0.12.16
2026-08-04 19:51:32 +08:00
TonyandGitHub 2371be839f feat(updater): add system-proxy feature (#3526)
* feat(updater): add `system-proxy` feature

* enable by default
2026-08-04 16:37:00 +08:00
TonyandGitHub e215ff90d3 chore: remove outdated prod features (#3525) 2026-08-04 15:45:25 +08:00
renovate[bot]GitHubrenovate[bot] <29139614+renovate[bot]@users.noreply.github.com>Tony
ba89f32eb0 chore(deps): update dependency @zerodevx/svelte-json-view to v2 (#3524)
* chore(deps): update dependency @zerodevx/svelte-json-view to v2

* update pnpm to 11.20.0?

* bump brace-expansion for audit

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Tony <legendmastertony@gmail.com>
2026-08-04 10:46:11 +08:00
purvsinojiya-inventyvandGitHub cc9ec9b4ad fix(dialog): use parsed MIME type for Android save dialog (#3519) 2026-07-29 17:05:43 +02:00
paul valladaresandGitHub dc7f87bc7e chore: exclude dev-only files from published crates (#3518)
* chore: exclude dev-only files from published crates

* format
2026-07-29 09:35:15 +02:00
Michael KadzielaandGitHub 304292d740 feat(notification): add rust Action/ActionType api. fix action registration in Android (#2805) 2026-07-27 13:03:43 +02:00
TonyandGitHub 622f02bf21 fix(updater): check ShellExecuteW results (#3516)
* fix(updater): check `ShellExecuteW` results

* document the exit on windows
2026-07-27 16:38:50 +08:00
renovate[bot]GitHubrenovate[bot] <29139614+renovate[bot]@users.noreply.github.com>Tony
abc903c240 chore(deps): update dependency rollup to v4.62.2 (#3423)
* chore(deps): update dependency rollup to v4.62.2

* Fix audit

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Tony <legendmastertony@gmail.com>
2026-07-27 13:29:36 +08:00
TonyandGitHub ab7489c964 feat(updater): option to not restart after install (#3299)
* feat(updater): option to not restart after install

* More platform cfg

* Add the same function for `UpdaterBuilder`

* Fix missing `#[cfg(windows)]`

* Mark `current_exe_args` cfg(windows)

* Mark `on_before_exit` cfg(windows)

* Mark `installer_args` cfg(windows)

* Note about `installer_arg` apply to both

* Remove current args and restart together

* Only build needed bundle on windows as well

* Remove `/NS` since it breaks the msi updater

* Add launch updater debug log

* Add a folder to test updates

* Remove unused `#[allow(unused)]`

* Format

* messed up git stage

* Add change file

* Clean up

* Disable NSIS compression for API example

* Bump wry for v1 test to pull in https://github.com/tauri-apps/wry/pull/1703

* format

* Make typescript happy

* Close new update on destroy
2026-07-21 18:25:16 +08:00
3fb27bf13a fix(docs): deep link platform specific and fs scope (#3504)
* deep link fix Platform Specific heading

* fix fs permission toml

* .changes

* Update change files

Co-authored-by: Tony <68118705+Legend-Master@users.noreply.github.com>

* Update .changes/fs-deny-scope.md

* fix eol

---------

Co-authored-by: Tony <68118705+Legend-Master@users.noreply.github.com>
2026-07-21 14:56:52 +08:00
TonyandGitHub 7e45774610 refactor(fs): cfg gate some ios code (#3510) 2026-07-21 14:42:45 +08:00
526726162f fix(nfc): adapt backend invoke to frontend (#3419)
* fix(nfc): adapt backend invoke to frontend

* Revert "fix(nfc): adapt backend invoke to frontend"

This reverts commit e34306e083.

* fix:  enforce nfc function return type

* Update .changes/nfc.md

Co-authored-by: Fabian-Lars <30730186+FabianLars@users.noreply.github.com>

---------

Co-authored-by: Fabian-Lars <30730186+FabianLars@users.noreply.github.com>
2026-07-20 13:11:20 +02:00
github-actions[bot]GitHubgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
03afae6d72 publish new versions (#3500)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-07-19 00:40:36 +08:00
renovate[bot]GitHubrenovate[bot] <29139614+renovate[bot]@users.noreply.github.com>Tony
57ac986453 chore(deps): update dependency @tauri-apps/cli to v2.11.4 (#3463)
* chore(deps): update dependency @tauri-apps/cli to v2.11.4

* Use workspace dependencies in example

* Bump tauri

* Leftover

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Tony <legendmastertony@gmail.com>
2026-07-18 22:28:03 +08:00
TonyandGitHub 2ed6d6c1de fix(store): StoreOptions.defaults should not be required (#3499) 2026-07-18 19:46:31 +08:00
TonyandGitHub cdfd462955 chore(example): set color-cheme (#3493)
This allows the unstyled user agent elements (like the checkbox) match the selected theme colors
2026-07-16 21:31:40 +08:00
TonyandGitHub d6e0b6bbb1 chore(example): clean up and migrate to ts partially (#3492)
* chore(example): clean up and migrate to ts

* Add missing permissions

* Mirror line-height: 1.5 and remove h-*
2026-07-16 19:47:52 +08:00
TonyandGitHub 40ae0a7fa0 enhance(dialog): use MaterialAlertDialogBuilder (#3491)
* Fix example insets

* Add app-region: drag

* Use `Theme.Material3.DayNight.NoActionBar`

* Re-generate some kotlin files

* Use MaterialAlertDialogBuilder

* Add change file

* Revert back to margin-top: 0.5rem

* Re-generate outdated gradle wrapper from #3039

* Move title bar to its own file

* Fix cancel message
2026-07-16 17:27:19 +08:00
TonyandGitHub edc52ea056 chore(deps): bump create-pull-request to v8 (#3489) 2026-07-15 23:49:37 +08:00
TonyandGitHub a0d949d93e chore(deps): update pnpm to v11 (#3487)
* chore(deps): update pnpm to v11

* Remove all `version: 11`

* Bump tsx
2026-07-15 20:24:01 +08:00
TonyandGitHub 13c63af965 chore: fix clippy (#3488) 2026-07-15 16:01:07 +08:00
133 changed files with 1891 additions and 1113 deletions
+6
View File
@@ -0,0 +1,6 @@
---
"deep-link": patch
"deep-link-js": patch
---
adds proper Platform-specific sections to the docs for `register`, `unregister`, `isRegistered`, and `onOpenUrl`
+6
View File
@@ -0,0 +1,6 @@
---
"dialog": patch
"dialog-js": patch
---
Fix Android save dialog MIME type when a single MIME type is provided.
+30
View File
@@ -0,0 +1,30 @@
---
"dialog": patch
"dialog-js": patch
"fs": patch
"fs-js": patch
"geolocation": patch
"geolocation-js": patch
"haptics": patch
"haptics-js": patch
"http": patch
"http-js": patch
"log": patch
"log-js": patch
"persisted-scope": patch
"positioner": patch
"positioner-js": patch
"single-instance": patch
"sql": patch
"sql-js": patch
"stronghold": patch
"stronghold-js": patch
"updater": patch
"updater-js": patch
"upload": patch
"upload-js": patch
"websocket": patch
"websocket-js": patch
---
Documented Cargo feature flags in each plugin's crate-level documentation.
+6
View File
@@ -0,0 +1,6 @@
---
"fs": patch
"fs-js": patch
---
Fixed `deny-webview-data` has no effect
+6
View File
@@ -0,0 +1,6 @@
---
"http": minor
"http-js": minor
---
Added `system-proxy` feature to replace the old `macos-system-configuration` feature flag to match the new reqwest API.
+6
View File
@@ -0,0 +1,6 @@
---
nfc: patch
nfc-js: patch
---
Expect a `NFCTag` as input and return a `ScanResponse` in the `scan` function.
+7
View File
@@ -0,0 +1,7 @@
---
notification: minor
notification-js: minor
---
- Add Rust builders for mobile notification action types.
- Fix Android action-group entries being stored under the action type ID instead of sequential indices, causing later actions to overwrite earlier ones.
@@ -0,0 +1,6 @@
---
"updater": patch
"updater-js": patch
---
On Windows, returns an error if failed to spawn the installer in `install` through `ShellExecuteW`
+6
View File
@@ -0,0 +1,6 @@
---
"updater": minor
"updater-js": minor
---
On Windows, add a new option `restartAfterInstall`/`restart_after_install` to install an update without the installer re-launching the app
+6
View File
@@ -0,0 +1,6 @@
---
"updater": minor
"updater-js": minor
---
Added `system-proxy` (enabled by default) feature flag to control `reqwest/system-proxy` feature (Use Windows and macOS system proxy settings automatically)
+4 -5
View File
@@ -33,20 +33,19 @@ jobs:
audit-js: audit-js:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v7
- name: Cache pnpm modules - name: Cache pnpm modules
uses: actions/cache@v4 uses: actions/cache@v6
with: with:
path: ~/.pnpm-store path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: | restore-keys: |
${{ runner.os }}- ${{ runner.os }}-
- uses: actions/setup-node@v4 - uses: actions/setup-node@v7
with: with:
node-version: 'lts/*' node-version: 'lts/*'
- uses: pnpm/action-setup@v4 - uses: pnpm/action-setup@v6
with: with:
version: 10.x.x
run_install: true run_install: true
- name: audit - name: audit
run: pnpm audit run: pnpm audit
+1 -1
View File
@@ -33,7 +33,7 @@ jobs:
audit-rust: audit-rust:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v7
- uses: rustsec/audit-check@v2 - uses: rustsec/audit-check@v2
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
+1 -1
View File
@@ -17,7 +17,7 @@ jobs:
check: check:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v7
- name: check change files end with .md - name: check change files end with .md
run: | run: |
+5 -6
View File
@@ -21,7 +21,7 @@ jobs:
outputs: outputs:
packages: ${{ steps.filter.outputs.changes }} packages: ${{ steps.filter.outputs.changes }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v7
- uses: dorny/paths-filter@v2 - uses: dorny/paths-filter@v2
id: filter id: filter
with: with:
@@ -153,21 +153,20 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v7
- name: Cache pnpm modules - name: Cache pnpm modules
uses: actions/cache@v4 uses: actions/cache@v6
with: with:
path: ~/.pnpm-store path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: | restore-keys: |
${{ runner.os }}- ${{ runner.os }}-
- uses: actions/setup-node@v4 - uses: actions/setup-node@v7
with: with:
node-version: 'lts/*' node-version: 'lts/*'
- uses: pnpm/action-setup@v4 - uses: pnpm/action-setup@v6
with: with:
version: 10.x.x
run_install: true run_install: true
- name: build api - name: build api
+1 -1
View File
@@ -15,7 +15,7 @@ jobs:
check: check:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v7
- uses: dorny/paths-filter@v2 - uses: dorny/paths-filter@v2
id: filter id: filter
with: with:
+1 -1
View File
@@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v7
with: with:
fetch-depth: 0 # required for use of git history fetch-depth: 0 # required for use of git history
- name: covector status - name: covector status
@@ -28,18 +28,17 @@ jobs:
successfulPublish: ${{ steps.covector.outputs.successfulPublish }} successfulPublish: ${{ steps.covector.outputs.successfulPublish }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v7
with: with:
fetch-depth: 0 # required for use of git history fetch-depth: 0 # required for use of git history
- uses: actions/setup-node@v4 - uses: actions/setup-node@v7
with: with:
node-version: 'lts/*' node-version: 'lts/*'
registry-url: 'https://registry.npmjs.org' registry-url: 'https://registry.npmjs.org'
- uses: pnpm/action-setup@v4 - uses: pnpm/action-setup@v6
with: with:
version: 10.x.x
run_install: true run_install: true
- name: cargo login - name: cargo login
@@ -74,7 +73,7 @@ jobs:
- name: Create Pull Request With Versions Bumped - name: Create Pull Request With Versions Bumped
id: cpr id: cpr
uses: peter-evans/create-pull-request@dd2324fc52d5d43c699a5636bcf19fceaa70c284 # 7.0.7 uses: peter-evans/create-pull-request@v8.1.1
if: steps.covector.outputs.commandRan == 'version' if: steps.covector.outputs.commandRan == 'version'
with: with:
title: 'Publish New Versions (${{ github.ref_name }})' title: 'Publish New Versions (${{ github.ref_name }})'
+6 -7
View File
@@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v7
- name: install Rust stable and rustfmt - name: install Rust stable and rustfmt
uses: dtolnay/rust-toolchain@stable uses: dtolnay/rust-toolchain@stable
@@ -25,20 +25,19 @@ jobs:
prettier: prettier:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v7
- name: Cache pnpm modules - name: Cache pnpm modules
uses: actions/cache@v4 uses: actions/cache@v6
with: with:
path: ~/.pnpm-store path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: | restore-keys: |
${{ runner.os }}- ${{ runner.os }}-
- uses: actions/setup-node@v4 - uses: actions/setup-node@v7
with: with:
node-version: 'lts/*' node-version: 'lts/*'
- uses: pnpm/action-setup@v4 - uses: pnpm/action-setup@v6
with: with:
version: 10.x.x
run_install: true run_install: true
- run: pnpm format:check - run: pnpm format:check
@@ -46,7 +45,7 @@ jobs:
name: taplo (.toml files) name: taplo (.toml files)
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v7
- name: install Rust stable - name: install Rust stable
uses: dtolnay/rust-toolchain@stable uses: dtolnay/rust-toolchain@stable
+1 -1
View File
@@ -31,7 +31,7 @@ jobs:
platform: [ubuntu-22.04, macos-latest, windows-latest] platform: [ubuntu-22.04, macos-latest, windows-latest]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v7
with: with:
fetch-depth: 0 fetch-depth: 0
+4 -5
View File
@@ -36,20 +36,19 @@ jobs:
eslint: eslint:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v7
- name: Cache pnpm modules - name: Cache pnpm modules
uses: actions/cache@v4 uses: actions/cache@v6
with: with:
path: ~/.pnpm-store path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: | restore-keys: |
${{ runner.os }}- ${{ runner.os }}-
- uses: actions/setup-node@v4 - uses: actions/setup-node@v7
with: with:
node-version: 'lts/*' node-version: 'lts/*'
- uses: pnpm/action-setup@v4 - uses: pnpm/action-setup@v6
with: with:
version: 10.x.x
run_install: true run_install: true
- name: eslint - name: eslint
run: pnpm lint run: pnpm lint
+2 -2
View File
@@ -36,7 +36,7 @@ jobs:
outputs: outputs:
packages: ${{ steps.filter.outputs.changes }} packages: ${{ steps.filter.outputs.changes }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v7
- uses: dorny/paths-filter@v2 - uses: dorny/paths-filter@v2
id: filter id: filter
with: with:
@@ -136,7 +136,7 @@ jobs:
package: ${{ fromJSON(needs.changes.outputs.packages) }} package: ${{ fromJSON(needs.changes.outputs.packages) }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v7
- name: install webkit2gtk - name: install webkit2gtk
run: | run: |
+4 -5
View File
@@ -19,26 +19,25 @@ jobs:
sync-to-mirrors: sync-to-mirrors:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v7
- name: Fetch git tags - name: Fetch git tags
run: git fetch origin 'refs/tags/*:refs/tags/*' run: git fetch origin 'refs/tags/*:refs/tags/*'
- name: Cache pnpm modules - name: Cache pnpm modules
uses: actions/cache@v4 uses: actions/cache@v6
with: with:
path: ~/.pnpm-store path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: | restore-keys: |
${{ runner.os }}- ${{ runner.os }}-
- uses: actions/setup-node@v4 - uses: actions/setup-node@v7
with: with:
node-version: 'lts/*' node-version: 'lts/*'
- uses: pnpm/action-setup@v4 - uses: pnpm/action-setup@v6
with: with:
version: 10.x.x
run_install: true run_install: true
- name: Build packages - name: Build packages
+2 -2
View File
@@ -38,7 +38,7 @@ jobs:
outputs: outputs:
packages: ${{ steps.filter.outputs.changes }} packages: ${{ steps.filter.outputs.changes }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v7
- uses: dorny/paths-filter@v2 - uses: dorny/paths-filter@v2
id: filter id: filter
with: with:
@@ -225,7 +225,7 @@ jobs:
runs-on: ${{ matrix.platform.os }} runs-on: ${{ matrix.platform.os }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v7
- name: install webkit2gtk - name: install webkit2gtk
if: contains(matrix.platform.target, 'unknown-linux') if: contains(matrix.platform.target, 'unknown-linux')
Generated
+28 -28
View File
@@ -207,7 +207,7 @@ checksum = "2a4385e2e34eb35d6b3efe798b9eb88096925d87726c0798709bf56d9ed84af3"
[[package]] [[package]]
name = "api" name = "api"
version = "2.0.45" version = "2.0.46"
dependencies = [ dependencies = [
"log", "log",
"serde", "serde",
@@ -300,7 +300,7 @@ dependencies = [
"objc2-foundation 0.3.0", "objc2-foundation 0.3.0",
"parking_lot", "parking_lot",
"percent-encoding", "percent-encoding",
"windows-sys 0.52.0", "windows-sys 0.59.0",
"wl-clipboard-rs", "wl-clipboard-rs",
"x11rb", "x11rb",
] ]
@@ -1041,7 +1041,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c" checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c"
dependencies = [ dependencies = [
"lazy_static", "lazy_static",
"windows-sys 0.48.0", "windows-sys 0.59.0",
] ]
[[package]] [[package]]
@@ -1862,7 +1862,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "976dd42dc7e85965fe702eb8164f21f450704bdde31faefd6471dba214cb594e" checksum = "976dd42dc7e85965fe702eb8164f21f450704bdde31faefd6471dba214cb594e"
dependencies = [ dependencies = [
"libc", "libc",
"windows-sys 0.52.0", "windows-sys 0.59.0",
] ]
[[package]] [[package]]
@@ -4717,7 +4717,7 @@ dependencies = [
"once_cell", "once_cell",
"socket2", "socket2",
"tracing", "tracing",
"windows-sys 0.52.0", "windows-sys 0.59.0",
] ]
[[package]] [[package]]
@@ -5167,7 +5167,7 @@ dependencies = [
"errno", "errno",
"libc", "libc",
"linux-raw-sys 0.4.15", "linux-raw-sys 0.4.15",
"windows-sys 0.52.0", "windows-sys 0.59.0",
] ]
[[package]] [[package]]
@@ -5180,7 +5180,7 @@ dependencies = [
"errno", "errno",
"libc", "libc",
"linux-raw-sys 0.11.0", "linux-raw-sys 0.11.0",
"windows-sys 0.52.0", "windows-sys 0.60.2",
] ]
[[package]] [[package]]
@@ -5237,7 +5237,7 @@ dependencies = [
"security-framework 3.5.1", "security-framework 3.5.1",
"security-framework-sys", "security-framework-sys",
"webpki-root-certs", "webpki-root-certs",
"windows-sys 0.52.0", "windows-sys 0.60.2",
] ]
[[package]] [[package]]
@@ -6309,9 +6309,9 @@ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
[[package]] [[package]]
name = "tauri" name = "tauri"
version = "2.11.1" version = "2.11.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b93bd86d231f0a8138f11a02a584769fe4b703dc36ae133d783228dbc4801405" checksum = "667b20e2726d572dea2de7370da16e188eb06008faf9a92fab7cdc46791190b5"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bytes", "bytes",
@@ -6364,9 +6364,9 @@ dependencies = [
[[package]] [[package]]
name = "tauri-build" name = "tauri-build"
version = "2.6.1" version = "2.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a318b234cc2dea65f575467bafcfb76286bce228ebc3778e337d61d03213007" checksum = "bc9ce40b16101cb6ea63d3e221567affd1c3a9205f95d7bc574941a10636b632"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"cargo_toml", "cargo_toml",
@@ -6387,9 +6387,9 @@ dependencies = [
[[package]] [[package]]
name = "tauri-codegen" name = "tauri-codegen"
version = "2.6.1" version = "2.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6bd11644962add2549a60b7e7c6800f17d7020156e02f516021d8103e80cc528" checksum = "08279169ff42f8fc45a1dbc9dcae888893ba95288142e5880c59b93a26d2cfc5"
dependencies = [ dependencies = [
"base64 0.22.1", "base64 0.22.1",
"ico", "ico",
@@ -6413,9 +6413,9 @@ dependencies = [
[[package]] [[package]]
name = "tauri-macros" name = "tauri-macros"
version = "2.6.1" version = "2.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fed9d3742a37a355d2e47c9af924e9fbc112abb76f9835d35d4780e318419502" checksum = "e8b394794f399a421811d06966343e7933fcae92d59f5180b9388d1174497a45"
dependencies = [ dependencies = [
"heck 0.5.0", "heck 0.5.0",
"proc-macro2", "proc-macro2",
@@ -6525,7 +6525,7 @@ dependencies = [
[[package]] [[package]]
name = "tauri-plugin-dialog" name = "tauri-plugin-dialog"
version = "2.7.1" version = "2.7.2"
dependencies = [ dependencies = [
"log", "log",
"raw-window-handle", "raw-window-handle",
@@ -6817,7 +6817,7 @@ dependencies = [
[[package]] [[package]]
name = "tauri-plugin-store" name = "tauri-plugin-store"
version = "2.4.3" version = "2.4.4"
dependencies = [ dependencies = [
"dunce", "dunce",
"serde", "serde",
@@ -6932,9 +6932,9 @@ dependencies = [
[[package]] [[package]]
name = "tauri-runtime" name = "tauri-runtime"
version = "2.11.1" version = "2.11.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8fef478ba1d2ac21c2d528740b24d0cb315e1e8b1111aae53fafac34804371fc" checksum = "b0b4bc95aed361b0019067d189a1174a603d460d0f6c72606512d59fc9c12ec8"
dependencies = [ dependencies = [
"cookie", "cookie",
"dpi", "dpi",
@@ -6957,9 +6957,9 @@ dependencies = [
[[package]] [[package]]
name = "tauri-runtime-wry" name = "tauri-runtime-wry"
version = "2.11.1" version = "2.11.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3989df2ae1c476404fe0a2e8ffc4cfbde97e51efd613c2bb5355fbc9ab52cf0" checksum = "4e6fac707727b7a2f48e4ded90976324267371073edbb415ffb73bb0458d203f"
dependencies = [ dependencies = [
"gtk", "gtk",
"http", "http",
@@ -6983,9 +6983,9 @@ dependencies = [
[[package]] [[package]]
name = "tauri-utils" name = "tauri-utils"
version = "2.9.1" version = "2.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d57200389a2f82b4b0a40ae29ca19b6978116e8f4d4e974c3234ce40c0ffbdec" checksum = "3e176a18e67764923c4f1ce66f25ae4abe5f688384d5eb1a0fa6c77f3d90f887"
dependencies = [ dependencies = [
"aes-gcm", "aes-gcm",
"anyhow", "anyhow",
@@ -7052,7 +7052,7 @@ dependencies = [
"getrandom 0.3.2", "getrandom 0.3.2",
"once_cell", "once_cell",
"rustix 1.1.3", "rustix 1.1.3",
"windows-sys 0.52.0", "windows-sys 0.60.2",
] ]
[[package]] [[package]]
@@ -7467,9 +7467,9 @@ dependencies = [
[[package]] [[package]]
name = "tray-icon" name = "tray-icon"
version = "0.23.1" version = "0.24.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "15edbb0d80583e85ee8df283410038e17314df5cba30da2087a54a85216c0773" checksum = "65ba1e5f6b9ef9fd87e21b9c6f351554dbd717960089168fcfdef854686961dc"
dependencies = [ dependencies = [
"crossbeam-channel", "crossbeam-channel",
"dirs 6.0.0", "dirs 6.0.0",
@@ -8186,7 +8186,7 @@ version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
dependencies = [ dependencies = [
"windows-sys 0.48.0", "windows-sys 0.59.0",
] ]
[[package]] [[package]]
+7
View File
@@ -1,5 +1,12 @@
# Changelog # Changelog
## \[2.0.42]
### Dependencies
- Upgraded to `dialog-js@2.7.2`
- Upgraded to `store-js@2.4.4`
## \[2.0.41] ## \[2.0.41]
### Dependencies ### Dependencies
+3 -2
View File
@@ -1,12 +1,13 @@
<!doctype html> <!doctype html>
<html lang="en" theme="dark"> <html lang="en">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta <meta
name="viewport" name="viewport"
content="width=device-width, initial-scale=1.0, viewport-fit=cover, user-scalable=0" content="width=device-width, initial-scale=1.0, viewport-fit=cover, user-scalable=0"
/> />
<title>Svelte + Vite App</title> <meta name="color-scheme" content="dark light" />
<title>API Example App</title>
</head> </head>
<body> <body>
+24 -24
View File
@@ -1,7 +1,7 @@
{ {
"name": "api", "name": "api",
"private": true, "private": true,
"version": "2.0.41", "version": "2.0.42",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite --clearScreen false", "dev": "vite --clearScreen false",
@@ -11,35 +11,35 @@
}, },
"dependencies": { "dependencies": {
"@tauri-apps/api": "^2.11.0", "@tauri-apps/api": "^2.11.0",
"@tauri-apps/plugin-barcode-scanner": "^2.4.5", "@tauri-apps/plugin-barcode-scanner": "workspace:*",
"@tauri-apps/plugin-biometric": "^2.3.2", "@tauri-apps/plugin-biometric": "workspace:*",
"@tauri-apps/plugin-cli": "^2.4.1", "@tauri-apps/plugin-cli": "workspace:*",
"@tauri-apps/plugin-clipboard-manager": "^2.3.2", "@tauri-apps/plugin-clipboard-manager": "workspace:*",
"@tauri-apps/plugin-dialog": "^2.7.1", "@tauri-apps/plugin-dialog": "workspace:*",
"@tauri-apps/plugin-fs": "^2.5.1", "@tauri-apps/plugin-fs": "workspace:*",
"@tauri-apps/plugin-geolocation": "^2.3.2", "@tauri-apps/plugin-geolocation": "workspace:*",
"@tauri-apps/plugin-global-shortcut": "^2.3.2", "@tauri-apps/plugin-global-shortcut": "workspace:*",
"@tauri-apps/plugin-haptics": "^2.3.2", "@tauri-apps/plugin-haptics": "workspace:*",
"@tauri-apps/plugin-http": "^2.5.9", "@tauri-apps/plugin-http": "workspace:*",
"@tauri-apps/plugin-nfc": "^2.3.5", "@tauri-apps/plugin-nfc": "workspace:*",
"@tauri-apps/plugin-notification": "^2.3.3", "@tauri-apps/plugin-notification": "workspace:*",
"@tauri-apps/plugin-opener": "^2.5.4", "@tauri-apps/plugin-opener": "workspace:*",
"@tauri-apps/plugin-os": "^2.3.2", "@tauri-apps/plugin-os": "workspace:*",
"@tauri-apps/plugin-process": "^2.3.1", "@tauri-apps/plugin-process": "workspace:*",
"@tauri-apps/plugin-shell": "^2.3.5", "@tauri-apps/plugin-shell": "workspace:*",
"@tauri-apps/plugin-store": "^2.4.3", "@tauri-apps/plugin-store": "workspace:*",
"@tauri-apps/plugin-updater": "^2.10.1", "@tauri-apps/plugin-updater": "workspace:*",
"@tauri-apps/plugin-upload": "^2.4.0", "@tauri-apps/plugin-upload": "workspace:*",
"@zerodevx/svelte-json-view": "1.0.11" "@zerodevx/svelte-json-view": "2.0.0"
}, },
"devDependencies": { "devDependencies": {
"@iconify-json/codicon": "^1.2.49", "@iconify-json/codicon": "^1.2.49",
"@iconify-json/ph": "^1.2.2", "@iconify-json/ph": "^1.2.2",
"@sveltejs/vite-plugin-svelte": "^7.0.0", "@sveltejs/vite-plugin-svelte": "^7.0.0",
"@tauri-apps/cli": "2.11.2", "@tauri-apps/cli": "2.11.4",
"@unocss/extractor-svelte": "^66.6.7", "@unocss/extractor-svelte": "^66.6.7",
"svelte": "^5.54.0", "svelte": "^5.55.7",
"unocss": "^66.6.7", "unocss": "^66.6.7",
"vite": "^8.0.1" "vite": "^8.0.16"
} }
} }
+7
View File
@@ -1,5 +1,12 @@
# Changelog # Changelog
## \[2.0.46]
### Dependencies
- Upgraded to `dialog@2.7.2`
- Upgraded to `store@2.4.4`
## \[2.0.45] ## \[2.0.45]
### Dependencies ### Dependencies
+3 -6
View File
@@ -1,7 +1,7 @@
[package] [package]
name = "api" name = "api"
publish = false publish = false
version = "2.0.45" version = "2.0.46"
description = "An example Tauri Application showcasing the api" description = "An example Tauri Application showcasing the api"
edition = "2021" edition = "2021"
rust-version = { workspace = true } rust-version = { workspace = true }
@@ -25,7 +25,7 @@ tauri-plugin-fs = { path = "../../../plugins/fs", version = "2.5.1", features =
"watch", "watch",
] } ] }
tauri-plugin-clipboard-manager = { path = "../../../plugins/clipboard-manager", version = "2.3.2" } tauri-plugin-clipboard-manager = { path = "../../../plugins/clipboard-manager", version = "2.3.2" }
tauri-plugin-dialog = { path = "../../../plugins/dialog", version = "2.7.1" } tauri-plugin-dialog = { path = "../../../plugins/dialog", version = "2.7.2" }
tauri-plugin-http = { path = "../../../plugins/http", features = [ tauri-plugin-http = { path = "../../../plugins/http", features = [
"multipart", "multipart",
"cookies", "cookies",
@@ -37,7 +37,7 @@ tauri-plugin-os = { path = "../../../plugins/os", version = "2.3.2" }
tauri-plugin-process = { path = "../../../plugins/process", version = "2.3.1" } tauri-plugin-process = { path = "../../../plugins/process", version = "2.3.1" }
tauri-plugin-opener = { path = "../../../plugins/opener", version = "2.5.4" } tauri-plugin-opener = { path = "../../../plugins/opener", version = "2.5.4" }
tauri-plugin-shell = { path = "../../../plugins/shell", version = "2.3.5" } tauri-plugin-shell = { path = "../../../plugins/shell", version = "2.3.5" }
tauri-plugin-store = { path = "../../../plugins/store", version = "2.4.3" } tauri-plugin-store = { path = "../../../plugins/store", version = "2.4.4" }
tauri-plugin-upload = { path = "../../../plugins/upload", version = "2.3.0" } tauri-plugin-upload = { path = "../../../plugins/upload", version = "2.3.0" }
[dependencies.tauri] [dependencies.tauri]
@@ -66,6 +66,3 @@ tauri-plugin-nfc = { path = "../../../plugins/nfc", version = "2.3.5" }
tauri-plugin-biometric = { path = "../../../plugins/biometric/", version = "2.3.2" } tauri-plugin-biometric = { path = "../../../plugins/biometric/", version = "2.3.2" }
tauri-plugin-geolocation = { path = "../../../plugins/geolocation/", version = "2.3.2" } tauri-plugin-geolocation = { path = "../../../plugins/geolocation/", version = "2.3.2" }
tauri-plugin-haptics = { path = "../../../plugins/haptics/", version = "2.3.2" } tauri-plugin-haptics = { path = "../../../plugins/haptics/", version = "2.3.2" }
[features]
prod = ["tauri/custom-protocol"]
@@ -15,10 +15,10 @@
] ]
}, },
"core:default", "core:default",
"core:app:allow-set-app-theme",
"fs:default", "fs:default",
"core:window:allow-minimize", "core:window:allow-minimize",
"core:window:allow-maximize", "core:window:allow-toggle-maximize",
"core:window:allow-unmaximize",
"core:window:allow-close", "core:window:allow-close",
"core:window:allow-start-dragging", "core:window:allow-start-dragging",
"notification:default", "notification:default",
@@ -1,3 +1,11 @@
package com.tauri.api package com.tauri.api
class MainActivity : TauriActivity() import android.os.Bundle
import androidx.activity.enableEdgeToEdge
class MainActivity : TauriActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
enableEdgeToEdge()
super.onCreate(savedInstanceState)
}
}
@@ -1,6 +1,6 @@
<resources xmlns:tools="http://schemas.android.com/tools"> <resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. --> <!-- Base application theme. -->
<style name="Theme.api" parent="Theme.MaterialComponents.DayNight.NoActionBar"> <style name="Theme.api" parent="Theme.Material3.DayNight.NoActionBar">
<!-- Customize your theme here. --> <!-- Customize your theme here. -->
</style> </style>
</resources> </resources>
@@ -1,6 +1,6 @@
<resources xmlns:tools="http://schemas.android.com/tools"> <resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. --> <!-- Base application theme. -->
<style name="Theme.api" parent="Theme.MaterialComponents.DayNight.NoActionBar"> <style name="Theme.api" parent="Theme.Material3.DayNight.NoActionBar">
<!-- Customize your theme here. --> <!-- Customize your theme here. -->
</style> </style>
</resources> </resources>
@@ -21,7 +21,23 @@ open class BuildTask : DefaultTask() {
runTauriCli(executable) runTauriCli(executable)
} catch (e: Exception) { } catch (e: Exception) {
if (Os.isFamily(Os.FAMILY_WINDOWS)) { if (Os.isFamily(Os.FAMILY_WINDOWS)) {
runTauriCli("$executable.cmd") // Try different Windows-specific extensions
val fallbacks = listOf(
"$executable.exe",
"$executable.cmd",
"$executable.bat",
)
var lastException: Exception = e
for (fallback in fallbacks) {
try {
runTauriCli(fallback)
return
} catch (fallbackException: Exception) {
lastException = fallbackException
}
}
throw lastException
} else { } else {
throw e; throw e;
} }
@@ -1,6 +1,6 @@
#Tue May 10 19:22:52 CST 2022 #Tue May 10 19:22:52 CST 2022
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
+5
View File
@@ -77,7 +77,9 @@
}, },
"updater": { "updater": {
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDE5QzMxNjYwNTM5OEUwNTgKUldSWTRKaFRZQmJER1h4d1ZMYVA3dnluSjdpN2RmMldJR09hUFFlZDY0SlFqckkvRUJhZDJVZXAK", "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDE5QzMxNjYwNTM5OEUwNTgKUldSWTRKaFRZQmJER1h4d1ZMYVA3dnluSjdpN2RmMldJR09hUFFlZDY0SlFqckkvRUJhZDJVZXAK",
"dangerousInsecureTransportProtocol": true,
"endpoints": [ "endpoints": [
"http://localhost:5173/updater-test/updater.json",
"https://tauri-update-server.vercel.app/update/{{target}}/{{current_version}}" "https://tauri-update-server.vercel.app/update/{{target}}/{{current_version}}"
] ]
} }
@@ -99,6 +101,9 @@
"localePath": "locales/pt-BR.wxl" "localePath": "locales/pt-BR.wxl"
} }
} }
},
"nsis": {
"compression": "none"
} }
}, },
"iOS": { "iOS": {
+119 -186
View File
@@ -1,7 +1,16 @@
<script> <script module lang="ts">
export type ViewProps = {
onMessage: (value: unknown) => void
}
</script>
<script lang="ts">
import { onMount, tick } from 'svelte'
import { writable } from 'svelte/store' import { writable } from 'svelte/store'
import { getCurrentWindow } from '@tauri-apps/api/window' import { MediaQuery } from 'svelte/reactivity'
import { getCurrentWindow, type Theme } from '@tauri-apps/api/window'
import { getCurrentWebview } from '@tauri-apps/api/webview' import { getCurrentWebview } from '@tauri-apps/api/webview'
import { setTheme } from '@tauri-apps/api/app'
import * as os from '@tauri-apps/plugin-os' import * as os from '@tauri-apps/plugin-os'
import Welcome from './views/Welcome.svelte' import Welcome from './views/Welcome.svelte'
@@ -23,11 +32,10 @@
import Biometric from './views/Biometric.svelte' import Biometric from './views/Biometric.svelte'
import Geolocation from './views/Geolocation.svelte' import Geolocation from './views/Geolocation.svelte'
import Haptics from './views/Haptics.svelte' import Haptics from './views/Haptics.svelte'
import { onMount, tick } from 'svelte'
import { ask } from '@tauri-apps/plugin-dialog'
import Nfc from './views/Nfc.svelte' import Nfc from './views/Nfc.svelte'
import TitleBar from './lib/TitleBar.svelte'
const appWindow = getCurrentWindow() const appWindow = getCurrentWindow()
if (appWindow.label !== 'main') { if (appWindow.label !== 'main') {
@@ -148,114 +156,98 @@
component: Haptics, component: Haptics,
icon: 'i-ph-vibrate' icon: 'i-ph-vibrate'
} }
] ].filter(Boolean) as {
label: string
component: typeof Haptics
icon: string
}[]
let selected = $state.raw(views[0])
let selected = views[0] // dark/light themes
function select(view) { const preferDark = new MediaQuery('prefers-color-scheme: dark')
selected = view let theme = $state<Theme | 'auto'>(
} (localStorage.getItem('theme') as Theme | null) || 'auto'
// Window controls
let isWindowMaximized
onMount(async () => {
isWindowMaximized = await appWindow.isMaximized()
appWindow.onResized(async () => {
isWindowMaximized = await appWindow.isMaximized()
})
})
function minimize() {
appWindow.minimize()
}
async function toggleMaximize() {
;(await appWindow.isMaximized())
? appWindow.unmaximize()
: appWindow.maximize()
}
let confirmed_close = false
async function close() {
if (!confirmed_close) {
confirmed_close = await ask(
'Are you sure that you want to close this window?',
{
title: 'Tauri API'
}
) )
if (confirmed_close) {
appWindow.close() async function switchTheme() {
} switch (theme) {
case 'dark':
theme = 'light'
break
case 'light':
theme = 'auto'
break
case 'auto':
theme = 'dark'
break
} }
applyTheme()
} }
// dark/light function applyTheme() {
let isDark const isDark = theme === 'auto' ? preferDark.current : theme === 'dark'
onMount(() => { if (isDark) {
isDark = localStorage && localStorage.getItem('theme') == 'dark' document.documentElement.classList.add('dark')
applyTheme(isDark) document.documentElement.classList.remove('light')
} else {
document.documentElement.classList.remove('dark')
document.documentElement.classList.add('light')
}
setTheme(theme === 'auto' ? null : theme)
localStorage.setItem('theme', theme)
}
$effect(() => {
applyTheme()
}) })
function applyTheme(isDark) {
const html = document.querySelector('html')
isDark ? html.classList.add('dark') : html.classList.remove('dark')
localStorage && localStorage.setItem('theme', isDark ? 'dark' : '')
}
function toggleDark() {
isDark = !isDark
applyTheme(isDark)
}
// Console // Console
let messages = writable([]) const messages = writable<string[]>([])
let consoleTextEl let consoleTextEl: HTMLDivElement
async function onMessage(value) {
// this function is renders HTML without sanitizing it so it's insecure
// we only use it with our own input data
async function insecureRenderHtml(html: string) {
messages.update((r) => [ messages.update((r) => [
...r, ...r,
{ `<pre><strong class="text-accent dark:text-darkAccent">[${new Date().toLocaleTimeString()}]:</strong> ${html}</pre>`
html:
`<pre><strong class="text-accent dark:text-darkAccent">[${new Date().toLocaleTimeString()}]:</strong> ` +
(typeof value === 'string' ? value : JSON.stringify(value, null, 1)) +
'</pre>'
}
]) ])
await tick() await tick()
if (consoleTextEl) consoleTextEl.scrollTop = consoleTextEl.scrollHeight consoleTextEl.scrollTop = consoleTextEl.scrollHeight
} }
// this function renders HTML without sanitizing it so it's insecure async function onMessage(value: unknown) {
// we only use it with our own input data const valueStr =
async function insecureRenderHtml(html) { typeof value === 'string'
messages.update((r) => [ ? value
...r, : JSON.stringify(
{ value instanceof ArrayBuffer
html: ? Array.from(new Uint8Array(value))
`<pre><strong class="text-accent dark:text-darkAccent">[${new Date().toLocaleTimeString()}]:</strong> ` + : value,
html + null,
'</pre>' 1
} )
]) insecureRenderHtml(valueStr)
await tick()
if (consoleTextEl) consoleTextEl.scrollTop = consoleTextEl.scrollHeight
} }
function clear() { function clear() {
messages.update(() => []) messages.update(() => [])
} }
let consoleEl, consoleH, cStartY let consoleEl: HTMLDivElement
let minConsoleHeight = 50 let consoleH = 0
function startResizingConsole(e) { let cStartY = 0
const minConsoleHeight = 50
function startResizingConsole(e: MouseEvent) {
cStartY = e.clientY cStartY = e.clientY
const styles = window.getComputedStyle(consoleEl) const styles = window.getComputedStyle(consoleEl)
consoleH = parseInt(styles.height, 10) consoleH = parseInt(styles.height, 10)
const moveHandler = (e) => { const moveHandler = (e: MouseEvent) => {
const dy = e.clientY - cStartY const dy = e.clientY - cStartY
const newH = consoleH - dy const newH = consoleH - dy
consoleEl.style.height = `${ consoleEl.style.height = `${newH < minConsoleHeight ? minConsoleHeight : newH}px`
newH < minConsoleHeight ? minConsoleHeight : newH
}px`
} }
const upHandler = () => { const upHandler = () => {
document.removeEventListener('mouseup', upHandler) document.removeEventListener('mouseup', upHandler)
@@ -265,21 +257,19 @@
document.addEventListener('mousemove', moveHandler) document.addEventListener('mousemove', moveHandler)
} }
let isWindows let isWindows = os.platform() === 'windows'
onMount(async () => {
isWindows = (await os.platform()) === 'windows'
})
// mobile // mobile
let isSideBarOpen = false let isSideBarOpen = $state(false)
let sidebar let sidebar: HTMLElement
let sidebarToggle let sidebarToggle: HTMLElement
let isDraggingSideBar = false let isDraggingSideBar = false
let draggingStartPosX = 0 let draggingStartPosX = 0
let draggingEndPosX = 0 let draggingEndPosX = 0
const clamp = (min, num, max) => Math.min(Math.max(num, min), max) const clamp = (min: number, num: number, max: number) =>
Math.min(Math.max(num, min), max)
function toggleSidebar(sidebar, isSideBarOpen) { function toggleSidebar() {
sidebar.style.setProperty( sidebar.style.setProperty(
'--translate-x', '--translate-x',
`${isSideBarOpen ? '0' : '-18.75'}rem` `${isSideBarOpen ? '0' : '-18.75'}rem`
@@ -287,10 +277,9 @@
} }
onMount(() => { onMount(() => {
sidebar = document.querySelector('#sidebar')
sidebarToggle = document.querySelector('#sidebarToggle')
document.addEventListener('click', (e) => { document.addEventListener('click', (e) => {
if (!(e.target instanceof Node)) return
if (sidebarToggle.contains(e.target)) { if (sidebarToggle.contains(e.target)) {
isSideBarOpen = !isSideBarOpen isSideBarOpen = !isSideBarOpen
} else if (isSideBarOpen && !sidebar.contains(e.target)) { } else if (isSideBarOpen && !sidebar.contains(e.target)) {
@@ -299,6 +288,7 @@
}) })
document.addEventListener('touchstart', (e) => { document.addEventListener('touchstart', (e) => {
if (!(e.target instanceof Node)) return
if (sidebarToggle.contains(e.target)) return if (sidebarToggle.contains(e.target)) return
const x = e.touches[0].clientX const x = e.touches[0].clientX
@@ -330,76 +320,22 @@
}) })
}) })
$: { $effect(() => {
const sidebar = document.querySelector('#sidebar') toggleSidebar()
if (sidebar) { })
toggleSidebar(sidebar, isSideBarOpen)
}
}
</script> </script>
<!-- custom titlebar for Windows --> <!-- custom titlebar for Windows -->
{#if isWindows} {#if isWindows}
<div <TitleBar {appWindow} {theme} {switchTheme} />
class="w-screen select-none h-8 pl-2 flex justify-between items-center absolute text-primaryText dark:text-darkPrimaryText"
data-tauri-drag-region
>
<span class="lt-sm:pl-10 text-darkPrimaryText">Tauri API Validation</span>
<span
class="
h-100%
children:h-100% children:w-12 children:inline-flex
children:items-center children:justify-center"
>
<button
aria-label="Toggle dark mode"
title={isDark ? 'Switch to Light mode' : 'Switch to Dark mode'}
class="bg-inherit border-none hover:bg-hoverOverlay active:bg-hoverOverlayDarker dark:hover:bg-darkHoverOverlay dark:active:bg-darkHoverOverlayDarker"
on:click={toggleDark}
>
{#if isDark}
<div class="i-ph-sun"></div>
{:else}
<div class="i-ph-moon"></div>
{/if}
</button>
<button
aria-label="Minimize window"
title="Minimize"
class="bg-inherit border-none hover:bg-hoverOverlay active:bg-hoverOverlayDarker dark:hover:bg-darkHoverOverlay dark:active:bg-darkHoverOverlayDarker"
on:click={minimize}
>
<div class="i-codicon-chrome-minimize"></div>
</button>
<button
aria-label="Maximize window"
title={isWindowMaximized ? 'Restore' : 'Maximize'}
class="bg-inherit border-none hover:bg-hoverOverlay active:bg-hoverOverlayDarker dark:hover:bg-darkHoverOverlay dark:active:bg-darkHoverOverlayDarker"
on:click={toggleMaximize}
>
{#if isWindowMaximized}
<div class="i-codicon-chrome-restore"></div>
{:else}
<div class="i-codicon-chrome-maximize"></div>
{/if}
</button>
<button
aria-label="Close window"
title="Close"
class="bg-inherit border-none hover:bg-red-700 dark:hover:bg-red-700 hover:text-darkPrimaryText active:bg-red-700/90 dark:active:bg-red-700/90 active:text-darkPrimaryText"
on:click={close}
>
<div class="i-codicon-chrome-close"></div>
</button>
</span>
</div>
{/if} {/if}
<!-- Sidebar toggle, only visible on small screens --> <!-- Sidebar toggle, only visible on small screens -->
<div <div
id="sidebarToggle" id="sidebarToggle"
class="z-2000 sidebar-toggle hidden lt-sm:flex justify-center absolute items-center w-8 h-8 rd-8 bind:this={sidebarToggle}
bg-accent dark:bg-darkAccent active:bg-accentDark dark:active:bg-darkAccentDark" class="z-2000 hidden lt-sm:flex justify-center absolute items-center w-8 h-8 rd-8
bg-accent dark:bg-darkAccent active:bg-accentDark dark:active:bg-darkAccentDark text-accentText dark:text-darkAccentText"
> >
{#if isSideBarOpen} {#if isSideBarOpen}
<span class="i-codicon-close animate-duration-300ms animate-fade-in"></span> <span class="i-codicon-close animate-duration-300ms animate-fade-in"></span>
@@ -409,10 +345,11 @@
</div> </div>
<div <div
class="flex h-screen w-screen overflow-hidden children-pt8 children-pb-2 text-primaryText dark:text-darkPrimaryText" class="flex h-screen w-screen overflow-hidden text-primaryText dark:text-darkPrimaryText"
> >
<aside <aside
id="sidebar" id="sidebar"
bind:this={sidebar}
class="lt-sm:h-screen lt-sm:shadow-lg lt-sm:shadow lt-sm:transition-transform lt-sm:absolute lt-sm:z-1999 class="lt-sm:h-screen lt-sm:shadow-lg lt-sm:shadow lt-sm:transition-transform lt-sm:absolute lt-sm:z-1999
bg-darkPrimaryLighter transition-colors-250 overflow-hidden grid select-none px-2" bg-darkPrimaryLighter transition-colors-250 overflow-hidden grid select-none px-2"
> >
@@ -420,13 +357,16 @@
<img class="p-7" src="tauri_logo.png" alt="Tauri logo" /> <img class="p-7" src="tauri_logo.png" alt="Tauri logo" />
</a> </a>
{#if !isWindows} {#if !isWindows}
<a href="##" class="nv justify-between h-8" on:click={toggleDark}> <a href="##" class="nv justify-between" onclick={switchTheme}>
{#if isDark} {#if theme === 'auto'}
Switch to Light mode
<div class="i-ph-sun"></div>
{:else}
Switch to Dark mode Switch to Dark mode
<div class="i-ph-circle-half-fill"></div>
{:else if theme === 'dark'}
Switch to Light mode
<div class="i-ph-moon"></div> <div class="i-ph-moon"></div>
{:else if theme === 'light'}
Switch to Auto mode
<div class="i-ph-sun"></div>
{/if} {/if}
</a> </a>
<br /> <br />
@@ -435,7 +375,7 @@
{/if} {/if}
<a <a
class="nv justify-between h-8" class="nv justify-between"
target="_blank" target="_blank"
href="https://tauri.app/v1/guides/" href="https://tauri.app/v1/guides/"
> >
@@ -443,7 +383,7 @@
<span class="i-codicon-link-external"></span> <span class="i-codicon-link-external"></span>
</a> </a>
<a <a
class="nv justify-between h-8" class="nv justify-between"
target="_blank" target="_blank"
href="https://github.com/tauri-apps/tauri" href="https://github.com/tauri-apps/tauri"
> >
@@ -451,7 +391,7 @@
<span class="i-codicon-link-external"></span> <span class="i-codicon-link-external"></span>
</a> </a>
<a <a
class="nv justify-between h-8" class="nv justify-between"
target="_blank" target="_blank"
href="https://github.com/tauri-apps/tauri/tree/dev/examples/api" href="https://github.com/tauri-apps/tauri/tree/dev/examples/api"
> >
@@ -461,23 +401,19 @@
<br /> <br />
<div class="bg-white/5 h-2px"></div> <div class="bg-white/5 h-2px"></div>
<br /> <br />
<div <div class="flex flex-col overflow-y-auto children-flex-none gap-1">
class="flex flex-col overflow-y-auto children-h-10 children-flex-none gap-1"
>
{#each views as view} {#each views as view}
{#if view}
<a <a
href="##" href="##"
class="nv {selected === view ? 'nv_selected' : ''}" class="nv {selected === view ? 'nv_selected' : ''}"
on:click={() => { onclick={() => {
select(view) selected = view
isSideBarOpen = false isSideBarOpen = false
}} }}
> >
<div class="{view.icon} mr-2"></div> <div class="{view.icon} mr-2"></div>
<p>{view.label}</p></a <p>{view.label}</p></a
> >
{/if}
{/each} {/each}
</div> </div>
</aside> </aside>
@@ -489,11 +425,7 @@
<h1>{selected.label}</h1> <h1>{selected.label}</h1>
<div class="overflow-y-auto"> <div class="overflow-y-auto">
<div class="mr-2"> <div class="mr-2">
<svelte:component <selected.component {onMessage} />
this={selected.component}
{onMessage}
{insecureRenderHtml}
/>
</div> </div>
</div> </div>
</div> </div>
@@ -503,20 +435,21 @@
id="console" id="console"
class="select-none h-15rem grid grid-rows-[2px_2rem_1fr] gap-1 overflow-hidden" class="select-none h-15rem grid grid-rows-[2px_2rem_1fr] gap-1 overflow-hidden"
> >
<!-- svelte-ignore a11y_no_static_element_interactions -->
<div <div
on:mousedown={startResizingConsole} role="button"
tabindex="0"
onmousedown={startResizingConsole}
class="bg-black/20 h-2px cursor-ns-resize" class="bg-black/20 h-2px cursor-ns-resize"
></div> ></div>
<div class="flex justify-between items-center px-2"> <div class="flex justify-between items-center px-2">
<p class="font-semibold">Console</p> <p class="font-semibold">Console</p>
<button <button
aria-label="Clear Console" aria-label="Clear Console"
class="cursor-pointer h-85% rd-1 p-1 flex justify-center items-center border-none bg-inherit class="cursor-pointer h-85% rd-1 p-1 flex justify-center items-center border-none
hover:bg-hoverOverlay dark:hover:bg-darkHoverOverlay hover:bg-hoverOverlay dark:hover:bg-darkHoverOverlay
active:bg-hoverOverlay/25 dark:active:bg-darkHoverOverlay/25 active:bg-hoverOverlay/25 dark:active:bg-darkHoverOverlay/25
" "
on:click={clear} onclick={clear}
> >
<div class="i-codicon-clear-all"></div> <div class="i-codicon-clear-all"></div>
</button> </button>
@@ -525,8 +458,8 @@
bind:this={consoleTextEl} bind:this={consoleTextEl}
class="px-2 overflow-y-auto all:font-mono code-block all:text-xs select-text mr-2" class="px-2 overflow-y-auto all:font-mono code-block all:text-xs select-text mr-2"
> >
{#each $messages as r} {#each $messages as messageHtml}
{@html r.html} {@html messageHtml}
{/each} {/each}
</div> </div>
</div> </div>
+32 -9
View File
@@ -1,3 +1,14 @@
:root {
line-height: 1.5;
}
:root.dark {
color-scheme: dark;
}
:root.light {
color-scheme: light;
}
*:not(h1, h2, h3, h4, h5, h6) { *:not(h1, h2, h3, h4, h5, h6) {
margin: 0; margin: 0;
padding: 0; padding: 0;
@@ -8,6 +19,11 @@
font-family: 'Rubik', sans-serif; font-family: 'Rubik', sans-serif;
} }
button {
color: inherit;
background-color: inherit;
}
::-webkit-scrollbar { ::-webkit-scrollbar {
width: 0.25rem; width: 0.25rem;
height: 3px; height: 3px;
@@ -33,27 +49,34 @@ code.code-block {
width: 18.75rem; width: 18.75rem;
} }
@media screen and (max-width: 640px) { @media screen and (width < 640px) {
#sidebar { #sidebar {
--translate-x: -18.75rem; --translate-x: -18.75rem;
transform: translateX(var(--translate-x)); transform: translateX(var(--translate-x));
} }
} }
.sidebar-toggle { #sidebar,
margin-top: 0.5rem; main {
margin-left: 0.5rem; padding-top: calc(env(safe-area-inset-top) + 2rem);
} }
body { #sidebar {
overflow: hidden; padding-left: calc(env(safe-area-inset-left) + 0.5rem);
padding: env(safe-area-inset-top) env(safe-area-inset-right) }
env(safe-area-inset-bottom) env(safe-area-inset-left);
main {
padding-right: env(safe-area-inset-right);
}
#sidebarToggle {
margin-top: calc(env(safe-area-inset-top) + 0.5rem);
margin-left: calc(env(safe-area-inset-left) + 0.5rem);
} }
#sidebar, #sidebar,
#console { #console {
padding-bottom: calc(env(safe-area-inset-bottom) + 24px); padding-bottom: calc(env(safe-area-inset-bottom) + 1.5rem);
} }
.transparent { .transparent {
+103
View File
@@ -0,0 +1,103 @@
<script lang="ts">
import type { Theme, Window } from '@tauri-apps/api/window'
import { ask } from '@tauri-apps/plugin-dialog'
import { onMount } from 'svelte'
let {
appWindow,
switchTheme,
theme
}: { appWindow: Window; switchTheme: () => void; theme: Theme | 'auto' } =
$props()
// Window controls
let isWindowMaximized = $state(false)
onMount(async () => {
isWindowMaximized = await appWindow.isMaximized()
appWindow.onResized(async () => {
isWindowMaximized = await appWindow.isMaximized()
})
})
async function minimize() {
await appWindow.minimize()
}
async function toggleMaximize() {
await appWindow.toggleMaximize()
}
let confirmedClose = false
async function close() {
if (!confirmedClose) {
confirmedClose = await ask(
'Are you sure that you want to close this window?',
{
title: 'Tauri API'
}
)
if (confirmedClose) {
appWindow.close()
}
}
}
</script>
<div
class="w-screen select-none h-8 flex justify-between items-center absolute text-primaryText dark:text-darkPrimaryText"
data-tauri-drag-region
>
<span
class="h-100% pl-2 flex-1 flex items-center lt-sm:pl-10 lt-lg:text-darkPrimaryText [app-region:drag]"
>Tauri API Validation</span
>
<span
class="
h-100%
children:h-100% children:w-12 children:inline-flex
children:items-center children:justify-center"
>
<button
aria-label="Toggle dark mode"
title={theme ? 'Switch to Light mode' : 'Switch to Dark mode'}
class="border-none hover:bg-hoverOverlay active:bg-hoverOverlayDarker dark:hover:bg-darkHoverOverlay dark:active:bg-darkHoverOverlayDarker"
onclick={switchTheme}
>
{#if theme === 'auto'}
<div title="Switch to Dark mode" class="i-ph-circle-half-fill"></div>
{:else if theme === 'dark'}
<div title="Switch to Light mode" class="i-ph-moon"></div>
{:else if theme === 'light'}
<div title="Switch to Auto mode" class="i-ph-sun"></div>
{/if}
</button>
<button
aria-label="Minimize window"
title="Minimize"
class="border-none hover:bg-hoverOverlay active:bg-hoverOverlayDarker dark:hover:bg-darkHoverOverlay dark:active:bg-darkHoverOverlayDarker"
onclick={minimize}
>
<div class="i-codicon-chrome-minimize"></div>
</button>
<button
aria-label="Maximize window"
title={isWindowMaximized ? 'Restore' : 'Maximize'}
class="border-none hover:bg-hoverOverlay active:bg-hoverOverlayDarker dark:hover:bg-darkHoverOverlay dark:active:bg-darkHoverOverlayDarker"
onclick={toggleMaximize}
>
{#if isWindowMaximized}
<div class="i-codicon-chrome-restore"></div>
{:else}
<div class="i-codicon-chrome-maximize"></div>
{/if}
</button>
<button
aria-label="Close window"
title="Close"
class="border-none hover:bg-red-700 dark:hover:bg-red-700 hover:text-darkPrimaryText active:bg-red-700/90 dark:active:bg-red-700/90 active:text-darkPrimaryText"
onclick={close}
>
<div class="i-codicon-chrome-close"></div>
</button>
</span>
</div>
+1 -2
View File
@@ -5,7 +5,6 @@
import { readFile } from '@tauri-apps/plugin-fs' import { readFile } from '@tauri-apps/plugin-fs'
export let onMessage export let onMessage
export let insecureRenderHtml
let text = 'clipboard message' let text = 'clipboard message'
function writeText() { function writeText() {
@@ -41,7 +40,7 @@
const image = await clipboard.readImage() const image = await clipboard.readImage()
arrayBufferToBase64(await image.rgba(), function (base64) { arrayBufferToBase64(await image.rgba(), function (base64) {
const src = 'data:image/png;base64,' + base64 const src = 'data:image/png;base64,' + base64
insecureRenderHtml('<img src="' + src + '"></img>') onMessage('<img src="' + src + '"></img>')
}) })
return return
} catch (_) {} } catch (_) {}
+80 -70
View File
@@ -1,129 +1,138 @@
<script> <script lang="ts">
import { open, save, confirm, message } from "@tauri-apps/plugin-dialog"; import {
import { readFile } from "@tauri-apps/plugin-fs"; open,
save,
confirm,
message,
type PickerMode,
type FileAccessMode
} from '@tauri-apps/plugin-dialog'
import { readFile } from '@tauri-apps/plugin-fs'
import type { ViewProps } from '../App.svelte'
export let onMessage; let { onMessage }: ViewProps = $props()
export let insecureRenderHtml;
let defaultPath = null;
let filter = null;
let multiple = false;
let directory = false;
let pickerMode = "document";
let fileAccessMode = "scoped";
function arrayBufferToBase64(buffer, callback) { let defaultPath: string | undefined = $state()
let filter = $state('')
let multiple = $state(false)
let directory = $state(false)
let pickerMode: PickerMode = $state('document')
let fileAccessMode: FileAccessMode = $state('scoped')
function arrayBufferToBase64(
buffer: ArrayBuffer,
callback: (base64: string) => void
) {
var blob = new Blob([buffer], { var blob = new Blob([buffer], {
type: "application/octet-binary", type: 'application/octet-binary'
}); })
var reader = new FileReader(); var reader = new FileReader()
reader.onload = function (evt) { reader.onload = function (evt) {
var dataurl = evt.target.result; var dataurl = evt.target!.result as string
callback(dataurl.substr(dataurl.indexOf(",") + 1)); callback(dataurl.split(',')[1])
}; }
reader.readAsDataURL(blob); reader.readAsDataURL(blob)
} }
async function prompt() { async function prompt() {
confirm("Do you want to do something?") confirm('Do you want to do something?')
.then((res) => onMessage(res ? "Yes" : "No")) .then((res) => onMessage(res ? 'Yes' : 'No'))
.catch(onMessage); .catch(onMessage)
} }
async function promptCustom() { async function promptCustom() {
confirm("Is Tauri awesome?", { confirm('Is Tauri awesome?', {
okLabel: "Absolutely", okLabel: 'Absolutely',
cancelLabel: "Totally", cancelLabel: 'Totally'
}) })
.then((res) => .then((res) =>
onMessage( onMessage(
res ? "Tauri is absolutely awesome" : "Tauri is totally awesome" res ? 'Tauri is absolutely awesome' : 'Tauri is totally awesome'
) )
) )
.catch(onMessage); .catch(onMessage)
} }
async function msg() { async function msg() {
await message("Tauri is awesome!").then((res) => onMessage(res)); await message('Tauri is awesome!').then((res) => onMessage(res))
} }
async function msgCustom(result) { async function msgCustom() {
const buttons = { yes: "awesome", no: "amazing", cancel: "stunning" }; const buttons = { yes: 'awesome', no: 'amazing', cancel: 'stunning' }
await message(`Tauri is: `, { buttons }) await message(`Tauri is: `, { buttons })
.then((res) => onMessage(`Tauri is ${res}`)) .then((res) => onMessage(`Tauri is ${res}`))
.catch(onMessage); .catch(onMessage)
} }
async function openDialog() { async function openDialog() {
try { try {
var result = await open({ const result = await open({
title: "My wonderful open dialog", title: 'My wonderful open dialog',
defaultPath, defaultPath,
filters: filter filters: filter
? [ ? [
{ {
name: "Tauri Example", name: 'Tauri Example',
extensions: filter.split(",").map((f) => f.trim()), extensions: filter.split(',').map((f) => f.trim())
}, }
] ]
: [], : [],
multiple, multiple,
directory, directory,
pickerMode, pickerMode,
fileAccessMode, fileAccessMode
}) })
if (Array.isArray(result)) { if (Array.isArray(result)) {
onMessage(result); onMessage(result)
} else if (result === null) {
onMessage('user cancelled the selection')
} else { } else {
var pathToRead = result; const pathToRead = result
var isFile = pathToRead.match(/\S+\.\S+$/g); const isFile = pathToRead.match(/\S+\.\S+$/g)
await readFile(pathToRead) await readFile(pathToRead).then(function (res) {
.then(function (res) {
if (isFile) { if (isFile) {
if ( if (
pathToRead.includes(".png") || pathToRead.includes('.png')
pathToRead.includes(".jpg") || || pathToRead.includes('.jpg')
pathToRead.includes(".jpeg") || pathToRead.includes('.jpeg')
) { ) {
arrayBufferToBase64( arrayBufferToBase64(res.buffer, function (base64) {
new Uint8Array(res), const src = 'data:image/png;base64,' + base64
function (base64) { onMessage('<img src="' + src + '"></img>')
var src = "data:image/png;base64," + base64; })
insecureRenderHtml('<img src="' + src + '"></img>');
}
);
} else { } else {
// Convert byte array to UTF-8 string // Convert byte array to UTF-8 string
const decoder = new TextDecoder('utf-8'); const decoder = new TextDecoder('utf-8')
const text = decoder.decode(new Uint8Array(res)); const text = decoder.decode(res)
onMessage(text); onMessage(text)
} }
} else { } else {
onMessage(res); onMessage(res)
} }
}) })
} }
} catch(exception) { } catch (exception) {
onMessage(exception) onMessage(exception)
} }
} }
function saveDialog() { function saveDialog() {
save({ save({
title: "My wonderful save dialog", title: 'My wonderful save dialog',
defaultPath, defaultPath,
filters: filter filters: filter
? [ ? [
{ {
name: "Tauri Example", name: 'Tauri Example',
extensions: filter.split(",").map((f) => f.trim()), extensions: filter.split(',').map((f) => f.trim())
}, }
] ]
: [], : []
}) })
.then(onMessage) .then(onMessage)
.catch(onMessage); .catch(onMessage)
} }
</script> </script>
@@ -171,15 +180,16 @@
<br /> <br />
<div class="flex flex-wrap flex-col md:flex-row gap-2 children:flex-shrink-0"> <div class="flex flex-wrap flex-col md:flex-row gap-2 children:flex-shrink-0">
<button class="btn" id="open-dialog" on:click={openDialog}>Open dialog</button> <button class="btn" id="open-dialog" onclick={openDialog}>Open dialog</button>
<button class="btn" id="save-dialog" on:click={saveDialog} <button class="btn" id="save-dialog" onclick={saveDialog}
>Open save dialog</button >Open save dialog</button
> >
<button class="btn" id="prompt-dialog" on:click={prompt}>Prompt</button> <button class="btn" id="prompt-dialog" onclick={prompt}>Prompt</button>
<button class="btn" id="custom-prompt-dialog" on:click={promptCustom} <button class="btn" id="custom-prompt-dialog" onclick={promptCustom}
>Prompt (custom)</button >Prompt (custom)</button
> >
<button class="btn" id="message-dialog" on:click={msg}>Message</button> <button class="btn" id="message-dialog" onclick={msg}>Message</button>
<button class="btn" id="message-dialog" on:click={msgCustom}>Message (custom)</button> <button class="btn" id="message-dialog" onclick={msgCustom}
>Message (custom)</button
>
</div> </div>
+3 -3
View File
@@ -5,7 +5,7 @@
import { arrayBufferToBase64 } from '../lib/utils' import { arrayBufferToBase64 } from '../lib/utils'
import { onDestroy, onMount } from 'svelte' import { onDestroy, onMount } from 'svelte'
const { onMessage, insecureRenderHtml } = $props() const { onMessage } = $props()
let path = $state('') let path = $state('')
let img let img
@@ -118,12 +118,12 @@
new Uint8Array(response), new Uint8Array(response),
function (base64) { function (base64) {
const src = 'data:image/png;base64,' + base64 const src = 'data:image/png;base64,' + base64
insecureRenderHtml('<img src="' + src + '"></img>') onMessage('<img src="' + src + '"></img>')
} }
) )
} else { } else {
const value = String.fromCharCode.apply(null, response) const value = String.fromCharCode.apply(null, response)
insecureRenderHtml( onMessage(
'<textarea id="file-response"></textarea><button id="file-save">Save</button>' '<textarea id="file-response"></textarea><button id="file-save">Save</button>'
) )
setTimeout(() => { setTimeout(() => {
+19 -11
View File
@@ -1,12 +1,18 @@
<script> <script lang="ts">
import { check } from '@tauri-apps/plugin-updater' import { check, Update } from '@tauri-apps/plugin-updater'
import { relaunch } from '@tauri-apps/plugin-process' import { relaunch } from '@tauri-apps/plugin-process'
import { onDestroy } from 'svelte'
export let onMessage let { onMessage } = $props()
let isChecking, isInstalling, newUpdate let isChecking = $state(false)
let totalSize = 0, let isInstalling = $state(false)
downloadedSize = 0 let newUpdate = $state<Update | undefined>()
let totalSize = $state(0)
let downloadedSize = $state(0)
let progress = $derived(
totalSize ? Math.round((downloadedSize / totalSize) * 100) : 0
)
async function checkUpdate() { async function checkUpdate() {
isChecking = true isChecking = true
@@ -31,10 +37,10 @@
isInstalling = true isInstalling = true
downloadedSize = 0 downloadedSize = 0
try { try {
await newUpdate.downloadAndInstall((downloadProgress) => { await newUpdate!.downloadAndInstall((downloadProgress) => {
switch (downloadProgress.event) { switch (downloadProgress.event) {
case 'Started': case 'Started':
totalSize = downloadProgress.data.contentLength totalSize = downloadProgress.data.contentLength!
break break
case 'Progress': case 'Progress':
downloadedSize += downloadProgress.data.chunkLength downloadedSize += downloadProgress.data.chunkLength
@@ -54,14 +60,16 @@
} }
} }
$: progress = totalSize ? Math.round((downloadedSize / totalSize) * 100) : 0 onDestroy(() => {
newUpdate?.close()
})
</script> </script>
<div class="flex children:grow children:h10"> <div class="flex children:grow children:h10">
{#if !isChecking && !newUpdate} {#if !isChecking && !newUpdate}
<button class="btn" on:click={checkUpdate}>Check update</button> <button class="btn" onclick={checkUpdate}>Check update</button>
{:else if !isInstalling && newUpdate} {:else if !isInstalling && newUpdate}
<button class="btn" on:click={install}>Install update</button> <button class="btn" onclick={install}>Install update</button>
{:else} {:else}
<div class="progress"> <div class="progress">
<span>{progress}%</span> <span>{progress}%</span>
+5
View File
@@ -0,0 +1,5 @@
*
!.gitignore
!README.md
!updater.json
+10
View File
@@ -0,0 +1,10 @@
To test the updater:
1. Comment out `verify_signature` inside `plugins/updater/src/updater.rs`
2. Run `pnpm tauri build --debug` to build the bundles
3. Copy the bundle you want to test to this folder (`examples/api/updater-test/`)
4. Run `pnpm tauri dev` and open the Updater tab to check
If the bundle you're testing doesn't exist in the `updater.json` yet, add it manually and welcome to open an PR
> The `updater.json` and debug bundles will be served by `vite`
+11
View File
@@ -0,0 +1,11 @@
{
"version": "2.1.0",
"notes": "Test update!",
"pub_date": "2026-03-01T14:04:20+00:00",
"platforms": {
"windows-x86_64": {
"signature": "",
"url": "http://localhost:5173/updater-test/Tauri API_2.0.0_x64_en-US.msi"
}
}
}
+1 -1
View File
@@ -27,7 +27,7 @@ export default defineConfig(async () => {
port: 5173, port: 5173,
strictPort: true, strictPort: true,
fs: { fs: {
allow: ['.', '../../tooling/api/dist'] allow: ['.']
} }
} }
} }
+2 -12
View File
@@ -19,21 +19,11 @@
"eslint-config-prettier": "10.1.8", "eslint-config-prettier": "10.1.8",
"eslint-plugin-security": "4.0.1", "eslint-plugin-security": "4.0.1",
"prettier": "3.8.3", "prettier": "3.8.3",
"rollup": "4.60.3", "rollup": "4.62.2",
"tslib": "2.8.1", "tslib": "2.8.1",
"typescript": "6.0.3", "typescript": "6.0.3",
"typescript-eslint": "8.58.2" "typescript-eslint": "8.58.2"
}, },
"minimumReleaseAge": 4320, "minimumReleaseAge": 4320,
"pnpm": { "packageManager": "pnpm@11.20.0"
"overrides": {
"esbuild@<0.25.0": ">=0.25.0"
},
"onlyBuiltDependencies": [
"esbuild"
]
},
"engines": {
"pnpm": "^10.16.0"
}
} }
+7
View File
@@ -8,6 +8,13 @@ edition = { workspace = true }
rust-version = { workspace = true } rust-version = { workspace = true }
repository = { workspace = true } repository = { workspace = true }
links = "tauri-plugin-autostart" links = "tauri-plugin-autostart"
exclude = [
"/banner.png",
"/guest-js",
"/package.json",
"/rollup.config.js",
"/tsconfig.json",
]
[package.metadata.platforms.support] [package.metadata.platforms.support]
windows = { level = "full", notes = "" } windows = { level = "full", notes = "" }
+1 -1
View File
@@ -161,7 +161,7 @@ impl Builder {
/// ///
/// ```no_run /// ```no_run
/// Builder::new() /// Builder::new()
/// .app_name("My Custom Name")) /// .app_name("My Custom Name")
/// .build(); /// .build();
/// ``` /// ```
pub fn app_name<S: Into<String>>(mut self, app_name: S) -> Self { pub fn app_name<S: Into<String>>(mut self, app_name: S) -> Self {
+7 -1
View File
@@ -8,7 +8,13 @@ license = { workspace = true }
rust-version = { workspace = true } rust-version = { workspace = true }
repository = { workspace = true } repository = { workspace = true }
links = "tauri-plugin-barcode-scanner" links = "tauri-plugin-barcode-scanner"
exclude = [
"/banner.png",
"/guest-js",
"/package.json",
"/rollup.config.js",
"/tsconfig.json",
]
[package.metadata.docs.rs] [package.metadata.docs.rs]
targets = ["x86_64-linux-android"] targets = ["x86_64-linux-android"]
+1
View File
@@ -7,6 +7,7 @@ authors = { workspace = true }
license = { workspace = true } license = { workspace = true }
repository = { workspace = true } repository = { workspace = true }
links = "tauri-plugin-biometric" links = "tauri-plugin-biometric"
exclude = ["/guest-js", "/package.json", "/rollup.config.js", "/tsconfig.json"]
[package.metadata.docs.rs] [package.metadata.docs.rs]
targets = ["x86_64-linux-android"] targets = ["x86_64-linux-android"]
+7
View File
@@ -8,6 +8,13 @@ license = { workspace = true }
rust-version = { workspace = true } rust-version = { workspace = true }
repository = { workspace = true } repository = { workspace = true }
links = "tauri-plugin-cli" links = "tauri-plugin-cli"
exclude = [
"/banner.png",
"/guest-js",
"/package.json",
"/rollup.config.js",
"/tsconfig.json",
]
[package.metadata.platforms.support] [package.metadata.platforms.support]
windows = { level = "full", notes = "" } windows = { level = "full", notes = "" }
+7
View File
@@ -8,6 +8,13 @@ license = { workspace = true }
rust-version = { workspace = true } rust-version = { workspace = true }
repository = { workspace = true } repository = { workspace = true }
links = "tauri-plugin-clipboard-manager" links = "tauri-plugin-clipboard-manager"
exclude = [
"/banner.png",
"/guest-js",
"/package.json",
"/rollup.config.js",
"/tsconfig.json",
]
[package.metadata.docs.rs] [package.metadata.docs.rs]
+8
View File
@@ -8,6 +8,14 @@ edition = { workspace = true }
rust-version = { workspace = true } rust-version = { workspace = true }
repository = { workspace = true } repository = { workspace = true }
links = "tauri-plugin-deep-link" links = "tauri-plugin-deep-link"
exclude = [
"/banner.png",
"/examples",
"/guest-js",
"/package.json",
"/rollup.config.js",
"/tsconfig.json",
]
[package.metadata.docs.rs] [package.metadata.docs.rs]
targets = ["x86_64-linux-android"] targets = ["x86_64-linux-android"]
+4 -4
View File
@@ -11,11 +11,11 @@
}, },
"dependencies": { "dependencies": {
"@tauri-apps/api": "^2.11.0", "@tauri-apps/api": "^2.11.0",
"@tauri-apps/plugin-deep-link": "2.4.9" "@tauri-apps/plugin-deep-link": "workspace:*"
}, },
"devDependencies": { "devDependencies": {
"@tauri-apps/cli": "2.11.2", "@tauri-apps/cli": "2.11.4",
"typescript": "^6.0.0", "typescript": "^6.0.3",
"vite": "^8.0.1" "vite": "^8.0.16"
} }
} }
@@ -26,9 +26,3 @@ tauri-plugin-single-instance = { path = "../../../../single-instance", features
"deep-link", "deep-link",
] } ] }
log = "0.4" log = "0.4"
[features]
# this feature is used for production builds or when `devUrl` points to the filesystem and the built-in dev server is disabled.
# If you use cargo directly instead of tauri's cli you can use this feature flag to switch between tauri's `dev` and `build` modes.
# DO NOT REMOVE!!
prod = ["tauri/custom-protocol"]
@@ -1,6 +1,6 @@
<resources xmlns:tools="http://schemas.android.com/tools"> <resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. --> <!-- Base application theme. -->
<style name="Theme.deep_link_example" parent="Theme.MaterialComponents.DayNight.NoActionBar"> <style name="Theme.deep_link_example" parent="Theme.Material3.DayNight.NoActionBar">
<!-- Customize your theme here. --> <!-- Customize your theme here. -->
</style> </style>
</resources> </resources>
@@ -1,6 +1,6 @@
<resources xmlns:tools="http://schemas.android.com/tools"> <resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. --> <!-- Base application theme. -->
<style name="Theme.deep_link_example" parent="Theme.MaterialComponents.DayNight.NoActionBar"> <style name="Theme.deep_link_example" parent="Theme.Material3.DayNight.NoActionBar">
<!-- Customize your theme here. --> <!-- Customize your theme here. -->
</style> </style>
</resources> </resources>
+16 -6
View File
@@ -14,9 +14,11 @@ import { type UnlistenFn, listen } from '@tauri-apps/api/event'
* const urls = await getCurrent(); * const urls = await getCurrent();
* ``` * ```
* *
* #### - **Windows / Linux**: This function reads the command line arguments and checks if there's only one value, which must be an URL with scheme matching one of the configured values. * #### Platform-specific
*
* - **Windows / Linux:** This function reads the command line arguments and checks if there's only one value, which must be an URL with scheme matching one of the configured values.
* Note that you must manually check the arguments when registering deep link schemes dynamically with [`Self::register`]. * Note that you must manually check the arguments when registering deep link schemes dynamically with [`Self::register`].
* Additionally, the deep link might have been provided as a CLI argument so you should check if its format matches what you expect.. * Additionally, the deep link might have been provided as a CLI argument so you should check if its format matches what you expect.
* *
* @since 2.0.0 * @since 2.0.0
*/ */
@@ -35,7 +37,9 @@ export async function getCurrent(): Promise<string[] | null> {
* await register("my-scheme"); * await register("my-scheme");
* ``` * ```
* *
* #### - **macOS / Android / iOS**: Unsupported. * #### Platform-specific
*
* - **macOS / Android / iOS:** Unsupported.
* *
* @since 2.0.0 * @since 2.0.0
*/ */
@@ -54,7 +58,9 @@ export async function register(protocol: string): Promise<null> {
* await unregister("my-scheme"); * await unregister("my-scheme");
* ``` * ```
* *
* #### - **macOS / Linux / Android / iOS**: Unsupported. * #### Platform-specific
*
* - **macOS / Linux / Android / iOS:** Unsupported.
* *
* @since 2.0.0 * @since 2.0.0
*/ */
@@ -73,7 +79,9 @@ export async function unregister(protocol: string): Promise<null> {
* await isRegistered("my-scheme"); * await isRegistered("my-scheme");
* ``` * ```
* *
* #### - **macOS / Android / iOS**: Unsupported. * #### Platform-specific
*
* - **macOS / Android / iOS:** Unsupported.
* *
* @since 2.0.0 * @since 2.0.0
*/ */
@@ -92,7 +100,9 @@ export async function isRegistered(protocol: string): Promise<boolean> {
* await onOpenUrl((urls) => { console.log(urls) }); * await onOpenUrl((urls) => { console.log(urls) });
* ``` * ```
* *
* #### - **Windows / Linux**: Unsupported without the single-instance plugin. The OS will spawn a new app instance passing the URL as a CLI argument. * #### Platform-specific
*
* - **Windows / Linux:** Unsupported without the single-instance plugin. The OS will spawn a new app instance passing the URL as a CLI argument.
* *
* @since 2.0.0 * @since 2.0.0
*/ */
+1 -1
View File
@@ -28,6 +28,6 @@
"@tauri-apps/api": "^2.11.0" "@tauri-apps/api": "^2.11.0"
}, },
"devDependencies": { "devDependencies": {
"@tauri-apps/cli": "2.11.2" "@tauri-apps/cli": "2.11.4"
} }
} }
+4
View File
@@ -1,5 +1,9 @@
# Changelog # Changelog
## \[2.7.2]
- [`40ae0a7f`](https://github.com/tauri-apps/plugins-workspace/commit/40ae0a7fa0ecc9b0cdbd952297f7a17f37308229) ([#3491](https://github.com/tauri-apps/plugins-workspace/pull/3491) by [@Legend-Master](https://github.com/tauri-apps/plugins-workspace/../../Legend-Master)) Use `com.google.android.material.dialog.MaterialAlertDialogBuilder` instead of `AlertDialog` so the dialog follows the app's theme
## \[2.7.1] ## \[2.7.1]
### Dependencies ### Dependencies
+9 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "tauri-plugin-dialog" name = "tauri-plugin-dialog"
version = "2.7.1" version = "2.7.2"
description = "Native system dialogs for opening and saving files along with message dialogs on your Tauri application." description = "Native system dialogs for opening and saving files along with message dialogs on your Tauri application."
edition = { workspace = true } edition = { workspace = true }
authors = { workspace = true } authors = { workspace = true }
@@ -8,6 +8,14 @@ license = { workspace = true }
rust-version = { workspace = true } rust-version = { workspace = true }
repository = { workspace = true } repository = { workspace = true }
links = "tauri-plugin-dialog" links = "tauri-plugin-dialog"
exclude = [
"/banner.png",
"/guest-js",
"/package.json",
"/rollup.config.js",
"/test",
"/tsconfig.json",
]
[features] [features]
default = ["gtk3"] default = ["gtk3"]
+2 -2
View File
@@ -35,8 +35,8 @@ android {
dependencies { dependencies {
implementation("androidx.core:core-ktx:1.9.0") implementation("androidx.core:core-ktx:1.9.0")
implementation("androidx.appcompat:appcompat:1.6.0") implementation("androidx.appcompat:appcompat:1.7.1")
implementation("com.google.android.material:material:1.7.0") implementation("com.google.android.material:material:1.13.0")
testImplementation("junit:junit:4.13.2") testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.5") androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1") androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
@@ -5,7 +5,6 @@
package app.tauri.dialog package app.tauri.dialog
import android.app.Activity import android.app.Activity
import android.app.AlertDialog
import android.content.Intent import android.content.Intent
import android.net.Uri import android.net.Uri
import android.os.Handler import android.os.Handler
@@ -21,6 +20,7 @@ import app.tauri.plugin.Invoke
import app.tauri.plugin.JSArray import app.tauri.plugin.JSArray
import app.tauri.plugin.JSObject import app.tauri.plugin.JSObject
import app.tauri.plugin.Plugin import app.tauri.plugin.Plugin
import com.google.android.material.dialog.MaterialAlertDialogBuilder
@InvokeArg @InvokeArg
class Filter { class Filter {
@@ -158,7 +158,7 @@ class DialogPlugin(private val activity: Activity): Plugin(activity) {
Handler(Looper.getMainLooper()) Handler(Looper.getMainLooper())
.post { .post {
val builder = AlertDialog.Builder(activity) val builder = MaterialAlertDialogBuilder(activity)
if (args.title != null) { if (args.title != null) {
builder.setTitle(args.title) builder.setTitle(args.title)
@@ -191,8 +191,7 @@ class DialogPlugin(private val activity: Activity): Plugin(activity) {
} }
} }
val dialog = builder.create() builder.show()
dialog.show()
} }
} }
@@ -205,9 +204,10 @@ class DialogPlugin(private val activity: Activity): Plugin(activity) {
val intent = Intent(Intent.ACTION_CREATE_DOCUMENT) val intent = Intent(Intent.ACTION_CREATE_DOCUMENT)
intent.addCategory(Intent.CATEGORY_OPENABLE) intent.addCategory(Intent.CATEGORY_OPENABLE)
intent.putExtra(Intent.EXTRA_TITLE, args.fileName ?: "") intent.putExtra(Intent.EXTRA_TITLE, args.fileName ?: "")
if (parsedTypes.size == 1) {
intent.type = parsedTypes.first()
} else {
intent.type = "*/*" intent.type = "*/*"
if (parsedTypes.isNotEmpty()) {
intent.putExtra(Intent.EXTRA_MIME_TYPES, parsedTypes) intent.putExtra(Intent.EXTRA_MIME_TYPES, parsedTypes)
} }
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@tauri-apps/plugin-dialog", "name": "@tauri-apps/plugin-dialog",
"version": "2.7.1", "version": "2.7.2",
"license": "MIT OR Apache-2.0", "license": "MIT OR Apache-2.0",
"authors": [ "authors": [
"Tauri Programme within The Commons Conservancy" "Tauri Programme within The Commons Conservancy"
+5
View File
@@ -3,6 +3,11 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
//! Native system dialogs for opening and saving files along with message dialogs. //! Native system dialogs for opening and saving files along with message dialogs.
//!
//! ## Cargo features
//!
//! - **gtk3** *(enabled by default)*: Uses GTK for dialogs on Linux & BSDs; has no effect on Windows and macOS
//! - **xdg-portal**: Uses XDG Desktop Portal instead of GTK on Linux & BSDs
#![doc( #![doc(
html_logo_url = "https://github.com/tauri-apps/tauri/raw/dev/app-icon.png", html_logo_url = "https://github.com/tauri-apps/tauri/raw/dev/app-icon.png",
+7
View File
@@ -8,6 +8,13 @@ edition = { workspace = true }
rust-version = { workspace = true } rust-version = { workspace = true }
repository = { workspace = true } repository = { workspace = true }
links = "tauri-plugin-fs" links = "tauri-plugin-fs"
exclude = [
"/banner.png",
"/guest-js",
"/package.json",
"/rollup.config.js",
"/tsconfig.json",
]
[package.metadata.platforms.support] [package.metadata.platforms.support]
windows = { level = "full", notes = "Apps installed via MSI or NSIS in `perMachine` and `both` mode require admin permissions for write access in `$RESOURCES` folder" } windows = { level = "full", notes = "Apps installed via MSI or NSIS in `perMachine` and `both` mode require admin permissions for write access in `$RESOURCES` folder" }
@@ -6,7 +6,7 @@ description = """This denies read access to the
`$APPLOCALDATA` folder on linux as the webview data and configuration values are stored here. `$APPLOCALDATA` folder on linux as the webview data and configuration values are stored here.
Allowing access can lead to sensitive information disclosure and should be well considered.""" Allowing access can lead to sensitive information disclosure and should be well considered."""
[[scope.deny]] [[permission.scope.deny]]
path = "$APPLOCALDATA/**" path = "$APPLOCALDATA/**"
[[permission]] [[permission]]
@@ -15,5 +15,5 @@ description = """This denies read access to the
`$APPLOCALDATA/EBWebView` folder on windows as the webview data and configuration values are stored here. `$APPLOCALDATA/EBWebView` folder on windows as the webview data and configuration values are stored here.
Allowing access can lead to sensitive information disclosure and should be well considered.""" Allowing access can lead to sensitive information disclosure and should be well considered."""
[[scope.deny]] [[permission.scope.deny]]
path = "$APPLOCALDATA/EBWebView/**" path = "$APPLOCALDATA/EBWebView/**"
+36 -39
View File
@@ -74,7 +74,7 @@ pub type CommandResult<T> = std::result::Result<T, CommandError>;
/// Represents either a plain PathBuf or a PathHandle that manages security-scoped resources. /// Represents either a plain PathBuf or a PathHandle that manages security-scoped resources.
pub enum PathKind<R: Runtime> { pub enum PathKind<R: Runtime> {
/// A plain path that doesn't manage security-scoped resources. /// A plain path that doesn't manage security-scoped resources.
#[allow(dead_code)] // only used on mobile #[cfg(mobile)] // only used on mobile
Path(PathBuf), Path(PathBuf),
/// A path handle that manages security-scoped resources and will clean them up on drop. /// A path handle that manages security-scoped resources and will clean them up on drop.
Handle(PathHandle<R>), Handle(PathHandle<R>),
@@ -84,6 +84,7 @@ impl<R: Runtime> PathKind<R> {
/// Get a reference to the underlying path. /// Get a reference to the underlying path.
pub fn as_path(&self) -> &Path { pub fn as_path(&self) -> &Path {
match self { match self {
#[cfg(mobile)]
PathKind::Path(p) => p.as_ref(), PathKind::Path(p) => p.as_ref(),
PathKind::Handle(h) => h.as_ref(), PathKind::Handle(h) => h.as_ref(),
} }
@@ -92,6 +93,7 @@ impl<R: Runtime> PathKind<R> {
/// Get a reference to the underlying PathBuf. /// Get a reference to the underlying PathBuf.
pub fn as_path_buf(&self) -> &PathBuf { pub fn as_path_buf(&self) -> &PathBuf {
match self { match self {
#[cfg(mobile)]
PathKind::Path(p) => p, PathKind::Path(p) => p,
PathKind::Handle(h) => h, PathKind::Handle(h) => h,
} }
@@ -114,27 +116,13 @@ impl<R: Runtime> AsRef<PathBuf> for PathKind<R> {
pub struct FileHandle<R: Runtime> { pub struct FileHandle<R: Runtime> {
file: File, file: File,
path: PathKind<R>, path: PathKind<R>,
#[allow(dead_code)] // Used in Drop implementation #[cfg(target_os = "ios")]
path_: SafeFilePath, path_: SafeFilePath,
#[allow(dead_code)] // Used in Drop implementation #[cfg(target_os = "ios")]
app_handle: tauri::AppHandle<R>, app_handle: tauri::AppHandle<R>,
} }
impl<R: Runtime> FileHandle<R> { impl<R: Runtime> FileHandle<R> {
fn new(
file: File,
path: PathKind<R>,
path_: SafeFilePath,
app_handle: tauri::AppHandle<R>,
) -> Self {
Self {
file,
path,
path_,
app_handle,
}
}
/// Get the resolved path. /// Get the resolved path.
pub fn path(&self) -> &Path { pub fn path(&self) -> &Path {
self.path.as_path() self.path.as_path()
@@ -155,10 +143,9 @@ impl<R: Runtime> DerefMut for FileHandle<R> {
} }
} }
#[cfg(target_os = "ios")]
impl<R: Runtime> Drop for FileHandle<R> { impl<R: Runtime> Drop for FileHandle<R> {
fn drop(&mut self) { fn drop(&mut self) {
#[cfg(target_os = "ios")]
{
// Only clean up if we have a plain PathBuf, not a PathHandle // Only clean up if we have a plain PathBuf, not a PathHandle
// PathHandle will handle its own cleanup when it's dropped // PathHandle will handle its own cleanup when it's dropped
if let PathKind::Path(_) = &self.path { if let PathKind::Path(_) = &self.path {
@@ -179,13 +166,13 @@ impl<R: Runtime> Drop for FileHandle<R> {
// Only clean up if it's not tracked manually // Only clean up if it's not tracked manually
if !security_scoped_resources.is_tracked_manually(url.as_str()) { if !security_scoped_resources.is_tracked_manually(url.as_str()) {
log::debug!("Stopping accessing security-scoped resource for URL: {url} on drop"); log::debug!(
"Stopping accessing security-scoped resource for URL: {url} on drop"
);
let _ = self let _ = self
.app_handle .app_handle
.fs() .fs()
.stop_accessing_security_scoped_resource(FilePath::Url( .stop_accessing_security_scoped_resource(FilePath::Url(url.clone()));
url.clone(),
));
security_scoped_resources.remove(url.as_str()); security_scoped_resources.remove(url.as_str());
} else { } else {
log::debug!("Not cleaning up security-scoped resource for URL: {url} on drop (manually tracked via start_accessing_security_scoped_resource)"); log::debug!("Not cleaning up security-scoped resource for URL: {url} on drop (manually tracked via start_accessing_security_scoped_resource)");
@@ -194,7 +181,6 @@ impl<R: Runtime> Drop for FileHandle<R> {
} }
} }
} }
}
} }
/// A path handle that automatically stops accessing security-scoped resources on iOS when dropped. /// A path handle that automatically stops accessing security-scoped resources on iOS when dropped.
@@ -236,10 +222,9 @@ impl<R: Runtime> AsRef<PathBuf> for PathHandle<R> {
} }
} }
#[cfg(target_os = "ios")]
impl<R: Runtime> Drop for PathHandle<R> { impl<R: Runtime> Drop for PathHandle<R> {
fn drop(&mut self) { fn drop(&mut self) {
#[cfg(target_os = "ios")]
{
use crate::{FilePath, FsExt}; use crate::{FilePath, FsExt};
// Convert SafeFilePath to FilePath // Convert SafeFilePath to FilePath
let file_path: FilePath = match &self.path_ { let file_path: FilePath = match &self.path_ {
@@ -271,7 +256,6 @@ impl<R: Runtime> Drop for PathHandle<R> {
} }
} }
} }
}
} }
#[derive(Debug, Default, Clone, Deserialize)] #[derive(Debug, Default, Clone, Deserialize)]
@@ -288,6 +272,7 @@ pub fn create<R: Runtime>(
path: SafeFilePath, path: SafeFilePath,
options: Option<BaseOptions>, options: Option<BaseOptions>,
) -> CommandResult<ResourceId> { ) -> CommandResult<ResourceId> {
#[cfg(target_os = "ios")]
let path_ = path.clone(); let path_ = path.clone();
let resolved_path_handle = resolve_path( let resolved_path_handle = resolve_path(
"create", "create",
@@ -303,13 +288,16 @@ pub fn create<R: Runtime>(
resolved_path_handle.display() resolved_path_handle.display()
) )
})?; })?;
#[cfg(target_os = "ios")]
let app_handle = webview.app_handle().clone(); let app_handle = webview.app_handle().clone();
let file_handle = FileHandle::new( let file_handle = FileHandle {
file, file,
PathKind::Handle(resolved_path_handle), path: PathKind::Handle(resolved_path_handle),
#[cfg(target_os = "ios")]
path_, path_,
#[cfg(target_os = "ios")]
app_handle, app_handle,
); };
let rid = webview let rid = webview
.resources_table() .resources_table()
.add(StdFileResource::new(file_handle)); .add(StdFileResource::new(file_handle));
@@ -1417,6 +1405,7 @@ fn resolve_file_in_fs<R: Runtime>(
path: SafeFilePath, path: SafeFilePath,
open_options: OpenOptions, open_options: OpenOptions,
) -> CommandResult<FileHandle<R>> { ) -> CommandResult<FileHandle<R>> {
#[cfg(target_os = "ios")]
let path_ = path.clone(); let path_ = path.clone();
let resolved_path_handle = resolve_path( let resolved_path_handle = resolve_path(
permission, permission,
@@ -1436,13 +1425,16 @@ fn resolve_file_in_fs<R: Runtime>(
) )
})?; })?;
#[cfg(target_os = "ios")]
let app_handle = webview.app_handle().clone(); let app_handle = webview.app_handle().clone();
Ok(FileHandle::new( Ok(FileHandle {
file, file,
PathKind::Handle(resolved_path_handle), path: PathKind::Handle(resolved_path_handle),
#[cfg(target_os = "ios")]
path_, path_,
#[cfg(target_os = "ios")]
app_handle, app_handle,
)) })
} }
#[cfg(mobile)] #[cfg(mobile)]
@@ -1456,6 +1448,7 @@ pub fn resolve_file<R: Runtime>(
) -> CommandResult<FileHandle<R>> { ) -> CommandResult<FileHandle<R>> {
use crate::FsExt; use crate::FsExt;
#[cfg(target_os = "ios")]
let path_ = path.clone(); let path_ = path.clone();
match path { match path {
SafeFilePath::Url(url) => { SafeFilePath::Url(url) => {
@@ -1463,13 +1456,16 @@ pub fn resolve_file<R: Runtime>(
let file = webview let file = webview
.fs() .fs()
.open(SafeFilePath::Url(url.clone()), open_options.options)?; .open(SafeFilePath::Url(url.clone()), open_options.options)?;
#[cfg(target_os = "ios")]
let app_handle = webview.app_handle().clone(); let app_handle = webview.app_handle().clone();
Ok(FileHandle::new( Ok(FileHandle {
file, file,
PathKind::Path(resolved_path), path: PathKind::Path(resolved_path),
#[cfg(target_os = "ios")]
path_, path_,
#[cfg(target_os = "ios")]
app_handle, app_handle,
)) })
} }
SafeFilePath::Path(path) => resolve_file_in_fs( SafeFilePath::Path(path) => resolve_file_in_fs(
permission, permission,
@@ -1494,7 +1490,6 @@ pub fn resolve_path<R: Runtime>(
// On iOS, start accessing security-scoped resource if the path is a file URL // On iOS, start accessing security-scoped resource if the path is a file URL
// Only if it hasn't been started already via start_accessing_security_scoped_resource // Only if it hasn't been started already via start_accessing_security_scoped_resource
#[cfg(target_os = "ios")] #[cfg(target_os = "ios")]
{
if let SafeFilePath::Url(url) = &path { if let SafeFilePath::Url(url) = &path {
if url.scheme() == "file" { if url.scheme() == "file" {
use objc2_foundation::{NSString, NSURL}; use objc2_foundation::{NSString, NSURL};
@@ -1515,7 +1510,10 @@ pub fn resolve_path<R: Runtime>(
// Track it so we know to clean it up // Track it so we know to clean it up
security_scoped_resources.track_manually(url.as_str().to_string()); security_scoped_resources.track_manually(url.as_str().to_string());
} else { } else {
log::warn!("Failed to start accessing security-scoped resource for URL: {}", url.as_str()); log::warn!(
"Failed to start accessing security-scoped resource for URL: {}",
url.as_str()
);
} }
} }
} else { } else {
@@ -1526,7 +1524,6 @@ pub fn resolve_path<R: Runtime>(
} }
} }
} }
}
let path = path.into_path()?; let path = path.into_path()?;
let resolved_path = if let Some(base_dir) = base_dir { let resolved_path = if let Some(base_dir) = base_dir {
+4
View File
@@ -3,6 +3,10 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
//! Access the file system. //! Access the file system.
//!
//! ## Cargo features
//!
//! - **watch**: Enables the `watch` command backed by [`notify`](http://crates.io/crates/notify).
// TODO(v3): consider redesign the API to implement automatic stopAccessingSecurityScopedResource on iOS // TODO(v3): consider redesign the API to implement automatic stopAccessingSecurityScopedResource on iOS
// this likely requires returning a handle to a resource so we can impl Drop for it // this likely requires returning a handle to a resource so we can impl Drop for it
+1
View File
@@ -7,6 +7,7 @@ authors = { workspace = true }
license = { workspace = true } license = { workspace = true }
repository = { workspace = true } repository = { workspace = true }
links = "tauri-plugin-geolocation" links = "tauri-plugin-geolocation"
exclude = ["/guest-js", "/package.json", "/rollup.config.js", "/tsconfig.json"]
[package.metadata.docs.rs] [package.metadata.docs.rs]
targets = ["x86_64-linux-android"] targets = ["x86_64-linux-android"]
+6
View File
@@ -2,6 +2,12 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
//! Access device geolocation APIs.
//!
//! ## Cargo features
//!
//! - **specta**: Add support for [`specta::specta`](https://docs.rs/specta/2.0.0-rc.25/specta/attr.specta.html) on structs like [`PermissionStatus`], [`PositionOptions`].
use tauri::{ use tauri::{
plugin::{Builder, TauriPlugin}, plugin::{Builder, TauriPlugin},
Manager, Runtime, Manager, Runtime,
+7
View File
@@ -8,6 +8,13 @@ license = { workspace = true }
rust-version = { workspace = true } rust-version = { workspace = true }
repository = { workspace = true } repository = { workspace = true }
links = "tauri-plugin-global-shortcut" links = "tauri-plugin-global-shortcut"
exclude = [
"/banner.png",
"/guest-js",
"/package.json",
"/rollup.config.js",
"/tsconfig.json",
]
[package.metadata.platforms.support] [package.metadata.platforms.support]
windows = { level = "full", notes = "" } windows = { level = "full", notes = "" }
+1
View File
@@ -7,6 +7,7 @@ authors = { workspace = true }
license = { workspace = true } license = { workspace = true }
repository = { workspace = true } repository = { workspace = true }
links = "tauri-plugin-haptics" links = "tauri-plugin-haptics"
exclude = ["/guest-js", "/package.json", "/rollup.config.js", "/tsconfig.json"]
[package.metadata.docs.rs] [package.metadata.docs.rs]
targets = ["x86_64-linux-android"] targets = ["x86_64-linux-android"]
+6
View File
@@ -2,6 +2,12 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
//! Trigger haptic feedback on supported devices.
//!
//! ## Cargo features
//!
//! - **specta**: Add support for [`specta::specta`](https://docs.rs/specta/2.0.0-rc.25/specta/attr.specta.html) on structs like [`ImpactFeedbackStyle`], [`NotificationFeedbackType`].
use tauri::{ use tauri::{
plugin::{Builder, TauriPlugin}, plugin::{Builder, TauriPlugin},
Manager, Runtime, Manager, Runtime,
+13 -8
View File
@@ -8,6 +8,13 @@ license = { workspace = true }
rust-version = { workspace = true } rust-version = { workspace = true }
repository = { workspace = true } repository = { workspace = true }
links = "tauri-plugin-http" links = "tauri-plugin-http"
exclude = [
"/banner.png",
"/guest-js",
"/package.json",
"/rollup.config.js",
"/tsconfig.json",
]
[package.metadata.platforms.support] [package.metadata.platforms.support]
windows = { level = "full", notes = "" } windows = { level = "full", notes = "" }
@@ -34,7 +41,8 @@ tauri-plugin-fs = { path = "../fs", version = "2.5.1" }
urlpattern = "0.3" urlpattern = "0.3"
regex = "1" regex = "1"
http = "1" http = "1"
reqwest = { version = "0.12", default-features = false } # 0.12.16 is when `system-proxy` was added
reqwest = { version = "0.13.0", default-features = false }
url = { workspace = true } url = { workspace = true }
data-url = "0.3" data-url = "0.3"
cookie_store = { version = "0.22", optional = true, features = ["serde"] } cookie_store = { version = "0.22", optional = true, features = ["serde"] }
@@ -42,13 +50,7 @@ bytes = { version = "1.9", optional = true }
tracing = { workspace = true, optional = true } tracing = { workspace = true, optional = true }
[features] [features]
default = [ default = ["rustls-tls", "http2", "charset", "system-proxy", "cookies"]
"rustls-tls",
"http2",
"charset",
"macos-system-configuration",
"cookies",
]
multipart = ["reqwest/multipart"] multipart = ["reqwest/multipart"]
json = ["reqwest/json"] json = ["reqwest/json"]
stream = ["reqwest/stream"] stream = ["reqwest/stream"]
@@ -69,7 +71,10 @@ trust-dns = ["reqwest/trust-dns"]
socks = ["reqwest/socks"] socks = ["reqwest/socks"]
http2 = ["reqwest/http2"] http2 = ["reqwest/http2"]
charset = ["reqwest/charset"] charset = ["reqwest/charset"]
# Deprecated, switch to system-proxy
macos-system-configuration = ["reqwest/macos-system-configuration"] macos-system-configuration = ["reqwest/macos-system-configuration"]
system-proxy = ["reqwest/system-proxy"]
unsafe-headers = [] unsafe-headers = []
tracing = ["dep:tracing"] tracing = ["dep:tracing"]
dangerous-settings = [] dangerous-settings = []
+40
View File
@@ -3,6 +3,46 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
//! Access the HTTP client written in Rust. //! Access the HTTP client written in Rust.
//!
//! ## Cargo features
//!
//! ### Reqwest feature forwards
//!
//! These features forwards [`reqwest`](https://docs.rs/reqwest/0.12.28/reqwest/index.html) features:
//!
//! - **http2** *(enabled by default)*: Enables HTTP/2 support.
//! - **native-tls**: Enables TLS functionality provided by native-tls.
//! - **native-tls-vendored**: Enables the vendored feature of native-tls.
//! - **native-tls-alpn**: Enables the alpn feature of native-tls.
//! - **rustls-tls** *(enabled by default)*: Enables TLS functionality provided by rustls. Equivalent to
//! rustls-tls-webpki-roots.
//! - **rustls-tls-manual-roots**: Enables TLS functionality provided by rustls, without setting any root
//! certificates. Roots have to be specified manually.
//! - **rustls-tls-webpki-roots**: Enables TLS functionality provided by rustls, while using root certificates
//! from the webpki-roots crate.
//! - **rustls-tls-native-roots**: Enables TLS functionality provided by rustls, while using root certificates
//! from the rustls-native-certs crate.
//! - **blocking**: Provides the [blocking](https://docs.rs/reqwest/0.12.28/reqwest/blocking/index.html) client API.
//! - **charset** *(enabled by default)*: Improved support for decoding text.
//! - **cookies** *(enabled by default)*: Provides cookie session support.
//! - **gzip**: Provides response body gzip decompression.
//! - **brotli**: Provides response body brotli decompression.
//! - **zstd**: Provides response body zstd decompression.
//! - **deflate**: Provides response body deflate decompression.
//! - **json**: Provides serialization and deserialization for JSON bodies.
//! - **multipart**: Provides functionality for multipart forms.
//! - **stream**: Adds support for futures::Stream.
//! - **socks**: Provides SOCKS5 proxy support.
//! - **trust-dns**: Enables a trust-dns/Hickory DNS async resolver instead of the default threadpool using
//! getaddrinfo.
//! - **macos-system-configuration** *(deprecated, use `system-proxy` instead)*: Use Windows and macOS system proxy settings automatically.
//! - **system-proxy** *(enabled by default)*: Use Windows and macOS system proxy settings automatically.
//!
//! ### tauri-plugin-http features
//!
//! - **tracing**: Adds request, response, and cookie-store diagnostics through `tracing`.
//! - **unsafe-headers**: Allows webview requests to send any headers.
//! - **dangerous-settings**: Allows dangerous client settings such as accepting invalid certificates or hostnames.
pub use reqwest; pub use reqwest;
use tauri::{ use tauri::{
+1
View File
@@ -7,6 +7,7 @@ license = { workspace = true }
edition = { workspace = true } edition = { workspace = true }
rust-version = { workspace = true } rust-version = { workspace = true }
repository = { workspace = true } repository = { workspace = true }
exclude = ["/banner.png"]
[package.metadata.platforms.support] [package.metadata.platforms.support]
windows = { level = "full", notes = "" } windows = { level = "full", notes = "" }
+7
View File
@@ -8,6 +8,13 @@ edition = { workspace = true }
rust-version = { workspace = true } rust-version = { workspace = true }
repository = { workspace = true } repository = { workspace = true }
links = "tauri-plugin-log" links = "tauri-plugin-log"
exclude = [
"/banner.png",
"/guest-js",
"/package.json",
"/rollup.config.js",
"/tsconfig.json",
]
[package.metadata.platforms.support] [package.metadata.platforms.support]
windows = { level = "full", notes = "" } windows = { level = "full", notes = "" }
+12 -1
View File
@@ -3,6 +3,11 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
//! Logging for Tauri applications. //! Logging for Tauri applications.
//!
//! ## Cargo features
//!
//! - **colored**: Enables [`Builder::with_colors`] `fern`'s `colored` feature for ANSI-colored outputs.
//! - **tracing**: Emit both log and tracing for the JavaScript log commands.
#![doc( #![doc(
html_logo_url = "https://github.com/tauri-apps/tauri/raw/dev/app-icon.png", html_logo_url = "https://github.com/tauri-apps/tauri/raw/dev/app-icon.png",
@@ -648,7 +653,13 @@ impl Builder {
/// Skip the creation and global registration of a logger /// Skip the creation and global registration of a logger
/// ///
/// If you wish to use your own global logger, you must call `skip_logger` so that the plugin does not attempt to set a second global logger. In this configuration, no logger will be created and the plugin's `log` command will rely on the result of `log::logger()`. You will be responsible for configuring the logger yourself and any included targets will be ignored. If ever initializing the plugin multiple times, such as if registering the plugin while testing, call this method to avoid panicking when registering multiple loggers. For interacting with `tracing`, you can leverage the `tracing-log` logger to forward logs to `tracing` or enable the `tracing` feature for this plugin to emit events directly to the tracing system. Both scenarios require calling this method. /// If you wish to use your own global logger, you must call `skip_logger` so that the plugin does not attempt to set a second global logger.
/// In this configuration, no logger will be created and the plugin's `log` command will rely on the result of `log::logger()`.
/// You will be responsible for configuring the logger yourself and any included targets will be ignored.
/// If ever initializing the plugin multiple times, such as if registering the plugin while testing, call this method to avoid panicking when registering multiple loggers.
/// For interacting with `tracing`, you can leverage the `tracing-log` logger to forward logs to `tracing` or enable the `tracing` feature for this plugin to emit events directly to the tracing system.
/// Both scenarios require calling this method.
///
/// ```rust /// ```rust
/// static LOGGER: SimpleLogger = SimpleLogger; /// static LOGGER: SimpleLogger = SimpleLogger;
/// ///
+1
View File
@@ -7,6 +7,7 @@ authors = { workspace = true }
license = { workspace = true } license = { workspace = true }
repository = { workspace = true } repository = { workspace = true }
links = "tauri-plugin-nfc" links = "tauri-plugin-nfc"
exclude = ["/guest-js", "/package.json", "/rollup.config.js", "/tsconfig.json"]
[package.metadata.docs.rs] [package.metadata.docs.rs]
targets = ["x86_64-linux-android"] targets = ["x86_64-linux-android"]
+1
View File
@@ -47,6 +47,7 @@ impl<R: Runtime> Nfc<R> {
pub fn scan(&self, payload: ScanRequest) -> crate::Result<ScanResponse> { pub fn scan(&self, payload: ScanRequest) -> crate::Result<ScanResponse> {
self.0 self.0
.run_mobile_plugin("scan", payload) .run_mobile_plugin("scan", payload)
.map(|v| ScanResponse { tag: v })
.map_err(Into::into) .map_err(Into::into)
} }
+8
View File
@@ -8,6 +8,14 @@ license = { workspace = true }
rust-version = { workspace = true } rust-version = { workspace = true }
repository = { workspace = true } repository = { workspace = true }
links = "tauri-plugin-notification" links = "tauri-plugin-notification"
exclude = [
"/banner.png",
"/guest-js",
"/package.json",
"/rollup.config.js",
"/test",
"/tsconfig.json",
]
[package.metadata.docs.rs] [package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu", "x86_64-linux-android"] targets = ["x86_64-unknown-linux-gnu", "x86_64-linux-android"]
@@ -80,11 +80,11 @@ class NotificationStorage(private val context: Context, private val jsonMapper:
fun writeActionGroup(actions: List<ActionType>) { fun writeActionGroup(actions: List<ActionType>) {
for (type in actions) { for (type in actions) {
val i = type.id
val editor = getStorage(ACTION_TYPES_ID + type.id).edit() val editor = getStorage(ACTION_TYPES_ID + type.id).edit()
editor.clear() editor.clear()
editor.putInt("count", type.actions.size) editor.putInt("count", type.actions.size)
for (action in type.actions) { for (i in 0 until type.actions.size) {
val action = type.actions[i]
editor.putString("id$i", action.id) editor.putString("id$i", action.id)
editor.putString("title$i", action.title) editor.putString("title$i", action.title)
editor.putBoolean("input$i", action.input ?: false) editor.putBoolean("input$i", action.input ?: false)
+2 -1
View File
@@ -73,7 +73,8 @@ interface Options {
/** /**
* The sound resource name or file path for the notification. * The sound resource name or file path for the notification.
* *
* Platform specific behavior: * ## Platform-specific behavior:
*
* - On macOS: use system sounds (e.g., "Ping", "Blow") or sound files in the app bundle * - On macOS: use system sounds (e.g., "Ping", "Blow") or sound files in the app bundle
* - On Linux: use XDG theme sounds (e.g., "message-new-instant") or file paths * - On Linux: use XDG theme sounds (e.g., "message-new-instant") or file paths
* - On Windows: use file paths to sound files (.wav format) * - On Windows: use file paths to sound files (.wav format)
+4
View File
@@ -3,6 +3,10 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
//! Send message notifications (brief auto-expiring OS window element) to your user. Can also be used with the Notification Web API. //! Send message notifications (brief auto-expiring OS window element) to your user. Can also be used with the Notification Web API.
//!
//! ## Cargo features
//!
//! - **windows7-compat**: Adds support for the legacy Windows 7 notification implementation and Windows-version detection.
#![doc( #![doc(
html_logo_url = "https://github.com/tauri-apps/tauri/raw/dev/app-icon.png", html_logo_url = "https://github.com/tauri-apps/tauri/raw/dev/app-icon.png",
+178
View File
@@ -320,6 +320,95 @@ pub struct ActionType {
hidden_previews_show_subtitle: bool, hidden_previews_show_subtitle: bool,
} }
#[cfg(mobile)]
#[derive(Debug)]
pub struct ActionTypeBuilder(ActionType);
#[cfg(mobile)]
impl ActionType {
pub fn builder(id: impl Into<String>) -> ActionTypeBuilder {
ActionTypeBuilder(Self {
id: id.into(),
actions: Vec::new(),
hidden_previews_body_placeholder: None,
custom_dismiss_action: false,
allow_in_car_play: false,
hidden_previews_show_title: false,
hidden_previews_show_subtitle: false,
})
}
pub fn id(&self) -> &str {
&self.id
}
pub fn actions(&self) -> &[Action] {
&self.actions
}
pub fn hidden_previews_body_placeholder(&self) -> Option<&str> {
self.hidden_previews_body_placeholder.as_deref()
}
pub fn custom_dismiss_action(&self) -> bool {
self.custom_dismiss_action
}
pub fn allow_in_car_play(&self) -> bool {
self.allow_in_car_play
}
pub fn hidden_previews_show_title(&self) -> bool {
self.hidden_previews_show_title
}
pub fn hidden_previews_show_subtitle(&self) -> bool {
self.hidden_previews_show_subtitle
}
}
#[cfg(mobile)]
impl ActionTypeBuilder {
pub fn actions(mut self, actions: Vec<Action>) -> Self {
self.0.actions = actions;
self
}
pub fn hidden_previews_body_placeholder(
mut self,
hidden_previews_body_placeholder: impl Into<String>,
) -> Self {
self.0
.hidden_previews_body_placeholder
.replace(hidden_previews_body_placeholder.into());
self
}
pub fn custom_dismiss_action(mut self, custom_dismiss_action: bool) -> Self {
self.0.custom_dismiss_action = custom_dismiss_action;
self
}
pub fn allow_in_car_play(mut self, allow_in_car_play: bool) -> Self {
self.0.allow_in_car_play = allow_in_car_play;
self
}
pub fn hidden_previews_show_title(mut self, hidden_previews_show_title: bool) -> Self {
self.0.hidden_previews_show_title = hidden_previews_show_title;
self
}
pub fn hidden_previews_show_subtitle(mut self, hidden_previews_show_subtitle: bool) -> Self {
self.0.hidden_previews_show_subtitle = hidden_previews_show_subtitle;
self
}
pub fn build(self) -> ActionType {
self.0
}
}
#[cfg(mobile)] #[cfg(mobile)]
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
@@ -334,6 +423,95 @@ pub struct Action {
input_placeholder: Option<String>, input_placeholder: Option<String>,
} }
#[cfg(mobile)]
#[derive(Debug)]
pub struct ActionBuilder(Action);
#[cfg(mobile)]
impl Action {
pub fn builder(id: impl Into<String>, title: impl Into<String>) -> ActionBuilder {
ActionBuilder(Self {
id: id.into(),
title: title.into(),
requires_authentication: false,
foreground: false,
destructive: false,
input: false,
input_button_title: None,
input_placeholder: None,
})
}
pub fn id(&self) -> &str {
&self.id
}
pub fn title(&self) -> &str {
&self.title
}
pub fn requires_authentication(&self) -> bool {
self.requires_authentication
}
pub fn foreground(&self) -> bool {
self.foreground
}
pub fn destructive(&self) -> bool {
self.destructive
}
pub fn input(&self) -> bool {
self.input
}
pub fn input_button_title(&self) -> Option<&str> {
self.input_button_title.as_deref()
}
pub fn input_placeholder(&self) -> Option<&str> {
self.input_placeholder.as_deref()
}
}
#[cfg(mobile)]
impl ActionBuilder {
pub fn requires_authentication(mut self, requires_authentication: bool) -> Self {
self.0.requires_authentication = requires_authentication;
self
}
pub fn foreground(mut self, foreground: bool) -> Self {
self.0.foreground = foreground;
self
}
pub fn destructive(mut self, destructive: bool) -> Self {
self.0.destructive = destructive;
self
}
pub fn input(mut self, input: bool) -> Self {
self.0.input = input;
self
}
pub fn input_button_title(mut self, input_button_title: impl Into<String>) -> Self {
self.0.input_button_title.replace(input_button_title.into());
self
}
pub fn input_placeholder(mut self, input_placeholder: impl Into<String>) -> Self {
self.0.input_placeholder.replace(input_placeholder.into());
self
}
pub fn build(self) -> Action {
self.0
}
}
#[cfg(target_os = "android")] #[cfg(target_os = "android")]
pub use android::*; pub use android::*;
+2
View File
@@ -11,6 +11,8 @@ links = "tauri-plugin-opener"
# Platforms supported by the plugin # Platforms supported by the plugin
# Support levels are "full", "partial", "none", "unknown" # Support levels are "full", "partial", "none", "unknown"
# Details of the support level are left to plugin maintainer # Details of the support level are left to plugin maintainer
exclude = ["/guest-js", "/package.json", "/rollup.config.js", "/tsconfig.json"]
[package.metadata.platforms.support] [package.metadata.platforms.support]
windows = { level = "full", notes = "" } windows = { level = "full", notes = "" }
linux = { level = "full", notes = "" } linux = { level = "full", notes = "" }
+7
View File
@@ -8,6 +8,13 @@ license = { workspace = true }
rust-version = { workspace = true } rust-version = { workspace = true }
repository = { workspace = true } repository = { workspace = true }
links = "tauri-plugin-os" links = "tauri-plugin-os"
exclude = [
"/banner.png",
"/guest-js",
"/package.json",
"/rollup.config.js",
"/tsconfig.json",
]
[package.metadata.platforms.support] [package.metadata.platforms.support]
windows = { level = "full", notes = "" } windows = { level = "full", notes = "" }
+1
View File
@@ -7,6 +7,7 @@ license = { workspace = true }
edition = { workspace = true } edition = { workspace = true }
rust-version = { workspace = true } rust-version = { workspace = true }
repository = { workspace = true } repository = { workspace = true }
exclude = ["/banner.png"]
[package.metadata.platforms.support] [package.metadata.platforms.support]
windows = { level = "full", notes = "" } windows = { level = "full", notes = "" }
+5 -2
View File
@@ -3,6 +3,10 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
//! Save filesystem and asset scopes and restore them when the app is reopened. //! Save filesystem and asset scopes and restore them when the app is reopened.
//!
//! ## Cargo features
//!
//! - **protocol-asset**: Enables `tauri`'s `protocol-asset` feature and adds support for persisting `asset://` protocol scopes.
#![doc( #![doc(
html_logo_url = "https://github.com/tauri-apps/tauri/raw/dev/app-icon.png", html_logo_url = "https://github.com/tauri-apps/tauri/raw/dev/app-icon.png",
@@ -232,10 +236,9 @@ pub fn init<R: Runtime>() -> TauriPlugin<R> {
let app_dir_ = app_dir.clone(); let app_dir_ = app_dir.clone();
if let Some(fs_scope) = &fs_scope { if let Some(fs_scope) = &fs_scope {
let app_ = app.clone();
fs_scope.listen(move |event| { fs_scope.listen(move |event| {
if let tauri::fs::Event::PathAllowed(_) = event { if let tauri::fs::Event::PathAllowed(_) = event {
save_scopes(&app_.fs_scope(), &app_dir, &fs_scope_state_path); save_scopes(&app.fs_scope(), &app_dir, &fs_scope_state_path);
} }
}); });
} }
+7
View File
@@ -8,6 +8,13 @@ edition = { workspace = true }
rust-version = { workspace = true } rust-version = { workspace = true }
repository = { workspace = true } repository = { workspace = true }
links = "tauri-plugin-positioner" links = "tauri-plugin-positioner"
exclude = [
"/banner.png",
"/guest-js",
"/package.json",
"/rollup.config.js",
"/tsconfig.json",
]
[package.metadata.platforms.support] [package.metadata.platforms.support]
windows = { level = "full", notes = "" } windows = { level = "full", notes = "" }
+1 -1
View File
@@ -5,7 +5,7 @@
//! A plugin for Tauri that helps position your windows at well-known locations. //! A plugin for Tauri that helps position your windows at well-known locations.
//! //!
//! # Cargo features //! ## Cargo features
//! //!
//! - **tray-icon**: Enables tray-icon-relative positions. //! - **tray-icon**: Enables tray-icon-relative positions.
//! //!
+7
View File
@@ -8,6 +8,13 @@ license = { workspace = true }
rust-version = { workspace = true } rust-version = { workspace = true }
repository = { workspace = true } repository = { workspace = true }
links = "tauri-plugin-process" links = "tauri-plugin-process"
exclude = [
"/banner.png",
"/guest-js",
"/package.json",
"/rollup.config.js",
"/tsconfig.json",
]
[package.metadata.platforms.support] [package.metadata.platforms.support]
windows = { level = "full", notes = "" } windows = { level = "full", notes = "" }
+8
View File
@@ -8,6 +8,14 @@ license = { workspace = true }
rust-version = { workspace = true } rust-version = { workspace = true }
repository = { workspace = true } repository = { workspace = true }
links = "tauri-plugin-shell" links = "tauri-plugin-shell"
exclude = [
"/banner.png",
"/guest-js",
"/package.json",
"/rollup.config.js",
"/test",
"/tsconfig.json",
]
[package.metadata.platforms.support] [package.metadata.platforms.support]
windows = { level = "full", notes = "" } windows = { level = "full", notes = "" }
+2 -4
View File
@@ -479,10 +479,8 @@ fn read_line<F: Fn(Vec<u8>) -> CommandEvent + Send + Copy + 'static>(
let _ = block_on_task(async move { tx_.send(wrapper(buf)).await }); let _ = block_on_task(async move { tx_.send(wrapper(buf)).await });
} }
Err(e) => { Err(e) => {
let tx_ = tx.clone(); let _ =
let _ = block_on_task( block_on_task(async move { tx.send(CommandEvent::Error(e.to_string())).await });
async move { tx_.send(CommandEvent::Error(e.to_string())).await },
);
break; break;
} }
} }
+1 -1
View File
@@ -7,7 +7,7 @@ license = { workspace = true }
edition = { workspace = true } edition = { workspace = true }
rust-version = { workspace = true } rust-version = { workspace = true }
repository = { workspace = true } repository = { workspace = true }
exclude = ["/examples"] exclude = ["/banner.png", "/examples"]
[package.metadata.platforms.support] [package.metadata.platforms.support]
windows = { level = "full", notes = "" } windows = { level = "full", notes = "" }
@@ -9,6 +9,6 @@
"author": "", "author": "",
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"@tauri-apps/cli": "2.11.2" "@tauri-apps/cli": "2.11.4"
} }
} }
@@ -16,6 +16,3 @@ tauri-plugin-cli = { path = "../../../../cli" }
[build-dependencies] [build-dependencies]
tauri-build = { workspace = true } tauri-build = { workspace = true }
[features]
prod = ["tauri/custom-protocol"]

Some files were not shown because too many files have changed in this diff Show More