Compare commits

..

14 Commits

Author SHA1 Message Date
amrbashir c61b224564 try with sudo 2024-11-21 14:23:49 +02:00
amrbashir 719cd9398e try with /NS 2024-11-19 03:24:59 +02:00
amrbashir 84bfcea116 quiet 2024-11-19 02:23:36 +02:00
amrbashir 021547be1c skip uninstalling in CI 2024-11-19 01:43:28 +02:00
amrbashir eb5c600eda try with passive one more time 2024-11-19 01:42:08 +02:00
amrbashir ee5332fa84 enabe nsis 2024-11-17 17:09:21 +02:00
amrbashir 802e416a51 try with slient and longer wait between runs 2024-11-17 17:07:26 +02:00
amrbashir e0da7a8b8d try with passive 2024-11-17 16:46:57 +02:00
amrbashir e9937b2220 fix appimage 2024-11-17 16:14:16 +02:00
amrbashir 4dfbb13520 fix compilation 2024-11-17 04:54:07 +02:00
amrbashir 60728ea22a fix appimage 2024-11-17 04:48:40 +02:00
amrbashir 7dee8ab6e2 appimage test 2024-11-17 04:38:08 +02:00
amrbashir 30dd3f8b45 fix tests in CI 2024-11-17 02:12:56 +02:00
amrbashir 49a4f78806 refactor: simplify updater tests 2024-11-16 03:14:34 +02:00
353 changed files with 5906 additions and 11336 deletions
+6
View File
@@ -0,0 +1,6 @@
---
"upload": "minor"
"upload-js": "minor"
---
Added a new field `progressTotal` to track the total amount of data transferred during the upload/download process.
+4 -26
View File
@@ -14,20 +14,10 @@
"command": "pnpm build", "command": "pnpm build",
"dryRunCommand": "pnpm build" "dryRunCommand": "pnpm build"
}, },
{
"command": "echo '<details>\n<summary><em><h4>PNPM Publish</h4></em></summary>\n\n```'",
"dryRunCommand": true,
"pipe": true
},
{ {
"command": "npm publish --provenance --access public", "command": "npm publish --provenance --access public",
"dryRunCommand": "npm publish --provenance --access public --dry-run", "dryRunCommand": "npm publish --provenance --access public --dry-run",
"pipe": true "pipe": true
},
{
"command": "echo '```\n\n</details>\n'",
"dryRunCommand": true,
"pipe": true
} }
] ]
}, },
@@ -66,13 +56,12 @@
"dependencies": [ "dependencies": [
"barcode-scanner", "barcode-scanner",
"biometric", "biometric",
"log", "log-plugin",
"cli", "cli",
"clipboard-manager", "clipboard-manager",
"dialog", "dialog",
"fs", "fs",
"global-shortcut", "global-shortcut",
"opener",
"http", "http",
"nfc", "nfc",
"notification", "notification",
@@ -98,7 +87,6 @@
"dialog-js", "dialog-js",
"fs-js", "fs-js",
"global-shortcut-js", "global-shortcut-js",
"opener-js",
"http-js", "http-js",
"nfc-js", "nfc-js",
"notification-js", "notification-js",
@@ -180,8 +168,7 @@
}, },
"dialog-js": { "dialog-js": {
"path": "./plugins/dialog", "path": "./plugins/dialog",
"manager": "javascript", "manager": "javascript"
"dependencies": ["fs-js"]
}, },
"geolocation": { "geolocation": {
"path": "./plugins/geolocation", "path": "./plugins/geolocation",
@@ -199,14 +186,6 @@
"path": "./plugins/global-shortcut", "path": "./plugins/global-shortcut",
"manager": "javascript" "manager": "javascript"
}, },
"opener": {
"path": "./plugins/opener",
"manager": "rust"
},
"opener-js": {
"path": "./plugins/opener",
"manager": "javascript"
},
"haptics": { "haptics": {
"path": "./plugins/haptics", "path": "./plugins/haptics",
"manager": "rust" "manager": "rust"
@@ -222,14 +201,13 @@
}, },
"http-js": { "http-js": {
"path": "./plugins/http", "path": "./plugins/http",
"manager": "javascript", "manager": "javascript"
"dependencies": ["fs-js"]
}, },
"localhost": { "localhost": {
"path": "./plugins/localhost", "path": "./plugins/localhost",
"manager": "rust" "manager": "rust"
}, },
"log": { "log-plugin": {
"path": "./plugins/log", "path": "./plugins/log",
"manager": "rust" "manager": "rust"
}, },
@@ -0,0 +1,6 @@
---
deep-link: patch
deep-link-js: patch
---
`onOpenUrl()` will now not call `getCurrent()` anymore, matching the documented behavior.
@@ -0,0 +1,6 @@
---
'log-plugin': 'patch'
'log-js': 'patch'
---
Make webview log target more consistent that it always starts with `webview`
+7
View File
@@ -0,0 +1,7 @@
---
"fs": "patch"
"fs-js": "patch"
---
Fix `readDir` function failing to read directories that contain broken symlinks.
@@ -0,0 +1,5 @@
---
'localhost': 'minor'
---
Add custom host binding to allow external access
-2
View File
@@ -6,8 +6,6 @@ As you create PRs and make changes that require a version bump, please add a new
When you select the version bump required, you do _not_ need to consider dependencies. Only note the package with the actual change, and any packages that depend on that package will be bumped automatically in the process. When you select the version bump required, you do _not_ need to consider dependencies. Only note the package with the actual change, and any packages that depend on that package will be bumped automatically in the process.
**Note, that in this repository, even if only the Rust code or only the JavaScript code of a plugin changed, both packages need to be bumped with the same increment!**
Use the following format: Use the following format:
```md ```md
@@ -0,0 +1,5 @@
---
"sql": "patch"
---
Allow blocking on async code without creating a nested runtime.
-64
View File
@@ -1,64 +0,0 @@
# Tauri Contributing Guide
Hi! We, the maintainers, are really excited that you are interested in contributing to Tauri. Before submitting your contribution though, please make sure to take a moment and read through the [Code of Conduct](CODE_OF_CONDUCT.md), as well as the appropriate section for the contribution you intend to make:
- [Issue Reporting Guidelines](#issue-reporting-guidelines)
- [Pull Request Guidelines](#pull-request-guidelines)
- [Development Guide](#development-guide)
## Issue Reporting Guidelines
- The issue list of this repo is **exclusively** for bug reports and feature requests. Non-conforming issues will be closed immediately.
- If you have a question, you can get quick answers from the [Tauri Discord chat](https://discord.com/invite/tauri).
- Try to search for your issue, it may have already been answered or even fixed in the development branch (`v2`).
- Check if the issue is reproducible with the latest stable version of Tauri. If you are using a pre-release, please indicate the specific version you are using.
- It is **required** that you clearly describe the steps necessary to reproduce the issue you are running into. Although we would love to help our users as much as possible, diagnosing issues without clear reproduction steps is extremely time-consuming and simply not sustainable.
- Use only the minimum amount of code necessary to reproduce the unexpected behavior. A good bug report should isolate specific methods that exhibit unexpected behavior and precisely define how expectations were violated. What did you expect the method or methods to do, and how did the observed behavior differ? The more precisely you isolate the issue, the faster we can investigate.
- Issues with no clear repro steps will not be triaged. If an issue labeled "need repro" receives no further input from the issue author for more than 5 days, it will be closed.
- If your issue is resolved but still open, don't hesitate to close it. In case you found a solution by yourself, it could be helpful for others to explain how you fixed it.
- Most importantly, we beg your patience: the team must balance your request against many other responsibilities — fixing other bugs, answering other questions, new features, new documentation, etc. The issue list is not paid support and we cannot make guarantees about how fast your issue can be resolved.
## Pull Request Guidelines
- You have to [sign your commits](https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits).
- It's OK to have multiple small commits as you work on the PR - we will let GitHub automatically squash it before merging.
- If adding new feature:
- Provide convincing reason to add this feature. Ideally you should open a suggestion issue first and have it greenlighted before working on it.
- If fixing a bug:
- If you are resolving a special issue, add `(fix: #xxxx[,#xxx])` (#xxxx is the issue id) in your PR title for a better release log, e.g. `fix: update entities encoding/decoding (fix #3899)`.
- Provide detailed description of the bug in the PR, or link to an issue that does.
- If the PR is meant to be released, follow the instructions in `.changes/readme.md` to log your changes. ie. [readme.md](https://github.com/tauri-apps/plugins-workspace/blob/v2/.changes/readme.md)
## Development Guide
**NOTE: If you have any question don't hesitate to ask in our Discord server. We try to keep this guide to up guide, but if something doesn't work let us know.**
### General Setup
First, [join our Discord server](https://discord.com/invite/tauri) and let us know that you want to contribute. This way we can point you in the right direction and help ensure your contribution will be as helpful as possible.
To set up your machine for development, follow the [Tauri setup guide](https://v2.tauri.app/start/prerequisites/) to get all the tools you need to develop Tauri apps. The only additional tool you may need is [PNPM](https://pnpm.io/).
Next, [fork](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo) and clone [this repository](https://github.com/tauri-apps/plugins-workspace/tree/v2).
### Developing and testing
The easiest way to test your changes is to use the [example app](https://github.com/tauri-apps/plugins-workspace/tree/v2/examples/api) example app. It automatically rebuilds and uses your local copy of the plugins. To run it follow the instructions inside [README.md](https://github.com/tauri-apps/plugins-workspace/blob/v2/examples/api/README.md).
To test local changes against your own application simply point the plugin create to your local repository, for example:
`tauri-plugin-sample = { path = "path/to/local/tauri-plugin-sample/" }`
+1 -1
View File
@@ -46,7 +46,7 @@ jobs:
node-version: 'lts/*' node-version: 'lts/*'
- uses: pnpm/action-setup@v4 - uses: pnpm/action-setup@v4
with: with:
version: 10.x.x version: 9.x.x
run_install: true run_install: true
- name: audit - name: audit
run: pnpm audit run: pnpm audit
-44
View File
@@ -1,44 +0,0 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: check change files
on:
pull_request:
paths:
- '.changes/*.md'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: check change files end with .md
run: |
for file in .changes/*
do
if [[ ! "$file" =~ \.(md|json)$ ]]; then
echo ".changes directory should only contain files that end with .md"
echo "found an invalid file in .changes directory:"
echo "$file"
exit 1
fi
done
- uses: dorny/paths-filter@v3
id: filter
with:
list-files: shell
filters: |
changes:
- added|modified: '.changes/*.md'
- name: check
run: node ./.scripts/ci/check-change-files.js ${{ steps.filter.outputs.changes_files }}
if: ${{ steps.filter.outputs.changes == 'true' }}
+1 -29
View File
@@ -8,7 +8,6 @@ on:
pull_request: pull_request:
paths: paths:
- '.github/workflows/check-generated-files.yml' - '.github/workflows/check-generated-files.yml'
- pnpm-lock.yaml
- '**/guest-js/**' - '**/guest-js/**'
concurrency: concurrency:
@@ -28,117 +27,90 @@ jobs:
filters: | filters: |
autostart: autostart:
- .github/workflows/check-generated-files.yml - .github/workflows/check-generated-files.yml
- pnpm-lock.yaml
- plugins/autostart/guest-js/** - plugins/autostart/guest-js/**
- plugins/autostart/src/api-iife.js - plugins/autostart/src/api-iife.js
cli: cli:
- .github/workflows/check-generated-files.yml - .github/workflows/check-generated-files.yml
- pnpm-lock.yaml
- plugins/cli/guest-js/** - plugins/cli/guest-js/**
- plugins/cli/src/api-iife.js - plugins/cli/src/api-iife.js
clipboard-manager: clipboard-manager:
- .github/workflows/check-generated-files.yml - .github/workflows/check-generated-files.yml
- pnpm-lock.yaml
- plugins/clipboard-manager/guest-js/** - plugins/clipboard-manager/guest-js/**
- plugins/clipboard-manager/src/api-iife.js - plugins/clipboard-manager/src/api-iife.js
dialog: dialog:
- .github/workflows/check-generated-files.yml - .github/workflows/check-generated-files.yml
- pnpm-lock.yaml
- plugins/dialog/guest-js/** - plugins/dialog/guest-js/**
- plugins/dialog/src/api-iife.js - plugins/dialog/src/api-iife.js
fs: fs:
- .github/workflows/check-generated-files.yml - .github/workflows/check-generated-files.yml
- pnpm-lock.yaml
- plugins/fs/guest-js/** - plugins/fs/guest-js/**
- plugins/fs/src/api-iife.js - plugins/fs/src/api-iife.js
geolocation: geolocation:
- .github/workflows/check-generated-files.yml - .github/workflows/check-generated-files.yml
- pnpm-lock.yaml
- plugins/geolocation/guest-js/** - plugins/geolocation/guest-js/**
- plugins/geolocation/src/api-iife.js - plugins/geolocation/src/api-iife.js
global-shortcut: global-shortcut:
- .github/workflows/check-generated-files.yml - .github/workflows/check-generated-files.yml
- pnpm-lock.yaml
- plugins/global-shortcut/guest-js/** - plugins/global-shortcut/guest-js/**
- plugins/global-shortcut/src/api-iife.js - plugins/global-shortcut/src/api-iife.js
opener:
- .github/workflows/check-generated-files.yml
- pnpm-lock.yaml
- plugins/opener/guest-js/**
- plugins/opener/src/api-iife.js
haptics: haptics:
- .github/workflows/check-generated-files.yml - .github/workflows/check-generated-files.yml
- pnpm-lock.yaml
- plugins/haptics/guest-js/** - plugins/haptics/guest-js/**
- plugins/haptics/src/api-iife.js - plugins/haptics/src/api-iife.js
http: http:
- .github/workflows/check-generated-files.yml - .github/workflows/check-generated-files.yml
- pnpm-lock.yaml
- plugins/http/guest-js/** - plugins/http/guest-js/**
- plugins/http/src/api-iife.js - plugins/http/src/api-iife.js
log: log:
- .github/workflows/check-generated-files.yml - .github/workflows/check-generated-files.yml
- pnpm-lock.yaml
- plugins/log/guest-js/** - plugins/log/guest-js/**
- plugins/log/src/api-iife.js - plugins/log/src/api-iife.js
notification: notification:
- .github/workflows/check-generated-files.yml - .github/workflows/check-generated-files.yml
- pnpm-lock.yaml
- plugins/notification/guest-js/** - plugins/notification/guest-js/**
- plugins/notification/src/api-iife.js - plugins/notification/src/api-iife.js
os: os:
- .github/workflows/check-generated-files.yml - .github/workflows/check-generated-files.yml
- pnpm-lock.yaml
- plugins/os/guest-js/** - plugins/os/guest-js/**
- plugins/os/src/api-iife.js - plugins/os/src/api-iife.js
positioner: positioner:
- .github/workflows/check-generated-files.yml - .github/workflows/check-generated-files.yml
- pnpm-lock.yaml
- plugins/positioner/guest-js/** - plugins/positioner/guest-js/**
- plugins/positioner/src/api-iife.js - plugins/positioner/src/api-iife.js
process: process:
- .github/workflows/check-generated-files.yml - .github/workflows/check-generated-files.yml
- pnpm-lock.yaml
- plugins/process/guest-js/** - plugins/process/guest-js/**
- plugins/process/src/api-iife.js - plugins/process/src/api-iife.js
shell: shell:
- .github/workflows/check-generated-files.yml - .github/workflows/check-generated-files.yml
- pnpm-lock.yaml
- plugins/shell/guest-js/** - plugins/shell/guest-js/**
- plugins/shell/src/api-iife.js - plugins/shell/src/api-iife.js
sql: sql:
- .github/workflows/check-generated-files.yml - .github/workflows/check-generated-files.yml
- pnpm-lock.yaml
- plugins/sql/guest-js/** - plugins/sql/guest-js/**
- plugins/sql/src/api-iife.js - plugins/sql/src/api-iife.js
store: store:
- .github/workflows/check-generated-files.yml - .github/workflows/check-generated-files.yml
- pnpm-lock.yaml
- plugins/store/guest-js/** - plugins/store/guest-js/**
- plugins/store/src/api-iife.js - plugins/store/src/api-iife.js
stronghold: stronghold:
- .github/workflows/check-generated-files.yml - .github/workflows/check-generated-files.yml
- pnpm-lock.yaml
- plugins/stronghold/guest-js/** - plugins/stronghold/guest-js/**
- plugins/stronghold/src/api-iife.js - plugins/stronghold/src/api-iife.js
updater: updater:
- .github/workflows/check-generated-files.yml - .github/workflows/check-generated-files.yml
- pnpm-lock.yaml
- plugins/updater/guest-js/** - plugins/updater/guest-js/**
- plugins/updater/src/api-iife.js - plugins/updater/src/api-iife.js
upload: upload:
- .github/workflows/check-generated-files.yml - .github/workflows/check-generated-files.yml
- pnpm-lock.yaml
- plugins/upload/guest-js/** - plugins/upload/guest-js/**
- plugins/upload/src/api-iife.js - plugins/upload/src/api-iife.js
websocket: websocket:
- .github/workflows/check-generated-files.yml - .github/workflows/check-generated-files.yml
- pnpm-lock.yaml
- plugins/websocket/guest-js/** - plugins/websocket/guest-js/**
- plugins/websocket/src/api-iife.js - plugins/websocket/src/api-iife.js
window-state: window-state:
- .github/workflows/check-generated-files.yml - .github/workflows/check-generated-files.yml
- pnpm-lock.yaml
- plugins/window-state/guest-js/** - plugins/window-state/guest-js/**
- plugins/window-state/src/api-iife.js - plugins/window-state/src/api-iife.js
@@ -167,7 +139,7 @@ jobs:
node-version: 'lts/*' node-version: 'lts/*'
- uses: pnpm/action-setup@v4 - uses: pnpm/action-setup@v4
with: with:
version: 10.x.x version: 9.x.x
run_install: true run_install: true
- name: build api - name: build api
@@ -39,7 +39,7 @@ jobs:
- uses: pnpm/action-setup@v4 - uses: pnpm/action-setup@v4
with: with:
version: 10.x.x version: 9.x.x
run_install: true run_install: true
- name: cargo login - name: cargo login
@@ -75,7 +75,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: tauri-apps/create-pull-request@v3
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 }})'
+1 -1
View File
@@ -38,7 +38,7 @@ jobs:
node-version: 'lts/*' node-version: 'lts/*'
- uses: pnpm/action-setup@v4 - uses: pnpm/action-setup@v4
with: with:
version: 10.x.x version: 9.x.x
run_install: true run_install: true
- run: pnpm format:check - run: pnpm format:check
+1 -1
View File
@@ -49,7 +49,7 @@ jobs:
node-version: 'lts/*' node-version: 'lts/*'
- uses: pnpm/action-setup@v4 - uses: pnpm/action-setup@v4
with: with:
version: 10.x.x version: 9.x.x
run_install: true run_install: true
- name: eslint - name: eslint
run: pnpm lint run: pnpm lint
-3
View File
@@ -66,9 +66,6 @@ jobs:
tauri-plugin-global-shortcut: tauri-plugin-global-shortcut:
- .github/workflows/lint-rust.yml - .github/workflows/lint-rust.yml
- plugins/global-shortcut/** - plugins/global-shortcut/**
tauri-plugin-opener:
- .github/workflows/lint-rust.yml
- plugins/opener/**
tauri-plugin-haptics: tauri-plugin-haptics:
- .github/workflows/lint-rust.yml - .github/workflows/lint-rust.yml
- plugins/haptics/** - plugins/haptics/**
+1 -1
View File
@@ -38,7 +38,7 @@ jobs:
- uses: pnpm/action-setup@v4 - uses: pnpm/action-setup@v4
with: with:
version: 10.x.x version: 9.x.x
run_install: true run_install: true
- name: Build packages - name: Build packages
-31
View File
@@ -47,140 +47,109 @@ jobs:
tauri-plugin-autostart: tauri-plugin-autostart:
- .github/workflows/test-rust.yml - .github/workflows/test-rust.yml
- Cargo.toml - Cargo.toml
- Cargo.lock
- plugins/autostart/** - plugins/autostart/**
tauri-plugin-cli: tauri-plugin-cli:
- .github/workflows/test-rust.yml - .github/workflows/test-rust.yml
- Cargo.toml - Cargo.toml
- Cargo.lock
- plugins/cli/** - plugins/cli/**
tauri-plugin-clipboard-manager: tauri-plugin-clipboard-manager:
- .github/workflows/test-rust.yml - .github/workflows/test-rust.yml
- Cargo.toml - Cargo.toml
- Cargo.lock
- plugins/clipboard-manager/** - plugins/clipboard-manager/**
tauri-plugin-deep-link: tauri-plugin-deep-link:
- .github/workflows/test-rust.yml - .github/workflows/test-rust.yml
- Cargo.toml - Cargo.toml
- Cargo.lock
- plugins/deep-link/** - plugins/deep-link/**
tauri-plugin-dialog: tauri-plugin-dialog:
- .github/workflows/test-rust.yml - .github/workflows/test-rust.yml
- Cargo.toml - Cargo.toml
- Cargo.lock
- plugins/dialog/** - plugins/dialog/**
- plugins/fs/** - plugins/fs/**
tauri-plugin-fs: tauri-plugin-fs:
- .github/workflows/test-rust.yml - .github/workflows/test-rust.yml
- Cargo.toml - Cargo.toml
- Cargo.lock
- plugins/fs/** - plugins/fs/**
tauri-plugin-geolocation: tauri-plugin-geolocation:
- .github/workflows/test-rust.yml - .github/workflows/test-rust.yml
- Cargo.toml - Cargo.toml
- Cargo.lock
- plugins/geolocation/** - plugins/geolocation/**
tauri-plugin-global-shortcut: tauri-plugin-global-shortcut:
- .github/workflows/test-rust.yml - .github/workflows/test-rust.yml
- Cargo.toml - Cargo.toml
- Cargo.lock
- plugins/global-shortcut/** - plugins/global-shortcut/**
tauri-plugin-opener:
- .github/workflows/test-rust.yml
- Cargo.toml
- Cargo.lock
- plugins/opener/**
tauri-plugin-haptics: tauri-plugin-haptics:
- .github/workflows/test-rust.yml - .github/workflows/test-rust.yml
- Cargo.toml - Cargo.toml
- Cargo.lock
- plugins/haptics/** - plugins/haptics/**
tauri-plugin-http: tauri-plugin-http:
- .github/workflows/test-rust.yml - .github/workflows/test-rust.yml
- Cargo.toml - Cargo.toml
- Cargo.lock
- plugins/http/** - plugins/http/**
- plugins/fs/** - plugins/fs/**
tauri-plugin-localhost: tauri-plugin-localhost:
- .github/workflows/test-rust.yml - .github/workflows/test-rust.yml
- Cargo.toml - Cargo.toml
- Cargo.lock
- plugins/localhost/** - plugins/localhost/**
tauri-plugin-log: tauri-plugin-log:
- .github/workflows/test-rust.yml - .github/workflows/test-rust.yml
- Cargo.toml - Cargo.toml
- Cargo.lock
- plugins/log/** - plugins/log/**
tauri-plugin-notification: tauri-plugin-notification:
- .github/workflows/test-rust.yml - .github/workflows/test-rust.yml
- Cargo.toml - Cargo.toml
- Cargo.lock
- plugins/notification/** - plugins/notification/**
tauri-plugin-os: tauri-plugin-os:
- .github/workflows/test-rust.yml - .github/workflows/test-rust.yml
- Cargo.toml - Cargo.toml
- Cargo.lock
- plugins/os/** - plugins/os/**
tauri-plugin-persisted-scope: tauri-plugin-persisted-scope:
- .github/workflows/test-rust.yml - .github/workflows/test-rust.yml
- Cargo.toml - Cargo.toml
- Cargo.lock
- plugins/persisted-scope/** - plugins/persisted-scope/**
- plugins/fs/** - plugins/fs/**
tauri-plugin-positioner: tauri-plugin-positioner:
- .github/workflows/test-rust.yml - .github/workflows/test-rust.yml
- Cargo.toml - Cargo.toml
- Cargo.lock
- plugins/positioner/** - plugins/positioner/**
tauri-plugin-process: tauri-plugin-process:
- .github/workflows/test-rust.yml - .github/workflows/test-rust.yml
- Cargo.toml - Cargo.toml
- Cargo.lock
- plugins/process/** - plugins/process/**
tauri-plugin-shell: tauri-plugin-shell:
- .github/workflows/test-rust.yml - .github/workflows/test-rust.yml
- Cargo.toml - Cargo.toml
- Cargo.lock
- plugins/shell/** - plugins/shell/**
tauri-plugin-single-instance: tauri-plugin-single-instance:
- .github/workflows/test-rust.yml - .github/workflows/test-rust.yml
- Cargo.toml - Cargo.toml
- Cargo.lock
- plugins/single-instance/** - plugins/single-instance/**
tauri-plugin-sql: tauri-plugin-sql:
- .github/workflows/test-rust.yml - .github/workflows/test-rust.yml
- Cargo.toml - Cargo.toml
- Cargo.lock
- plugins/sql/** - plugins/sql/**
tauri-plugin-store: tauri-plugin-store:
- .github/workflows/test-rust.yml - .github/workflows/test-rust.yml
- Cargo.toml - Cargo.toml
- Cargo.lock
- plugins/store/** - plugins/store/**
tauri-plugin-stronghold: tauri-plugin-stronghold:
- .github/workflows/test-rust.yml - .github/workflows/test-rust.yml
- Cargo.toml - Cargo.toml
- Cargo.lock
- plugins/stronghold/** - plugins/stronghold/**
tauri-plugin-updater: tauri-plugin-updater:
- .github/workflows/test-rust.yml - .github/workflows/test-rust.yml
- Cargo.toml - Cargo.toml
- Cargo.lock
- plugins/updater/** - plugins/updater/**
tauri-plugin-upload: tauri-plugin-upload:
- .github/workflows/test-rust.yml - .github/workflows/test-rust.yml
- Cargo.toml - Cargo.toml
- Cargo.lock
- plugins/upload/** - plugins/upload/**
tauri-plugin-websocket: tauri-plugin-websocket:
- .github/workflows/test-rust.yml - .github/workflows/test-rust.yml
- Cargo.toml - Cargo.toml
- Cargo.lock
- plugins/websocket/** - plugins/websocket/**
tauri-plugin-window-state: tauri-plugin-window-state:
- .github/workflows/test-rust.yml - .github/workflows/test-rust.yml
- Cargo.toml - Cargo.toml
- Cargo.lock
- plugins/window-state/** - plugins/window-state/**
test: test:
+1 -4
View File
@@ -14,8 +14,6 @@ target/
# .vscode workspace settings file # .vscode workspace settings file
.vscode/settings.json .vscode/settings.json
.vscode/launch.json
.vscode/tasks.json
# npm, yarn and bun lock files # npm, yarn and bun lock files
package-lock.json package-lock.json
@@ -57,5 +55,4 @@ pids
*.sublime* *.sublime*
.idea .idea
debug.log debug.log
TODO.md TODO.md
.aider*
+1 -2
View File
@@ -1,6 +1,5 @@
{ {
"singleQuote": true, "singleQuote": true,
"semi": false, "semi": false,
"trailingComma": "none", "trailingComma": "none"
"experimentalOperatorPosition": "start"
} }
-86
View File
@@ -1,86 +0,0 @@
#!/usr/bin/env node
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
import { readFileSync, readdirSync } from 'fs'
import { join } from 'path'
/* const ignorePackages = [
'api-example',
'api-example-js',
'deep-link-example',
'deep-link-example-js'
] */
const rsOnly = ['localhost', 'persisted-scope', 'single-instance']
function checkChangeFiles(changeFiles) {
let code = 0
for (const file of changeFiles) {
const content = readFileSync(file, 'utf8')
const [frontMatter] = /^---[\s\S.]*---\n/i.exec(content)
const packages = frontMatter
.split('\n')
.filter((l) => !(l === '---' || !l))
.map((l) => l.replace(/('|")/g, '').split(':'))
const rsPackages = Object.fromEntries(
packages
.filter((v) => !v[0].endsWith('-js'))
.map((v) => [v[0], v[1].trim()])
)
const jsPackages = Object.fromEntries(
packages
.filter((v) => v[0].endsWith('-js'))
.map((v) => [v[0].slice(0, -3), v[1].trim()])
)
for (const pkg in rsPackages) {
if (rsOnly.includes(pkg)) continue
if (!jsPackages[pkg]) {
console.error(
`Missing "${rsPackages[pkg]}" bump for JS package "${pkg}-js" in ${file}.`
)
code = 1
} else if (rsPackages[pkg] != jsPackages[pkg]) {
console.error(
`"${pkg}" and "${pkg}-js" have different version bumps in ${file}.`
)
code = 1
}
}
for (const pkg in jsPackages) {
if (!rsPackages[pkg]) {
console.error(
`Missing "${jsPackages[pkg]}" bump for Rust package "${pkg}" in ${file}.`
)
code = 1
} else if (rsPackages[pkg] != jsPackages[pkg]) {
console.error(
`"${pkg}" and "${pkg}-js" have different version bumps in ${file}.`
)
code = 1
}
}
}
process.exit(code)
}
const [_bin, _script, ...files] = process.argv
if (files.length > 0) {
checkChangeFiles(
files.filter((f) => f.toLowerCase() !== '.changes/readme.md')
)
} else {
const changeFiles = readdirSync('.changes')
.filter((f) => f.endsWith('.md') && f.toLowerCase() !== 'readme.md')
.map((p) => join('.changes', p))
checkChangeFiles(changeFiles)
}
+6 -6
View File
@@ -32,8 +32,8 @@ const ignore = [
async function checkFile(file) { async function checkFile(file) {
if ( if (
extensions.some((e) => file.endsWith(e)) extensions.some((e) => file.endsWith(e)) &&
&& !ignore.some((i) => file.includes(`${path.sep}${i}`)) !ignore.some((i) => file.includes(`${path.sep}${i}`))
) { ) {
const fileStream = fs.createReadStream(file) const fileStream = fs.createReadStream(file)
const rl = readline.createInterface({ const rl = readline.createInterface({
@@ -46,10 +46,10 @@ async function checkFile(file) {
for await (let line of rl) { for await (let line of rl) {
// ignore empty lines, allow shebang, swift-tools-version and bundler license // ignore empty lines, allow shebang, swift-tools-version and bundler license
if ( if (
line.length === 0 line.length === 0 ||
|| line.startsWith('#!') line.startsWith('#!') ||
|| line.startsWith('// swift-tools-version:') line.startsWith('// swift-tools-version:') ||
|| ignoredLicenses.includes(line) ignoredLicenses.includes(line)
) { ) {
continue continue
} }
-2
View File
@@ -1,2 +0,0 @@
plugins/*/permissions/autogenerated/
plugins/*/android/.tauri/tauri-api/build/
Generated
+1318 -1827
View File
File diff suppressed because it is too large Load Diff
+2 -4
View File
@@ -10,7 +10,6 @@ resolver = "2"
[workspace.dependencies] [workspace.dependencies]
serde = { version = "1", features = ["derive"] } serde = { version = "1", features = ["derive"] }
tracing = "0.1"
log = "0.4" log = "0.4"
tauri = { version = "2", default-features = false } tauri = { version = "2", default-features = false }
tauri-build = "2" tauri-build = "2"
@@ -21,9 +20,8 @@ thiserror = "2"
url = "2" url = "2"
schemars = "0.8" schemars = "0.8"
dunce = "1" dunce = "1"
specta = "^2.0.0-rc.16" specta = "=2.0.0-rc.20"
glob = "0.3" #tauri-specta = "=2.0.0-rc.11"
zbus = "5"
[workspace.package] [workspace.package]
edition = "2021" edition = "2021"
+1 -2
View File
@@ -22,14 +22,13 @@ This repo and all plugins require a Rust version of at least **1.77.2**
| [log](plugins/log) | Configurable logging. | ✅ | ✅ | ✅ | ✅ | ✅ | | [log](plugins/log) | Configurable logging. | ✅ | ✅ | ✅ | ✅ | ✅ |
| [nfc](plugins/nfc) | Read and write NFC tags on Android and iOS. | ? | ? | ? | ✅ | ✅ | | [nfc](plugins/nfc) | Read and write NFC tags on Android and iOS. | ? | ? | ? | ✅ | ✅ |
| [notification](plugins/notification) | Send message notifications (brief auto-expiring OS window element) to your user. Can also be used with the Notification Web API. | ✅ | ✅ | ✅ | ✅ | ✅ | | [notification](plugins/notification) | Send message notifications (brief auto-expiring OS window element) to your user. Can also be used with the Notification Web API. | ✅ | ✅ | ✅ | ✅ | ✅ |
| [opener](plugins/opener) | Open files and URLs using their default application. | ✅ | ✅ | ✅ | ? | ? |
| [os](plugins/os) | Read information about the operating system. | ✅ | ✅ | ✅ | ✅ | ✅ | | [os](plugins/os) | Read information about the operating system. | ✅ | ✅ | ✅ | ✅ | ✅ |
| [persisted-scope](plugins/persisted-scope) | Persist runtime scope changes on the filesystem. | ✅ | ✅ | ✅ | ? | ? | | [persisted-scope](plugins/persisted-scope) | Persist runtime scope changes on the filesystem. | ✅ | ✅ | ✅ | ? | ? |
| [positioner](plugins/positioner) | Move windows to common locations. | ✅ | ✅ | ✅ | ❌ | ❌ | | [positioner](plugins/positioner) | Move windows to common locations. | ✅ | ✅ | ✅ | ❌ | ❌ |
| [process](plugins/process) | This plugin provides APIs to access the current process. To spawn child processes, see the [`shell`](https://github.com/tauri-apps/tauri-plugin-shell) plugin. | ✅ | ✅ | ✅ | ? | ? | | [process](plugins/process) | This plugin provides APIs to access the current process. To spawn child processes, see the [`shell`](https://github.com/tauri-apps/tauri-plugin-shell) plugin. | ✅ | ✅ | ✅ | ? | ? |
| [shell](plugins/shell) | Access the system shell. Allows you to spawn child processes and manage files and URLs using their default application. | ✅ | ✅ | ✅ | ? | ? | | [shell](plugins/shell) | Access the system shell. Allows you to spawn child processes and manage files and URLs using their default application. | ✅ | ✅ | ✅ | ? | ? |
| [single-instance](plugins/single-instance) | Ensure a single instance of your tauri app is running. | ✅ | ✅ | ✅ | ❌ | ❌ | | [single-instance](plugins/single-instance) | Ensure a single instance of your tauri app is running. | ✅ | ✅ | ✅ | ❌ | ❌ |
| [sql](plugins/sql) | Interface with SQL databases. | ✅ | ✅ | ✅ | | ✅ | | [sql](plugins/sql) | Interface with SQL databases. | ✅ | ✅ | ✅ | ? | ✅ |
| [store](plugins/store) | Persistent key value storage. | ✅ | ✅ | ✅ | ✅ | ✅ | | [store](plugins/store) | Persistent key value storage. | ✅ | ✅ | ✅ | ✅ | ✅ |
| [stronghold](plugins/stronghold) | Encrypted, secure database. | ✅ | ✅ | ✅ | ? | ? | | [stronghold](plugins/stronghold) | Encrypted, secure database. | ✅ | ✅ | ✅ | ? | ? |
| [updater](plugins/updater) | In-app updates for Tauri applications. | ✅ | ✅ | ✅ | ❌ | ❌ | | [updater](plugins/updater) | In-app updates for Tauri applications. | ✅ | ✅ | ✅ | ❌ | ❌ |
-184
View File
@@ -1,189 +1,5 @@
# Changelog # Changelog
## \[2.0.23]
### Dependencies
- Upgraded to `updater-js@2.8.0`
- Upgraded to `barcode-scanner-js@2.2.1`
- Upgraded to `biometric-js@2.2.2`
- Upgraded to `cli-js@2.2.1`
- Upgraded to `clipboard-manager-js@2.2.3`
- Upgraded to `nfc-js@2.2.1`
- Upgraded to `notification-js@2.2.3`
- Upgraded to `os-js@2.2.2`
- Upgraded to `process-js@2.2.2`
- Upgraded to `shell-js@2.2.2`
- Upgraded to `store-js@2.2.1`
- Upgraded to `log-js@2.5.0`
- Upgraded to `opener-js@2.3.0`
## \[2.0.22]
### Dependencies
- Upgraded to `fs-js@2.3.0`
- Upgraded to `global-shortcut-js@2.2.1`
- Upgraded to `http-js@2.4.4`
- Upgraded to `opener-js@2.2.7`
- Upgraded to `dialog-js@2.2.2`
## \[2.0.21]
### Dependencies
- Upgraded to `log-js@2.4.0`
- Upgraded to `biometric-js@2.2.1`
- Upgraded to `updater-js@2.7.1`
## \[2.0.20]
### Dependencies
- Upgraded to `http-js@2.4.3`
- Upgraded to `shell-js@2.2.1`
- Upgraded to `fs-js@2.2.1`
- Upgraded to `process-js@2.2.1`
- Upgraded to `updater-js@2.7.0`
- Upgraded to `dialog-js@2.2.1`
## \[2.0.19]
### Dependencies
- Upgraded to `http-js@2.4.2`
- Upgraded to `updater-js@2.6.1`
## \[2.0.18]
### Dependencies
- Upgraded to `http-js@2.4.1`
## \[2.0.17]
### Dependencies
- Upgraded to `log-js@2.3.1`
## \[2.0.16]
### Dependencies
- Upgraded to `clipboard-manager-js@2.2.2`
- Upgraded to `notification-js@2.2.2`
- Upgraded to `os-js@2.2.1`
- Upgraded to `http-js@2.4.0`
- Upgraded to `log-js@2.3.0`
- Upgraded to `updater-js@2.6.0`
## \[2.0.15]
### Dependencies
- Upgraded to `log-js@2.2.3`
- Upgraded to `opener-js@2.2.6`
## \[2.0.14]
### Dependencies
- Upgraded to `log-js@2.2.2`
- Upgraded to `updater-js@2.5.1`
## \[2.0.13]
### Dependencies
- Upgraded to `updater-js@2.5.0`
## \[2.0.12]
### Dependencies
- Upgraded to `clipboard-manager-js@2.2.1`
- Upgraded to `http-js@2.3.0`
- Upgraded to `log-js@2.2.1`
- Upgraded to `updater-js@2.4.0`
## \[2.0.11]
### Dependencies
- Upgraded to `opener-js@2.2.5`
## \[2.0.10]
### Dependencies
- Upgraded to `notification-js@2.2.1`
- Upgraded to `opener-js@2.2.4`
## \[2.0.9]
### Dependencies
- Upgraded to `opener-js@2.2.3`
- Upgraded to `updater-js@2.3.1`
## \[2.0.8]
### Dependencies
- Upgraded to `opener-js@2.2.2`
## \[2.0.7]
### Dependencies
- Upgraded to `updater-js@2.3.0`
- Upgraded to `opener-js@2.2.1`
## \[2.0.6]
### Dependencies
- Upgraded to `barcode-scanner-js@2.1.0`
- Upgraded to `biometric-js@2.1.0`
- Upgraded to `cli-js@2.1.0`
- Upgraded to `clipboard-manager-js@2.1.0`
- Upgraded to `dialog-js@2.1.0`
- Upgraded to `fs-js@2.1.0`
- Upgraded to `global-shortcut-js@2.1.0`
- Upgraded to `http-js@2.1.0`
- Upgraded to `log-js@2.1.0`
- Upgraded to `nfc-js@2.1.0`
- Upgraded to `notification-js@2.1.0`
- Upgraded to `opener-js@2.1.0`
- Upgraded to `os-js@2.1.0`
- Upgraded to `process-js@2.1.0`
- Upgraded to `shell-js@2.1.0`
- Upgraded to `store-js@2.2.0`
- Upgraded to `updater-js@2.1.0`
## \[2.0.5]
### Dependencies
- Upgraded to `fs-js@2.0.4`
- Upgraded to `dialog-js@2.0.2`
- Upgraded to `http-js@2.0.2`
## \[2.0.4]
### Dependencies
- Upgraded to `log-js@2.0.2`
## \[2.0.3]
### Dependencies
- Upgraded to `clipboard-manager-js@2.0.1`
- Upgraded to `log-js@2.0.1`
- Upgraded to `fs-js@2.0.3`
- Upgraded to `opener-js@2.0.0`
## \[2.0.2] ## \[2.0.2]
### Dependencies ### Dependencies
+27 -28
View File
@@ -1,7 +1,7 @@
{ {
"name": "api", "name": "api",
"private": true, "private": true,
"version": "2.0.23", "version": "2.0.2",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite --clearScreen false", "dev": "vite --clearScreen false",
@@ -10,35 +10,34 @@
"tauri": "tauri" "tauri": "tauri"
}, },
"dependencies": { "dependencies": {
"@tauri-apps/api": "2.5.0", "@tauri-apps/api": "2.1.1",
"@tauri-apps/plugin-barcode-scanner": "^2.2.1", "@tauri-apps/plugin-barcode-scanner": "2.0.0",
"@tauri-apps/plugin-biometric": "^2.2.2", "@tauri-apps/plugin-biometric": "2.0.0",
"@tauri-apps/plugin-cli": "^2.2.1", "@tauri-apps/plugin-cli": "2.0.0",
"@tauri-apps/plugin-clipboard-manager": "^2.2.3", "@tauri-apps/plugin-clipboard-manager": "2.0.0",
"@tauri-apps/plugin-dialog": "^2.2.2", "@tauri-apps/plugin-dialog": "2.0.1",
"@tauri-apps/plugin-fs": "^2.3.0", "@tauri-apps/plugin-fs": "2.0.2",
"@tauri-apps/plugin-geolocation": "^2.2.0", "@tauri-apps/plugin-geolocation": "2.0.0",
"@tauri-apps/plugin-global-shortcut": "^2.2.1", "@tauri-apps/plugin-global-shortcut": "2.0.0",
"@tauri-apps/plugin-haptics": "^2.2.0", "@tauri-apps/plugin-haptics": "2.0.0",
"@tauri-apps/plugin-http": "^2.4.4", "@tauri-apps/plugin-http": "2.0.1",
"@tauri-apps/plugin-nfc": "^2.2.1", "@tauri-apps/plugin-nfc": "2.0.0",
"@tauri-apps/plugin-notification": "^2.2.3", "@tauri-apps/plugin-notification": "2.0.0",
"@tauri-apps/plugin-opener": "^2.3.0", "@tauri-apps/plugin-os": "2.0.0",
"@tauri-apps/plugin-os": "^2.2.2", "@tauri-apps/plugin-process": "2.0.0",
"@tauri-apps/plugin-process": "^2.2.2", "@tauri-apps/plugin-shell": "2.0.1",
"@tauri-apps/plugin-shell": "^2.2.2", "@tauri-apps/plugin-store": "2.1.0",
"@tauri-apps/plugin-store": "^2.2.1", "@tauri-apps/plugin-updater": "2.0.0",
"@tauri-apps/plugin-updater": "^2.8.0",
"@zerodevx/svelte-json-view": "1.0.11" "@zerodevx/svelte-json-view": "1.0.11"
}, },
"devDependencies": { "devDependencies": {
"@iconify-json/codicon": "^1.2.12", "@iconify-json/codicon": "^1.1.37",
"@iconify-json/ph": "^1.2.2", "@iconify-json/ph": "^1.1.8",
"@sveltejs/vite-plugin-svelte": "^5.0.3", "@sveltejs/vite-plugin-svelte": "^4.0.0",
"@tauri-apps/cli": "2.5.0", "@tauri-apps/cli": "2.1.0",
"@unocss/extractor-svelte": "^66.0.0", "@unocss/extractor-svelte": "^0.64.0",
"svelte": "^5.20.4", "svelte": "^5.0.0",
"unocss": "^66.0.0", "unocss": "^0.64.0",
"vite": "^6.2.6" "vite": "^5.4.7"
} }
} }
-203
View File
@@ -1,208 +1,5 @@
# Changelog # Changelog
## \[2.0.27]
### Dependencies
- Upgraded to `updater@2.8.0`
- Upgraded to `barcode-scanner@2.2.1`
- Upgraded to `biometric@2.2.2`
- Upgraded to `cli@2.2.1`
- Upgraded to `clipboard-manager@2.2.3`
- Upgraded to `geolocation@2.2.5`
- Upgraded to `haptics@2.2.5`
- Upgraded to `nfc@2.2.1`
- Upgraded to `notification@2.2.3`
- Upgraded to `os@2.2.2`
- Upgraded to `process@2.2.2`
- Upgraded to `shell@2.2.2`
- Upgraded to `store@2.2.1`
- Upgraded to `log@2.5.0`
- Upgraded to `opener@2.3.0`
## \[2.0.26]
### Dependencies
- Upgraded to `fs@2.3.0`
- Upgraded to `global-shortcut@2.2.1`
- Upgraded to `http@2.4.4`
- Upgraded to `opener@2.2.7`
- Upgraded to `dialog@2.2.2`
## \[2.0.25]
### Dependencies
- Upgraded to `log@2.4.0`
- Upgraded to `biometric@2.2.1`
- Upgraded to `updater@2.7.1`
## \[2.0.24]
### Dependencies
- Upgraded to `http@2.4.3`
- Upgraded to `shell@2.2.1`
- Upgraded to `fs@2.2.1`
- Upgraded to `process@2.2.1`
- Upgraded to `updater@2.7.0`
- Upgraded to `dialog@2.2.1`
## \[2.0.23]
### Dependencies
- Upgraded to `http@2.4.2`
- Upgraded to `updater@2.6.1`
## \[2.0.22]
### Dependencies
- Upgraded to `http@2.4.1`
## \[2.0.21]
### Dependencies
- Upgraded to `log@2.3.1`
## \[2.0.20]
### Dependencies
- Upgraded to `clipboard-manager@2.2.2`
- Upgraded to `geolocation@2.2.4`
- Upgraded to `haptics@2.2.4`
- Upgraded to `notification@2.2.2`
- Upgraded to `os@2.2.1`
- Upgraded to `http@2.4.0`
- Upgraded to `log@2.3.0`
- Upgraded to `updater@2.6.0`
## \[2.0.19]
### Dependencies
- Upgraded to `log@2.2.3`
- Upgraded to `opener@2.2.6`
## \[2.0.18]
### Dependencies
- Upgraded to `log@2.2.2`
- Upgraded to `updater@2.5.1`
## \[2.0.17]
### Dependencies
- Upgraded to `updater@2.5.0`
## \[2.0.16]
### Dependencies
- Upgraded to `clipboard-manager@2.2.1`
- Upgraded to `http@2.3.0`
- Upgraded to `log@2.2.1`
- Upgraded to `updater@2.4.0`
## \[2.0.15]
### Dependencies
- Upgraded to `haptics@2.2.3`
- Upgraded to `geolocation@2.2.3`
- Upgraded to `opener@2.2.5`
## \[2.0.14]
### Dependencies
- Upgraded to `geolocation@2.2.2`
- Upgraded to `haptics@2.2.2`
- Upgraded to `notification@2.2.1`
- Upgraded to `opener@2.2.4`
## \[2.0.13]
### Dependencies
- Upgraded to `geolocation@2.2.1`
- Upgraded to `haptics@2.2.1`
## \[2.0.12]
### Dependencies
- Upgraded to `opener@2.2.3`
- Upgraded to `updater@2.3.1`
## \[2.0.11]
### Dependencies
- Upgraded to `opener@2.2.2`
## \[2.0.10]
### Dependencies
- Upgraded to `updater@2.3.0`
- Upgraded to `opener@2.2.1`
## \[2.0.9]
### Dependencies
- Upgraded to `barcode-scanner@2.1.0`
- Upgraded to `biometric@2.1.0`
- Upgraded to `cli@2.1.0`
- Upgraded to `clipboard-manager@2.1.0`
- Upgraded to `dialog@2.1.0`
- Upgraded to `fs@2.2.0`
- Upgraded to `geolocation@2.1.0`
- Upgraded to `global-shortcut@2.1.0`
- Upgraded to `haptics@2.1.0`
- Upgraded to `http@2.1.0`
- Upgraded to `log@2.1.0`
- Upgraded to `nfc@2.1.0`
- Upgraded to `notification@2.1.0`
- Upgraded to `opener@2.1.0`
- Upgraded to `os@2.1.0`
- Upgraded to `process@2.1.0`
- Upgraded to `shell@2.1.0`
- Upgraded to `store@2.2.0`
- Upgraded to `updater@2.2.0`
## \[2.0.8]
### Dependencies
- Upgraded to `fs@2.1.1`
- Upgraded to `dialog@2.0.5`
- Upgraded to `http@2.0.5`
## \[2.0.7]
### Dependencies
- Upgraded to `log@2.0.4`
## \[2.0.6]
### Dependencies
- Upgraded to `fs@2.1.0`
- Upgraded to `updater@2.1.0`
- Upgraded to `dialog@2.0.4`
- Upgraded to `log-plugin@2.0.3`
- Upgraded to `http@2.0.4`
- Upgraded to `opener@2.0.0`
## \[2.0.5] ## \[2.0.5]
### Dependencies ### Dependencies
+20 -23
View File
@@ -1,7 +1,7 @@
[package] [package]
name = "api" name = "api"
publish = false publish = false
version = "2.0.27" version = "2.0.5"
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 }
@@ -18,26 +18,23 @@ tauri-build = { workspace = true, features = ["codegen", "isolation"] }
serde_json = { workspace = true } serde_json = { workspace = true }
serde = { workspace = true } serde = { workspace = true }
tiny_http = "0.12" tiny_http = "0.12"
time = "0.3"
log = { workspace = true } log = { workspace = true }
tauri-plugin-log = { path = "../../../plugins/log", version = "2.5.0" } tauri-plugin-log = { path = "../../../plugins/log", version = "2.0.2" }
tauri-plugin-fs = { path = "../../../plugins/fs", version = "2.3.0", features = [ tauri-plugin-fs = { path = "../../../plugins/fs", version = "2.0.3", features = [
"watch", "watch",
] } ] }
tauri-plugin-clipboard-manager = { path = "../../../plugins/clipboard-manager", version = "2.2.3" } tauri-plugin-clipboard-manager = { path = "../../../plugins/clipboard-manager", version = "2.0.2" }
tauri-plugin-dialog = { path = "../../../plugins/dialog", version = "2.2.2" } tauri-plugin-dialog = { path = "../../../plugins/dialog", version = "2.0.3" }
tauri-plugin-http = { path = "../../../plugins/http", features = [ tauri-plugin-http = { path = "../../../plugins/http", features = [
"multipart", "multipart",
"cookies", ], version = "2.0.3" }
], version = "2.4.4" } tauri-plugin-notification = { path = "../../../plugins/notification", version = "2.0.1", features = [
tauri-plugin-notification = { path = "../../../plugins/notification", version = "2.2.3", features = [
"windows7-compat", "windows7-compat",
] } ] }
tauri-plugin-os = { path = "../../../plugins/os", version = "2.2.2" } tauri-plugin-os = { path = "../../../plugins/os", version = "2.0.1" }
tauri-plugin-process = { path = "../../../plugins/process", version = "2.2.2" } tauri-plugin-process = { path = "../../../plugins/process", version = "2.0.1" }
tauri-plugin-opener = { path = "../../../plugins/opener", version = "2.3.0" } tauri-plugin-shell = { path = "../../../plugins/shell", version = "2.0.2" }
tauri-plugin-shell = { path = "../../../plugins/shell", version = "2.2.2" } tauri-plugin-store = { path = "../../../plugins/store", version = "2.1.0" }
tauri-plugin-store = { path = "../../../plugins/store", version = "2.2.1" }
[dependencies.tauri] [dependencies.tauri]
workspace = true workspace = true
@@ -53,17 +50,17 @@ features = [
] ]
[target."cfg(any(target_os = \"macos\", windows, target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies] [target."cfg(any(target_os = \"macos\", windows, target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies]
tauri-plugin-cli = { path = "../../../plugins/cli", version = "2.2.1" } tauri-plugin-cli = { path = "../../../plugins/cli", version = "2.0.1" }
tauri-plugin-global-shortcut = { path = "../../../plugins/global-shortcut", version = "2.2.1" } tauri-plugin-global-shortcut = { path = "../../../plugins/global-shortcut", version = "2.0.1" }
tauri-plugin-updater = { path = "../../../plugins/updater", version = "2.8.0" } tauri-plugin-updater = { path = "../../../plugins/updater", version = "2.0.2" }
tauri-plugin-window-state = { path = "../../../plugins/window-state", version = "2.2.0" } tauri-plugin-window-state = { path = "../../../plugins/window-state", version = "2.0.0" }
[target."cfg(any(target_os = \"android\", target_os = \"ios\"))".dependencies] [target."cfg(any(target_os = \"android\", target_os = \"ios\"))".dependencies]
tauri-plugin-barcode-scanner = { path = "../../../plugins/barcode-scanner/", version = "2.2.1" } tauri-plugin-barcode-scanner = { path = "../../../plugins/barcode-scanner/", version = "2.0.1" }
tauri-plugin-nfc = { path = "../../../plugins/nfc", version = "2.2.1" } tauri-plugin-nfc = { path = "../../../plugins/nfc", version = "2.0.1" }
tauri-plugin-biometric = { path = "../../../plugins/biometric/", version = "2.2.2" } tauri-plugin-biometric = { path = "../../../plugins/biometric/", version = "2.0.1" }
tauri-plugin-geolocation = { path = "../../../plugins/geolocation/", version = "2.2.5" } tauri-plugin-geolocation = { path = "../../../plugins/geolocation/", version = "2.0.1" }
tauri-plugin-haptics = { path = "../../../plugins/haptics/", version = "2.2.5" } tauri-plugin-haptics = { path = "../../../plugins/haptics/", version = "2.0.1" }
[features] [features]
prod = ["tauri/custom-protocol"] prod = ["tauri/custom-protocol"]
@@ -53,7 +53,7 @@
} }
] ]
}, },
"shell:default", "shell:allow-open",
"shell:allow-kill", "shell:allow-kill",
"shell:allow-stdin-write", "shell:allow-stdin-write",
"process:allow-exit", "process:allow-exit",
@@ -69,7 +69,6 @@
"fs:allow-mkdir", "fs:allow-mkdir",
"fs:allow-remove", "fs:allow-remove",
"fs:allow-write-text-file", "fs:allow-write-text-file",
"fs:read-meta",
"fs:scope-download-recursive", "fs:scope-download-recursive",
"fs:scope-resource-recursive", "fs:scope-resource-recursive",
{ {
@@ -81,11 +80,6 @@
], ],
"deny": ["$APPDATA/db/*.stronghold"] "deny": ["$APPDATA/db/*.stronghold"]
}, },
"store:default", "store:default"
"opener:default",
{
"identifier": "opener:allow-open-path",
"allow": [{ "path": "$APPDATA" }, { "path": "$APPDATA/**" }]
}
] ]
} }
+1 -21
View File
@@ -36,7 +36,6 @@ pub fn run() {
.plugin(tauri_plugin_notification::init()) .plugin(tauri_plugin_notification::init())
.plugin(tauri_plugin_os::init()) .plugin(tauri_plugin_os::init())
.plugin(tauri_plugin_process::init()) .plugin(tauri_plugin_process::init())
.plugin(tauri_plugin_opener::init())
.plugin(tauri_plugin_shell::init()) .plugin(tauri_plugin_shell::init())
.plugin(tauri_plugin_store::Builder::default().build()) .plugin(tauri_plugin_store::Builder::default().build())
.setup(move |app| { .setup(move |app| {
@@ -102,28 +101,9 @@ pub fn run() {
if let Ok(mut request) = server.recv() { if let Ok(mut request) = server.recv() {
let mut body = Vec::new(); let mut body = Vec::new();
let _ = request.as_reader().read_to_end(&mut body); let _ = request.as_reader().read_to_end(&mut body);
let mut headers = request.headers().to_vec();
if !headers.iter().any(|header| header.field == tiny_http::HeaderField::from_bytes(b"Cookie").unwrap()) {
let expires = time::OffsetDateTime::now_utc() + time::Duration::days(1);
// RFC 1123 format
let format = time::macros::format_description!(
"[weekday repr:short], [day] [month repr:short] [year] [hour]:[minute]:[second] GMT"
);
let expires_str = expires.format(format).unwrap();
headers.push(
tiny_http::Header::from_bytes(
&b"Set-Cookie"[..],
format!("session-token=test-value; Secure; Path=/; Expires={expires_str}")
.as_bytes(),
)
.unwrap(),
);
}
let response = tiny_http::Response::new( let response = tiny_http::Response::new(
tiny_http::StatusCode(200), tiny_http::StatusCode(200),
headers, request.headers().to_vec(),
std::io::Cursor::new(body), std::io::Cursor::new(body),
request.body_length(), request.body_length(),
None, None,
+1 -1
View File
@@ -45,7 +45,7 @@ pub fn create_tray<R: Runtime>(app: &tauri::AppHandle<R>) -> tauri::Result<()> {
.tooltip("Tauri") .tooltip("Tauri")
.icon(app.default_window_icon().unwrap().clone()) .icon(app.default_window_icon().unwrap().clone())
.menu(&menu1) .menu(&menu1)
.show_menu_on_left_click(false) .menu_on_left_click(false)
.on_menu_event(move |app, event| match event.id.as_ref() { .on_menu_event(move |app, event| match event.id.as_ref() {
"quit" => { "quit" => {
app.exit(0); app.exit(0);
+1 -6
View File
@@ -1,5 +1,6 @@
<script> <script>
import { writable } from 'svelte/store' import { writable } from 'svelte/store'
import { open } from '@tauri-apps/plugin-shell'
import { getCurrentWindow } from '@tauri-apps/api/window' import { getCurrentWindow } from '@tauri-apps/api/window'
import { getCurrentWebview } from '@tauri-apps/api/webview' import { getCurrentWebview } from '@tauri-apps/api/webview'
import * as os from '@tauri-apps/plugin-os' import * as os from '@tauri-apps/plugin-os'
@@ -13,7 +14,6 @@
import Notifications from './views/Notifications.svelte' import Notifications from './views/Notifications.svelte'
import Shortcuts from './views/Shortcuts.svelte' import Shortcuts from './views/Shortcuts.svelte'
import Shell from './views/Shell.svelte' import Shell from './views/Shell.svelte'
import Opener from './views/Opener.svelte'
import Store from './views/Store.svelte' import Store from './views/Store.svelte'
import Updater from './views/Updater.svelte' import Updater from './views/Updater.svelte'
import Clipboard from './views/Clipboard.svelte' import Clipboard from './views/Clipboard.svelte'
@@ -92,11 +92,6 @@
component: Shell, component: Shell,
icon: 'i-codicon-terminal-bash' icon: 'i-codicon-terminal-bash'
}, },
{
label: 'Opener',
component: Opener,
icon: 'i-codicon-link-external'
},
{ {
label: 'Store', label: 'Store',
component: Store, component: Store,
+2 -13
View File
@@ -2,18 +2,16 @@
import * as fs from "@tauri-apps/plugin-fs"; import * as fs from "@tauri-apps/plugin-fs";
import { convertFileSrc } from "@tauri-apps/api/core"; import { convertFileSrc } from "@tauri-apps/api/core";
import { arrayBufferToBase64 } from "../lib/utils"; import { arrayBufferToBase64 } from "../lib/utils";
import { onDestroy } from "svelte";
export let onMessage; export let onMessage;
export let insecureRenderHtml; export let insecureRenderHtml;
let path = ""; let path = "";
let img; let img;
/** @type {fs.FileHandle} */
let file; let file;
let renameTo; let renameTo;
let watchPath = ""; let watchPath = "";
let watchDebounceDelay = "0"; let watchDebounceDelay = 0;
let watchRecursive = false; let watchRecursive = false;
let unwatchFn; let unwatchFn;
let unwatchPath = ""; let unwatchPath = "";
@@ -120,7 +118,7 @@
.getElementById("file-save") .getElementById("file-save")
.addEventListener("click", function () { .addEventListener("click", function () {
fs.writeTextFile(path, fileInput.value, { fs.writeTextFile(path, fileInput.value, {
baseDir: getDir(), dir: getDir(),
}).catch(onMessage); }).catch(onMessage);
}); });
}); });
@@ -172,15 +170,6 @@
unwatchFn = undefined; unwatchFn = undefined;
unwatchPath = undefined; unwatchPath = undefined;
} }
onDestroy(() => {
if (file) {
file.close();
}
if (unwatchFn) {
unwatchFn();
}
})
</script> </script>
<div class="flex flex-col"> <div class="flex flex-col">
-66
View File
@@ -1,66 +0,0 @@
<script>
import * as opener from '@tauri-apps/plugin-opener'
export let onMessage
let url = ''
let urlProgram = ''
function openUrl() {
opener.openUrl(url, urlProgram ? urlProgram : undefined).catch(onMessage)
}
let path = ''
let pathProgram = ''
function openPath() {
opener
.openPath(path, pathProgram ? pathProgram : undefined)
.catch(onMessage)
}
let revealPath = ''
function revealItemInDir() {
opener.revealItemInDir(revealPath).catch(onMessage)
}
</script>
<div class="flex flex-col gap-2">
<form
class="flex flex-row gap-2 items-center"
on:submit|preventDefault={openUrl}
>
<button class="btn" type="submit">Open URL</button>
<input
class="input grow"
placeholder="Type the URL to open..."
bind:value={url}
/>
<span> with </span>
<input class="input" bind:value={urlProgram} />
</form>
<form
class="flex flex-row gap-2 items-center"
on:submit|preventDefault={openPath}
>
<button class="btn" type="submit">Open Path</button>
<input
class="input grow"
placeholder="Type the path to open..."
bind:value={path}
/>
<span> with </span>
<input class="input" bind:value={pathProgram} />
</form>
<form
class="flex flex-row gap-2 items-center"
on:submit|preventDefault={revealItemInDir}
>
<button class="btn" type="submit">Reveal</button>
<input
class="input grow"
placeholder="Type the path to reveal..."
bind:value={revealPath}
/>
</form>
</div>
+3 -7
View File
@@ -12,14 +12,10 @@
isChecking = true isChecking = true
try { try {
const update = await check() const update = await check()
if (update) { onMessage(`Should update: ${update.available}`)
onMessage(`Should update: ${update.available}`) onMessage(update)
onMessage(update)
newUpdate = update newUpdate = update
} else {
onMessage('No update available')
}
} catch (e) { } catch (e) {
onMessage(e) onMessage(e)
} finally { } finally {
+15 -18
View File
@@ -11,29 +11,26 @@
"example:api:dev": "pnpm run --filter \"api\" tauri dev" "example:api:dev": "pnpm run --filter \"api\" tauri dev"
}, },
"devDependencies": { "devDependencies": {
"@eslint/js": "9.29.0", "@eslint/js": "9.14.0",
"@rollup/plugin-node-resolve": "16.0.1", "@rollup/plugin-node-resolve": "15.3.0",
"@rollup/plugin-terser": "0.4.4", "@rollup/plugin-terser": "0.4.4",
"@rollup/plugin-typescript": "12.1.2", "@rollup/plugin-typescript": "11.1.6",
"covector": "^0.12.4", "@types/eslint__js": "8.42.3",
"eslint": "9.29.0", "covector": "^0.12.3",
"eslint-config-prettier": "10.1.5", "eslint": "9.14.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-security": "3.0.1", "eslint-plugin-security": "3.0.1",
"prettier": "3.5.3", "prettier": "3.3.3",
"rollup": "4.43.0", "rollup": "4.27.0",
"tslib": "2.8.1", "tslib": "2.8.1",
"typescript": "5.8.3", "typescript": "5.6.3",
"typescript-eslint": "8.34.0" "typescript-eslint": "8.14.0"
}, },
"pnpm": { "resolutions": {
"overrides": { "semver": ">=7.5.2",
"esbuild@<0.25.0": ">=0.25.0" "optionator": ">=0.9.3"
},
"onlyBuiltDependencies": [
"esbuild"
]
}, },
"engines": { "engines": {
"pnpm": "^10.0.0" "pnpm": "^9.0.0"
} }
} }
+8 -12
View File
@@ -1,17 +1,5 @@
# Changelog # Changelog
## \[2.4.0]
- [`764e8f77`](https://github.com/tauri-apps/plugins-workspace/commit/764e8f7719247da515243d9c9cafa6d087d21769) ([#2707](https://github.com/tauri-apps/plugins-workspace/pull/2707)) Added a new builder method app_name() to allow customizing the application name in the autostart entry.
## \[2.3.0]
- [`8ecb418a`](https://github.com/tauri-apps/plugins-workspace/commit/8ecb418a1a35d7f234dc5d833746ac2d8e062aec) ([#2569](https://github.com/tauri-apps/plugins-workspace/pull/2569)) Add a `Builder` for more flexible settings
## \[2.2.0]
- [`3a79266b`](https://github.com/tauri-apps/plugins-workspace/commit/3a79266b8cf96a55b1ae6339d725567d45a44b1d) ([#2173](https://github.com/tauri-apps/plugins-workspace/pull/2173) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Bumped all plugins to `v2.2.0`. From now, the versions for the Rust and JavaScript packages of each plugin will be in sync with each other.
## \[2.0.1] ## \[2.0.1]
- [`a1a82208`](https://github.com/tauri-apps/plugins-workspace/commit/a1a82208ed4ab87f83310be0dc95428aec9ab241) ([#1873](https://github.com/tauri-apps/plugins-workspace/pull/1873) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Downgrade MSRV to 1.77.2 to support Windows 7. - [`a1a82208`](https://github.com/tauri-apps/plugins-workspace/commit/a1a82208ed4ab87f83310be0dc95428aec9ab241) ([#1873](https://github.com/tauri-apps/plugins-workspace/pull/1873) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Downgrade MSRV to 1.77.2 to support Windows 7.
@@ -100,3 +88,11 @@
## \[2.0.0-alpha.0] ## \[2.0.0-alpha.0]
- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
te to alpha.11.
## \[2.0.0-alpha.0]
- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
ae67\`]\(https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
+2 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "tauri-plugin-autostart" name = "tauri-plugin-autostart"
version = "2.4.0" version = "2.0.1"
description = "Automatically launch your application at startup." description = "Automatically launch your application at startup."
authors = { workspace = true } authors = { workspace = true }
license = { workspace = true } license = { workspace = true }
@@ -27,5 +27,6 @@ tauri-plugin = { workspace = true, features = ["build"] }
serde = { workspace = true } serde = { workspace = true }
serde_json = { workspace = true } serde_json = { workspace = true }
tauri = { workspace = true } tauri = { workspace = true }
log = { workspace = true }
thiserror = { workspace = true } thiserror = { workspace = true }
auto-launch = "0.5" auto-launch = "0.5"
+4 -5
View File
@@ -54,15 +54,14 @@ yarn add https://github.com/tauri-apps/tauri-plugin-autostart#v2
First you need to register the core plugin with Tauri: First you need to register the core plugin with Tauri:
`src-tauri/src/lib.rs` `src-tauri/src/main.rs`
```rust ```rust
use tauri_plugin_autostart::MacosLauncher;
fn main() { fn main() {
tauri::Builder::default() tauri::Builder::default()
.plugin(tauri_plugin_autostart::Builder::new() .plugin(tauri_plugin_autostart::init(MacosLauncher::LaunchAgent, Some(vec!["--flag1", "--flag2"]) /* arbitrary number of args to pass to your app */))
.args(["--flag1", "--flag2"])
.app_name("My Custom Name")
.build())
.run(tauri::generate_context!()) .run(tauri::generate_context!())
.expect("error while running tauri application"); .expect("error while running tauri application");
} }
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@tauri-apps/plugin-autostart", "name": "@tauri-apps/plugin-autostart",
"version": "2.4.0", "version": "2.0.0",
"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"
@@ -11,8 +11,6 @@ disable the automatic start on boot.
#### This default permission set includes the following:
- `allow-enable` - `allow-enable`
- `allow-disable` - `allow-disable`
- `allow-is-enabled` - `allow-is-enabled`
@@ -49,7 +49,7 @@
"minimum": 1.0 "minimum": 1.0
}, },
"description": { "description": {
"description": "Human-readable description of what the permission does. Tauri convention is to use `<h4>` headings in markdown content for Tauri documentation generation purposes.", "description": "Human-readable description of what the permission does. Tauri convention is to use <h4> headings in markdown content for Tauri documentation generation purposes.",
"type": [ "type": [
"string", "string",
"null" "null"
@@ -111,7 +111,7 @@
"type": "string" "type": "string"
}, },
"description": { "description": {
"description": "Human-readable description of what the permission does. Tauri internal convention is to use `<h4>` headings in markdown content for Tauri documentation generation purposes.", "description": "Human-readable description of what the permission does. Tauri internal convention is to use <h4> headings in markdown content for Tauri documentation generation purposes.",
"type": [ "type": [
"string", "string",
"null" "null"
@@ -297,44 +297,37 @@
{ {
"description": "Enables the disable command without any pre-configured scope.", "description": "Enables the disable command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "allow-disable", "const": "allow-disable"
"markdownDescription": "Enables the disable command without any pre-configured scope."
}, },
{ {
"description": "Denies the disable command without any pre-configured scope.", "description": "Denies the disable command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "deny-disable", "const": "deny-disable"
"markdownDescription": "Denies the disable command without any pre-configured scope."
}, },
{ {
"description": "Enables the enable command without any pre-configured scope.", "description": "Enables the enable command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "allow-enable", "const": "allow-enable"
"markdownDescription": "Enables the enable command without any pre-configured scope."
}, },
{ {
"description": "Denies the enable command without any pre-configured scope.", "description": "Denies the enable command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "deny-enable", "const": "deny-enable"
"markdownDescription": "Denies the enable command without any pre-configured scope."
}, },
{ {
"description": "Enables the is_enabled command without any pre-configured scope.", "description": "Enables the is_enabled command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "allow-is-enabled", "const": "allow-is-enabled"
"markdownDescription": "Enables the is_enabled command without any pre-configured scope."
}, },
{ {
"description": "Denies the is_enabled command without any pre-configured scope.", "description": "Denies the is_enabled command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "deny-is-enabled", "const": "deny-is-enabled"
"markdownDescription": "Denies the is_enabled command without any pre-configured scope."
}, },
{ {
"description": "This permission set configures if your\napplication can enable or disable auto\nstarting the application on boot.\n\n#### Granted Permissions\n\nIt allows all to check, enable and\ndisable the automatic start on boot.\n\n\n#### This default permission set includes:\n\n- `allow-enable`\n- `allow-disable`\n- `allow-is-enabled`", "description": "This permission set configures if your\napplication can enable or disable auto\nstarting the application on boot.\n\n#### Granted Permissions\n\nIt allows all to check, enable and\ndisable the automatic start on boot.\n\n",
"type": "string", "type": "string",
"const": "default", "const": "default"
"markdownDescription": "This permission set configures if your\napplication can enable or disable auto\nstarting the application on boot.\n\n#### Granted Permissions\n\nIt allows all to check, enable and\ndisable the automatic start on boot.\n\n\n#### This default permission set includes:\n\n- `allow-enable`\n- `allow-disable`\n- `allow-is-enabled`"
} }
] ]
} }
+54 -148
View File
@@ -11,10 +11,12 @@
#![cfg(not(any(target_os = "android", target_os = "ios")))] #![cfg(not(any(target_os = "android", target_os = "ios")))]
use auto_launch::{AutoLaunch, AutoLaunchBuilder}; use auto_launch::{AutoLaunch, AutoLaunchBuilder};
#[cfg(target_os = "macos")]
use log::info;
use serde::{ser::Serializer, Serialize}; use serde::{ser::Serializer, Serialize};
use tauri::{ use tauri::{
command, command,
plugin::{Builder as PluginBuilder, TauriPlugin}, plugin::{Builder, TauriPlugin},
Manager, Runtime, State, Manager, Runtime, State,
}; };
@@ -22,9 +24,8 @@ use std::env::current_exe;
type Result<T> = std::result::Result<T, Error>; type Result<T> = std::result::Result<T, Error>;
#[derive(Debug, Default, Copy, Clone)] #[derive(Debug, Copy, Clone)]
pub enum MacosLauncher { pub enum MacosLauncher {
#[default]
LaunchAgent, LaunchAgent,
AppleScript, AppleScript,
} }
@@ -72,12 +73,10 @@ impl AutoLaunchManager {
} }
pub trait ManagerExt<R: Runtime> { pub trait ManagerExt<R: Runtime> {
/// TODO: Rename these to `autostart` or `auto_start` in v3
fn autolaunch(&self) -> State<'_, AutoLaunchManager>; fn autolaunch(&self) -> State<'_, AutoLaunchManager>;
} }
impl<R: Runtime, T: Manager<R>> ManagerExt<R> for T { impl<R: Runtime, T: Manager<R>> ManagerExt<R> for T {
/// TODO: Rename these to `autostart` or `auto_start` in v3
fn autolaunch(&self) -> State<'_, AutoLaunchManager> { fn autolaunch(&self) -> State<'_, AutoLaunchManager> {
self.state::<AutoLaunchManager>() self.state::<AutoLaunchManager>()
} }
@@ -98,153 +97,60 @@ async fn is_enabled(manager: State<'_, AutoLaunchManager>) -> Result<bool> {
manager.is_enabled() manager.is_enabled()
} }
#[derive(Default)]
pub struct Builder {
#[cfg(target_os = "macos")]
macos_launcher: MacosLauncher,
args: Vec<String>,
app_name: Option<String>,
}
impl Builder {
/// Create a new auto start builder with default settings
pub fn new() -> Self {
Self::default()
}
/// Adds an argument to pass to your app on startup.
///
/// ## Examples
///
/// ```no_run
/// Builder::new()
/// .arg("--from-autostart")
/// .arg("--hey")
/// .build();
/// ```
pub fn arg<S: Into<String>>(mut self, arg: S) -> Self {
self.args.push(arg.into());
self
}
/// Adds multiple arguments to pass to your app on startup.
///
/// ## Examples
///
/// ```no_run
/// Builder::new()
/// .args(["--from-autostart", "--hey"])
/// .build();
/// ```
pub fn args<I, S>(mut self, args: I) -> Self
where
I: IntoIterator<Item = S>,
S: Into<String>,
{
for arg in args {
self = self.arg(arg);
}
self
}
/// Sets whether to use launch agent or apple script to be used to enable auto start,
/// the builder's default is [`MacosLauncher::LaunchAgent`]
#[cfg(target_os = "macos")]
pub fn macos_launcher(mut self, macos_launcher: MacosLauncher) -> Self {
self.macos_launcher = macos_launcher;
self
}
/// Sets the app name to be used for the auto start entry.
///
/// ## Examples
///
/// ```no_run
/// Builder::new()
/// .app_name("My Custom Name"))
/// .build();
/// ```
pub fn app_name<S: Into<String>>(mut self, app_name: S) -> Self {
self.app_name = Some(app_name.into());
self
}
pub fn build<R: Runtime>(self) -> TauriPlugin<R> {
PluginBuilder::new("autostart")
.invoke_handler(tauri::generate_handler![enable, disable, is_enabled])
.setup(move |app, _api| {
let mut builder = AutoLaunchBuilder::new();
let app_name = self
.app_name
.as_ref()
.unwrap_or_else(|| &app.package_info().name);
builder.set_app_name(app_name);
builder.set_args(&self.args);
let current_exe = current_exe()?;
#[cfg(windows)]
builder.set_app_path(&current_exe.display().to_string());
#[cfg(target_os = "macos")]
{
builder.set_use_launch_agent(matches!(
self.macos_launcher,
MacosLauncher::LaunchAgent
));
// on macOS, current_exe gives path to /Applications/Example.app/MacOS/Example
// but this results in seeing a Unix Executable in macOS login items
// It must be: /Applications/Example.app
// If it didn't find exactly a single occurance of .app, it will default to
// exe path to not break it.
let exe_path = current_exe.canonicalize()?.display().to_string();
let parts: Vec<&str> = exe_path.split(".app/").collect();
let app_path = if parts.len() == 2
&& matches!(self.macos_launcher, MacosLauncher::AppleScript)
{
format!("{}.app", parts.first().unwrap())
} else {
exe_path
};
builder.set_app_path(&app_path);
}
#[cfg(target_os = "linux")]
if let Some(appimage) = app
.env()
.appimage
.and_then(|p| p.to_str().map(|s| s.to_string()))
{
builder.set_app_path(&appimage);
} else {
builder.set_app_path(&current_exe.display().to_string());
}
app.manage(AutoLaunchManager(
builder.build().map_err(|e| e.to_string())?,
));
Ok(())
})
.build()
}
}
/// Initializes the plugin. /// Initializes the plugin.
/// ///
/// `args` - are passed to your app on startup. /// `args` - are passed to your app on startup.
pub fn init<R: Runtime>( pub fn init<R: Runtime>(
#[allow(unused)] macos_launcher: MacosLauncher, macos_launcher: MacosLauncher,
args: Option<Vec<&'static str>>, args: Option<Vec<&'static str>>,
) -> TauriPlugin<R> { ) -> TauriPlugin<R> {
let mut builder = Builder::new(); Builder::new("autostart")
if let Some(args) = args { .invoke_handler(tauri::generate_handler![enable, disable, is_enabled])
builder = builder.args(args) .setup(move |app, _api| {
} let mut builder = AutoLaunchBuilder::new();
#[cfg(target_os = "macos")] builder.set_app_name(&app.package_info().name);
{ if let Some(args) = args {
builder = builder.macos_launcher(macos_launcher); builder.set_args(&args);
} }
builder.build() builder.set_use_launch_agent(matches!(macos_launcher, MacosLauncher::LaunchAgent));
let current_exe = current_exe()?;
#[cfg(windows)]
builder.set_app_path(&current_exe.display().to_string());
#[cfg(target_os = "macos")]
{
// on macOS, current_exe gives path to /Applications/Example.app/MacOS/Example
// but this results in seeing a Unix Executable in macOS login items
// It must be: /Applications/Example.app
// If it didn't find exactly a single occurance of .app, it will default to
// exe path to not break it.
let exe_path = current_exe.canonicalize()?.display().to_string();
let parts: Vec<&str> = exe_path.split(".app/").collect();
let app_path =
if parts.len() == 2 && matches!(macos_launcher, MacosLauncher::AppleScript) {
format!("{}.app", parts.first().unwrap())
} else {
exe_path
};
info!("auto_start path {}", &app_path);
builder.set_app_path(&app_path);
}
#[cfg(target_os = "linux")]
if let Some(appimage) = app
.env()
.appimage
.and_then(|p| p.to_str().map(|s| s.to_string()))
{
builder.set_app_path(&appimage);
} else {
builder.set_app_path(&current_exe.display().to_string());
}
app.manage(AutoLaunchManager(
builder.build().map_err(|e| e.to_string())?,
));
Ok(())
})
.build()
} }
-8
View File
@@ -1,13 +1,5 @@
# Changelog # Changelog
## \[2.2.1]
- [`f634e524`](https://github.com/tauri-apps/plugins-workspace/commit/f634e5248ebe428f8305a59f74c13fc15147fb8e) This is an "empty" release to update the plugins' source files on crates.io and docs.rs. This should fix docs.rs build failures for projects using tauri plugins as dependencies.
## \[2.2.0]
- [`3a79266b`](https://github.com/tauri-apps/plugins-workspace/commit/3a79266b8cf96a55b1ae6339d725567d45a44b1d) ([#2173](https://github.com/tauri-apps/plugins-workspace/pull/2173) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Bumped all plugins to `v2.2.0`. From now, the versions for the Rust and JavaScript packages of each plugin will be in sync with each other.
## \[2.0.1] ## \[2.0.1]
- [`a1a82208`](https://github.com/tauri-apps/plugins-workspace/commit/a1a82208ed4ab87f83310be0dc95428aec9ab241) ([#1873](https://github.com/tauri-apps/plugins-workspace/pull/1873) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Downgrade MSRV to 1.77.2 to support Windows 7. - [`a1a82208`](https://github.com/tauri-apps/plugins-workspace/commit/a1a82208ed4ab87f83310be0dc95428aec9ab241) ([#1873](https://github.com/tauri-apps/plugins-workspace/pull/1873) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Downgrade MSRV to 1.77.2 to support Windows 7.
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "tauri-plugin-barcode-scanner" name = "tauri-plugin-barcode-scanner"
version = "2.2.1" version = "2.0.1"
description = "Scan QR codes, EAN-13 and other kinds of barcodes on Android and iOS" description = "Scan QR codes, EAN-13 and other kinds of barcodes on Android and iOS"
edition = { workspace = true } edition = { workspace = true }
authors = { workspace = true } authors = { workspace = true }
+1 -1
View File
@@ -54,7 +54,7 @@ yarn add https://github.com/tauri-apps/tauri-plugin-barcode-scanner#v2
First you need to register the core plugin with Tauri: First you need to register the core plugin with Tauri:
`src-tauri/src/lib.rs` `src-tauri/src/main.rs`
```rust ```rust
fn main() { fn main() {
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@tauri-apps/plugin-barcode-scanner", "name": "@tauri-apps/plugin-barcode-scanner",
"version": "2.2.1", "version": "2.0.0",
"description": "Scan QR codes, EAN-13 and other kinds of barcodes on Android and iOS", "description": "Scan QR codes, EAN-13 and other kinds of barcodes on Android and iOS",
"license": "MIT OR Apache-2.0", "license": "MIT OR Apache-2.0",
"authors": [ "authors": [
@@ -9,8 +9,6 @@ It allows all barcode related features.
#### This default permission set includes the following:
- `allow-cancel` - `allow-cancel`
- `allow-check-permissions` - `allow-check-permissions`
- `allow-open-app-settings` - `allow-open-app-settings`
@@ -49,7 +49,7 @@
"minimum": 1.0 "minimum": 1.0
}, },
"description": { "description": {
"description": "Human-readable description of what the permission does. Tauri convention is to use `<h4>` headings in markdown content for Tauri documentation generation purposes.", "description": "Human-readable description of what the permission does. Tauri convention is to use <h4> headings in markdown content for Tauri documentation generation purposes.",
"type": [ "type": [
"string", "string",
"null" "null"
@@ -111,7 +111,7 @@
"type": "string" "type": "string"
}, },
"description": { "description": {
"description": "Human-readable description of what the permission does. Tauri internal convention is to use `<h4>` headings in markdown content for Tauri documentation generation purposes.", "description": "Human-readable description of what the permission does. Tauri internal convention is to use <h4> headings in markdown content for Tauri documentation generation purposes.",
"type": [ "type": [
"string", "string",
"null" "null"
@@ -297,80 +297,67 @@
{ {
"description": "Enables the cancel command without any pre-configured scope.", "description": "Enables the cancel command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "allow-cancel", "const": "allow-cancel"
"markdownDescription": "Enables the cancel command without any pre-configured scope."
}, },
{ {
"description": "Denies the cancel command without any pre-configured scope.", "description": "Denies the cancel command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "deny-cancel", "const": "deny-cancel"
"markdownDescription": "Denies the cancel command without any pre-configured scope."
}, },
{ {
"description": "Enables the check_permissions command without any pre-configured scope.", "description": "Enables the check_permissions command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "allow-check-permissions", "const": "allow-check-permissions"
"markdownDescription": "Enables the check_permissions command without any pre-configured scope."
}, },
{ {
"description": "Denies the check_permissions command without any pre-configured scope.", "description": "Denies the check_permissions command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "deny-check-permissions", "const": "deny-check-permissions"
"markdownDescription": "Denies the check_permissions command without any pre-configured scope."
}, },
{ {
"description": "Enables the open_app_settings command without any pre-configured scope.", "description": "Enables the open_app_settings command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "allow-open-app-settings", "const": "allow-open-app-settings"
"markdownDescription": "Enables the open_app_settings command without any pre-configured scope."
}, },
{ {
"description": "Denies the open_app_settings command without any pre-configured scope.", "description": "Denies the open_app_settings command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "deny-open-app-settings", "const": "deny-open-app-settings"
"markdownDescription": "Denies the open_app_settings command without any pre-configured scope."
}, },
{ {
"description": "Enables the request_permissions command without any pre-configured scope.", "description": "Enables the request_permissions command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "allow-request-permissions", "const": "allow-request-permissions"
"markdownDescription": "Enables the request_permissions command without any pre-configured scope."
}, },
{ {
"description": "Denies the request_permissions command without any pre-configured scope.", "description": "Denies the request_permissions command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "deny-request-permissions", "const": "deny-request-permissions"
"markdownDescription": "Denies the request_permissions command without any pre-configured scope."
}, },
{ {
"description": "Enables the scan command without any pre-configured scope.", "description": "Enables the scan command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "allow-scan", "const": "allow-scan"
"markdownDescription": "Enables the scan command without any pre-configured scope."
}, },
{ {
"description": "Denies the scan command without any pre-configured scope.", "description": "Denies the scan command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "deny-scan", "const": "deny-scan"
"markdownDescription": "Denies the scan command without any pre-configured scope."
}, },
{ {
"description": "Enables the vibrate command without any pre-configured scope.", "description": "Enables the vibrate command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "allow-vibrate", "const": "allow-vibrate"
"markdownDescription": "Enables the vibrate command without any pre-configured scope."
}, },
{ {
"description": "Denies the vibrate command without any pre-configured scope.", "description": "Denies the vibrate command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "deny-vibrate", "const": "deny-vibrate"
"markdownDescription": "Denies the vibrate command without any pre-configured scope."
}, },
{ {
"description": "This permission set configures which\nbarcode scanning features are by default exposed.\n\n#### Granted Permissions\n\nIt allows all barcode related features.\n\n\n#### This default permission set includes:\n\n- `allow-cancel`\n- `allow-check-permissions`\n- `allow-open-app-settings`\n- `allow-request-permissions`\n- `allow-scan`\n- `allow-vibrate`", "description": "This permission set configures which\nbarcode scanning features are by default exposed.\n\n#### Granted Permissions\n\nIt allows all barcode related features.\n\n",
"type": "string", "type": "string",
"const": "default", "const": "default"
"markdownDescription": "This permission set configures which\nbarcode scanning features are by default exposed.\n\n#### Granted Permissions\n\nIt allows all barcode related features.\n\n\n#### This default permission set includes:\n\n- `allow-cancel`\n- `allow-check-permissions`\n- `allow-open-app-settings`\n- `allow-request-permissions`\n- `allow-scan`\n- `allow-vibrate`"
} }
] ]
} }
-14
View File
@@ -1,19 +1,5 @@
# Changelog # Changelog
## \[2.2.2]
- [`f634e524`](https://github.com/tauri-apps/plugins-workspace/commit/f634e5248ebe428f8305a59f74c13fc15147fb8e) This is an "empty" release to update the plugins' source files on crates.io and docs.rs. This should fix docs.rs build failures for projects using tauri plugins as dependencies.
## \[2.2.1]
### bug
- [`10f9e66e`](https://github.com/tauri-apps/plugins-workspace/commit/10f9e66e32141dd35f4bf884fbf9102691187e92) ([#2633](https://github.com/tauri-apps/plugins-workspace/pull/2633) by [@pjf-dev](https://github.com/tauri-apps/plugins-workspace/../../pjf-dev)) Fix biometric plugin ignoring fallback logic when biometry status is unavailable or not enrolled on iOS.
## \[2.2.0]
- [`3a79266b`](https://github.com/tauri-apps/plugins-workspace/commit/3a79266b8cf96a55b1ae6339d725567d45a44b1d) ([#2173](https://github.com/tauri-apps/plugins-workspace/pull/2173) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Bumped all plugins to `v2.2.0`. From now, the versions for the Rust and JavaScript packages of each plugin will be in sync with each other.
## \[2.0.1] ## \[2.0.1]
- [`a1a82208`](https://github.com/tauri-apps/plugins-workspace/commit/a1a82208ed4ab87f83310be0dc95428aec9ab241) ([#1873](https://github.com/tauri-apps/plugins-workspace/pull/1873) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Downgrade MSRV to 1.77.2 to support Windows 7. - [`a1a82208`](https://github.com/tauri-apps/plugins-workspace/commit/a1a82208ed4ab87f83310be0dc95428aec9ab241) ([#1873](https://github.com/tauri-apps/plugins-workspace/pull/1873) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Downgrade MSRV to 1.77.2 to support Windows 7.
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "tauri-plugin-biometric" name = "tauri-plugin-biometric"
version = "2.2.2" version = "2.0.1"
description = "Prompt the user for biometric authentication on Android and iOS." description = "Prompt the user for biometric authentication on Android and iOS."
edition = { workspace = true } edition = { workspace = true }
authors = { workspace = true } authors = { workspace = true }
+1 -1
View File
@@ -56,7 +56,7 @@ yarn add https://github.com/tauri-apps/tauri-plugin-biometric#v2
First you need to register the core plugin with Tauri: First you need to register the core plugin with Tauri:
`src-tauri/src/lib.rs` `src-tauri/src/main.rs`
```rust ```rust
fn main() { fn main() {
@@ -98,12 +98,7 @@ class BiometricPlugin: Plugin {
} }
@objc func authenticate(_ invoke: Invoke) throws { @objc func authenticate(_ invoke: Invoke) throws {
let args = try invoke.parseArgs(AuthOptions.self) guard self.status.available else {
let allowDeviceCredential = args.allowDeviceCredential ?? false
guard self.status.available || allowDeviceCredential else {
// Biometry unavailable, fallback disabled
invoke.reject( invoke.reject(
self.status.errorReason ?? "", self.status.errorReason ?? "",
code: self.status.errorCode ?? "" code: self.status.errorCode ?? ""
@@ -111,11 +106,15 @@ class BiometricPlugin: Plugin {
return return
} }
let args = try invoke.parseArgs(AuthOptions.self)
let context = LAContext() let context = LAContext()
context.localizedFallbackTitle = args.fallbackTitle context.localizedFallbackTitle = args.fallbackTitle
context.localizedCancelTitle = args.cancelTitle context.localizedCancelTitle = args.cancelTitle
context.touchIDAuthenticationAllowableReuseDuration = 0 context.touchIDAuthenticationAllowableReuseDuration = 0
let allowDeviceCredential = args.allowDeviceCredential ?? false
// force system default fallback title if an empty string is provided (the OS hides the fallback button in this case) // force system default fallback title if an empty string is provided (the OS hides the fallback button in this case)
if allowDeviceCredential, if allowDeviceCredential,
let fallbackTitle = context.localizedFallbackTitle, let fallbackTitle = context.localizedFallbackTitle,
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@tauri-apps/plugin-biometric", "name": "@tauri-apps/plugin-biometric",
"version": "2.2.2", "version": "2.0.0",
"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"
@@ -9,8 +9,6 @@ It allows acccess to all biometric commands.
#### This default permission set includes the following:
- `allow-authenticate` - `allow-authenticate`
- `allow-status` - `allow-status`
@@ -49,7 +49,7 @@
"minimum": 1.0 "minimum": 1.0
}, },
"description": { "description": {
"description": "Human-readable description of what the permission does. Tauri convention is to use `<h4>` headings in markdown content for Tauri documentation generation purposes.", "description": "Human-readable description of what the permission does. Tauri convention is to use <h4> headings in markdown content for Tauri documentation generation purposes.",
"type": [ "type": [
"string", "string",
"null" "null"
@@ -111,7 +111,7 @@
"type": "string" "type": "string"
}, },
"description": { "description": {
"description": "Human-readable description of what the permission does. Tauri internal convention is to use `<h4>` headings in markdown content for Tauri documentation generation purposes.", "description": "Human-readable description of what the permission does. Tauri internal convention is to use <h4> headings in markdown content for Tauri documentation generation purposes.",
"type": [ "type": [
"string", "string",
"null" "null"
@@ -297,32 +297,27 @@
{ {
"description": "Enables the authenticate command without any pre-configured scope.", "description": "Enables the authenticate command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "allow-authenticate", "const": "allow-authenticate"
"markdownDescription": "Enables the authenticate command without any pre-configured scope."
}, },
{ {
"description": "Denies the authenticate command without any pre-configured scope.", "description": "Denies the authenticate command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "deny-authenticate", "const": "deny-authenticate"
"markdownDescription": "Denies the authenticate command without any pre-configured scope."
}, },
{ {
"description": "Enables the status command without any pre-configured scope.", "description": "Enables the status command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "allow-status", "const": "allow-status"
"markdownDescription": "Enables the status command without any pre-configured scope."
}, },
{ {
"description": "Denies the status command without any pre-configured scope.", "description": "Denies the status command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "deny-status", "const": "deny-status"
"markdownDescription": "Denies the status command without any pre-configured scope."
}, },
{ {
"description": "This permission set configures which\nbiometric features are by default exposed.\n\n#### Granted Permissions\n\nIt allows acccess to all biometric commands.\n\n\n#### This default permission set includes:\n\n- `allow-authenticate`\n- `allow-status`", "description": "This permission set configures which\nbiometric features are by default exposed.\n\n#### Granted Permissions\n\nIt allows acccess to all biometric commands.\n\n",
"type": "string", "type": "string",
"const": "default", "const": "default"
"markdownDescription": "This permission set configures which\nbiometric features are by default exposed.\n\n#### Granted Permissions\n\nIt allows acccess to all biometric commands.\n\n\n#### This default permission set includes:\n\n- `allow-authenticate`\n- `allow-status`"
} }
] ]
} }
+7 -8
View File
@@ -1,13 +1,5 @@
# Changelog # Changelog
## \[2.2.1]
- [`f634e524`](https://github.com/tauri-apps/plugins-workspace/commit/f634e5248ebe428f8305a59f74c13fc15147fb8e) This is an "empty" release to update the plugins' source files on crates.io and docs.rs. This should fix docs.rs build failures for projects using tauri plugins as dependencies.
## \[2.2.0]
- [`3a79266b`](https://github.com/tauri-apps/plugins-workspace/commit/3a79266b8cf96a55b1ae6339d725567d45a44b1d) ([#2173](https://github.com/tauri-apps/plugins-workspace/pull/2173) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Bumped all plugins to `v2.2.0`. From now, the versions for the Rust and JavaScript packages of each plugin will be in sync with each other.
## \[2.0.1] ## \[2.0.1]
- [`a1a82208`](https://github.com/tauri-apps/plugins-workspace/commit/a1a82208ed4ab87f83310be0dc95428aec9ab241) ([#1873](https://github.com/tauri-apps/plugins-workspace/pull/1873) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Downgrade MSRV to 1.77.2 to support Windows 7. - [`a1a82208`](https://github.com/tauri-apps/plugins-workspace/commit/a1a82208ed4ab87f83310be0dc95428aec9ab241) ([#1873](https://github.com/tauri-apps/plugins-workspace/pull/1873) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Downgrade MSRV to 1.77.2 to support Windows 7.
@@ -97,3 +89,10 @@
- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
te to alpha.11. te to alpha.11.
## \[2.0.0-alpha.0]
- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
ae67\`]\(https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
om/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "tauri-plugin-cli" name = "tauri-plugin-cli"
version = "2.2.1" version = "2.0.1"
description = "Parse arguments from your Tauri application's command line interface." description = "Parse arguments from your Tauri application's command line interface."
edition = { workspace = true } edition = { workspace = true }
authors = { workspace = true } authors = { workspace = true }
+1 -1
View File
@@ -55,7 +55,7 @@ yarn add https://github.com/tauri-apps/tauri-plugin-cli#v2
First you need to register the core plugin with Tauri: First you need to register the core plugin with Tauri:
`src-tauri/src/lib.rs` `src-tauri/src/main.rs`
```rust ```rust
fn main() { fn main() {
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@tauri-apps/plugin-cli", "name": "@tauri-apps/plugin-cli",
"version": "2.2.1", "version": "2.0.0",
"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"
@@ -2,8 +2,6 @@
Allows reading the CLI matches Allows reading the CLI matches
#### This default permission set includes the following:
- `allow-cli-matches` - `allow-cli-matches`
## Permission Table ## Permission Table
+6 -9
View File
@@ -49,7 +49,7 @@
"minimum": 1.0 "minimum": 1.0
}, },
"description": { "description": {
"description": "Human-readable description of what the permission does. Tauri convention is to use `<h4>` headings in markdown content for Tauri documentation generation purposes.", "description": "Human-readable description of what the permission does. Tauri convention is to use <h4> headings in markdown content for Tauri documentation generation purposes.",
"type": [ "type": [
"string", "string",
"null" "null"
@@ -111,7 +111,7 @@
"type": "string" "type": "string"
}, },
"description": { "description": {
"description": "Human-readable description of what the permission does. Tauri internal convention is to use `<h4>` headings in markdown content for Tauri documentation generation purposes.", "description": "Human-readable description of what the permission does. Tauri internal convention is to use <h4> headings in markdown content for Tauri documentation generation purposes.",
"type": [ "type": [
"string", "string",
"null" "null"
@@ -297,20 +297,17 @@
{ {
"description": "Enables the cli_matches command without any pre-configured scope.", "description": "Enables the cli_matches command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "allow-cli-matches", "const": "allow-cli-matches"
"markdownDescription": "Enables the cli_matches command without any pre-configured scope."
}, },
{ {
"description": "Denies the cli_matches command without any pre-configured scope.", "description": "Denies the cli_matches command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "deny-cli-matches", "const": "deny-cli-matches"
"markdownDescription": "Denies the cli_matches command without any pre-configured scope."
}, },
{ {
"description": "Allows reading the CLI matches\n#### This default permission set includes:\n\n- `allow-cli-matches`", "description": "Allows reading the CLI matches",
"type": "string", "type": "string",
"const": "default", "const": "default"
"markdownDescription": "Allows reading the CLI matches\n#### This default permission set includes:\n\n- `allow-cli-matches`"
} }
] ]
} }
+35 -22
View File
@@ -1,27 +1,5 @@
# Changelog # Changelog
## \[2.2.3]
- [`f634e524`](https://github.com/tauri-apps/plugins-workspace/commit/f634e5248ebe428f8305a59f74c13fc15147fb8e) This is an "empty" release to update the plugins' source files on crates.io and docs.rs. This should fix docs.rs build failures for projects using tauri plugins as dependencies.
## \[2.2.2]
### bug
- [`d37bbdef`](https://github.com/tauri-apps/plugins-workspace/commit/d37bbdef8dc70e61e59f9fe0bb8b2a48999d0aa1) ([#2507](https://github.com/tauri-apps/plugins-workspace/pull/2507) by [@SquitchYT](https://github.com/tauri-apps/plugins-workspace/../../SquitchYT)) Fix clipboard-manager Wayland support.
## \[2.2.1]
- [`ce11079f`](https://github.com/tauri-apps/plugins-workspace/commit/ce11079f19852fbefdecf0e4c7d947af3624fee0) ([#2280](https://github.com/tauri-apps/plugins-workspace/pull/2280) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Explicitly drop `arboard::Clipboard` on exit. Add recommendation to not use read methods on the mainthread.
## \[2.2.0]
- [`3a79266b`](https://github.com/tauri-apps/plugins-workspace/commit/3a79266b8cf96a55b1ae6339d725567d45a44b1d) ([#2173](https://github.com/tauri-apps/plugins-workspace/pull/2173) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Bumped all plugins to `v2.2.0`. From now, the versions for the Rust and JavaScript packages of each plugin will be in sync with each other.
## \[2.0.1]
- [`3fa0fc09`](https://github.com/tauri-apps/plugins-workspace/commit/3fa0fc09bbee0d619801e5757af9fb3c09883c97) ([#2099](https://github.com/tauri-apps/plugins-workspace/pull/2099) by [@rasteiner](https://github.com/tauri-apps/plugins-workspace/../../rasteiner)) Fix clipboard manager client side api not copying fallback alternative text when calling `writeHtml`.
## \[2.0.2] ## \[2.0.2]
- [`d57df4de`](https://github.com/tauri-apps/plugins-workspace/commit/d57df4debe7c75cfbd6d6558fff1beb07dbee54c) ([#1986](https://github.com/tauri-apps/plugins-workspace/pull/1986) by [@RikaKagurasaka](https://github.com/tauri-apps/plugins-workspace/../../RikaKagurasaka)) Fix that `read_image` wrongly set the image rgba data with binary PNG data. - [`d57df4de`](https://github.com/tauri-apps/plugins-workspace/commit/d57df4debe7c75cfbd6d6558fff1beb07dbee54c) ([#1986](https://github.com/tauri-apps/plugins-workspace/pull/1986) by [@RikaKagurasaka](https://github.com/tauri-apps/plugins-workspace/../../RikaKagurasaka)) Fix that `read_image` wrongly set the image rgba data with binary PNG data.
@@ -134,3 +112,38 @@
## \[2.0.0-alpha.0] ## \[2.0.0-alpha.0]
- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
te to alpha.11.
## \[2.0.0-alpha.0]
- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
\`]\(https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
te to alpha.11.
## \[2.0.0-alpha.0]
- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
hub.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
\`]\(https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
te to alpha.11.
## \[2.0.0-alpha.0]
- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
te to alpha.11.
## \[2.0.0-alpha.0]
- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
!
717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
ps/plugins-workspace/pull/371)) First v2 alpha release!
717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
!
717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
om/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
+2 -2
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "tauri-plugin-clipboard-manager" name = "tauri-plugin-clipboard-manager"
version = "2.2.3" version = "2.0.2"
description = "Read and write to the system clipboard." description = "Read and write to the system clipboard."
edition = { workspace = true } edition = { workspace = true }
authors = { workspace = true } authors = { workspace = true }
@@ -36,4 +36,4 @@ thiserror = { workspace = true }
tauri = { workspace = true, features = ["wry"] } tauri = { workspace = true, features = ["wry"] }
[target."cfg(any(target_os = \"macos\", windows, target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies] [target."cfg(any(target_os = \"macos\", windows, target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies]
arboard = { version = "3", features = ["wayland-data-control"] } arboard = "3"
+2 -1
View File
@@ -54,7 +54,7 @@ yarn add https://github.com/tauri-apps/tauri-plugin-clipboard-manager#v2
First you need to register the core plugin with Tauri: First you need to register the core plugin with Tauri:
`src-tauri/src/lib.rs` `src-tauri/src/main.rs`
```rust ```rust
fn main() { fn main() {
@@ -72,6 +72,7 @@ import {
writeText, writeText,
readText, readText,
writeHtml, writeHtml,
readHtml,
clear clear
} from '@tauri-apps/plugin-clipboard-manager' } from '@tauri-apps/plugin-clipboard-manager'
await writeText('Tauri is awesome!') await writeText('Tauri is awesome!')
+1 -1
View File
@@ -1 +1 @@
if("__TAURI__"in window){var __TAURI_PLUGIN_CLIPBOARD_MANAGER__=function(e){"use strict";var n;async function t(e,n={},t){return window.__TAURI_INTERNALS__.invoke(e,n,t)}"function"==typeof SuppressedError&&SuppressedError;class r{get rid(){return function(e,n,t,r){if("function"==typeof n?e!==n||!r:!n.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===t?r:"a"===t?r.call(e):r?r.value:n.get(e)}(this,n,"f")}constructor(e){n.set(this,void 0),function(e,n,t){if("function"==typeof n||!n.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");n.set(e,t)}(this,n,e)}async close(){return t("plugin:resources|close",{rid:this.rid})}}n=new WeakMap;class a extends r{constructor(e){super(e)}static async new(e,n,r){return t("plugin:image|new",{rgba:i(e),width:n,height:r}).then((e=>new a(e)))}static async fromBytes(e){return t("plugin:image|from_bytes",{bytes:i(e)}).then((e=>new a(e)))}static async fromPath(e){return t("plugin:image|from_path",{path:e}).then((e=>new a(e)))}async rgba(){return t("plugin:image|rgba",{rid:this.rid}).then((e=>new Uint8Array(e)))}async size(){return t("plugin:image|size",{rid:this.rid})}}function i(e){return null==e?null:"string"==typeof e?e:e instanceof a?e.rid:e}return e.clear=async function(){await t("plugin:clipboard-manager|clear")},e.readImage=async function(){return await t("plugin:clipboard-manager|read_image").then((e=>new a(e)))},e.readText=async function(){return await t("plugin:clipboard-manager|read_text")},e.writeHtml=async function(e,n){await t("plugin:clipboard-manager|write_html",{html:e,altText:n})},e.writeImage=async function(e){await t("plugin:clipboard-manager|write_image",{image:i(e)})},e.writeText=async function(e,n){await t("plugin:clipboard-manager|write_text",{label:n?.label,text:e})},e}({});Object.defineProperty(window.__TAURI__,"clipboardManager",{value:__TAURI_PLUGIN_CLIPBOARD_MANAGER__})} if("__TAURI__"in window){var __TAURI_PLUGIN_CLIPBOARD_MANAGER__=function(e){"use strict";var t;async function r(e,t={},r){return window.__TAURI_INTERNALS__.invoke(e,t,r)}"function"==typeof SuppressedError&&SuppressedError;class n{get rid(){return function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}(this,t,"f")}constructor(e){t.set(this,void 0),function(e,t,r,n,a){if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");t.set(e,r)}(this,t,e)}async close(){return r("plugin:resources|close",{rid:this.rid})}}t=new WeakMap;class a extends n{constructor(e){super(e)}static async new(e,t,n){return r("plugin:image|new",{rgba:i(e),width:t,height:n}).then((e=>new a(e)))}static async fromBytes(e){return r("plugin:image|from_bytes",{bytes:i(e)}).then((e=>new a(e)))}static async fromPath(e){return r("plugin:image|from_path",{path:e}).then((e=>new a(e)))}async rgba(){return r("plugin:image|rgba",{rid:this.rid}).then((e=>new Uint8Array(e)))}async size(){return r("plugin:image|size",{rid:this.rid})}}function i(e){return null==e?null:"string"==typeof e?e:e instanceof a?e.rid:e}return e.clear=async function(){await r("plugin:clipboard-manager|clear")},e.readImage=async function(){return await r("plugin:clipboard-manager|read_image").then((e=>new a(e)))},e.readText=async function(){return await r("plugin:clipboard-manager|read_text")},e.writeHtml=async function(e,t){await r("plugin:clipboard-manager|write_html",{html:e,altHtml:t})},e.writeImage=async function(e){await r("plugin:clipboard-manager|write_image",{image:i(e)})},e.writeText=async function(e,t){await r("plugin:clipboard-manager|write_text",{label:t?.label,text:e})},e}({});Object.defineProperty(window.__TAURI__,"clipboardManager",{value:__TAURI_PLUGIN_CLIPBOARD_MANAGER__})}
+5 -8
View File
@@ -65,7 +65,6 @@ async function readText(): Promise<string> {
* 0, 255, 0, 255, * 0, 255, 0, 255,
* ]; * ];
* await writeImage(buffer); * await writeImage(buffer);
* ```
* *
* @returns A promise indicating the success or failure of the operation. * @returns A promise indicating the success or failure of the operation.
* *
@@ -91,7 +90,7 @@ async function writeImage(
* import { readImage } from '@tauri-apps/plugin-clipboard-manager'; * import { readImage } from '@tauri-apps/plugin-clipboard-manager';
* *
* const clipboardImage = await readImage(); * const clipboardImage = await readImage();
* const blob = new Blob([await clipboardImage.rgba()], { type: 'image' }) * const blob = new Blob([clipboardImage.bytes], { type: 'image' })
* const url = URL.createObjectURL(blob) * const url = URL.createObjectURL(blob)
* ``` * ```
* @since 2.0.0 * @since 2.0.0
@@ -111,11 +110,9 @@ async function readImage(): Promise<Image> {
* *
* @example * @example
* ```typescript * ```typescript
* import { writeHtml } from '@tauri-apps/plugin-clipboard-manager'; * import { writeHtml, readHtml } from '@tauri-apps/plugin-clipboard-manager';
* await writeHtml('<h1>Tauri is awesome!</h1>', 'plaintext'); * await writeHtml('<h1>Tauri is awesome!</h1>', 'plaintext');
* // The following will write "<h1>Tauri is awesome</h1>" as plain text * await writeHtml('<h1>Tauri is awesome!</h1>', '<h1>Tauri is awesome</h1>'); // Will write "<h1>Tauri is awesome</h1>" as plain text
* await writeHtml('<h1>Tauri is awesome!</h1>', '<h1>Tauri is awesome</h1>');
* // we can read html data only as a string so there's just readText(), no readHtml()
* assert(await readText(), '<h1>Tauri is awesome!</h1>'); * assert(await readText(), '<h1>Tauri is awesome!</h1>');
* ``` * ```
* *
@@ -123,10 +120,10 @@ async function readImage(): Promise<Image> {
* *
* @since 2.0.0 * @since 2.0.0
*/ */
async function writeHtml(html: string, altText?: string): Promise<void> { async function writeHtml(html: string, altHtml?: string): Promise<void> {
await invoke('plugin:clipboard-manager|write_html', { await invoke('plugin:clipboard-manager|write_html', {
html, html,
altText altHtml
}) })
} }
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@tauri-apps/plugin-clipboard-manager", "name": "@tauri-apps/plugin-clipboard-manager",
"version": "2.2.3", "version": "2.0.0",
"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"
@@ -7,8 +7,6 @@ application specific if read and/or write access is needed.
Clipboard interaction needs to be explicitly enabled. Clipboard interaction needs to be explicitly enabled.
#### This default permission set includes the following:
## Permission Table ## Permission Table
@@ -49,7 +49,7 @@
"minimum": 1.0 "minimum": 1.0
}, },
"description": { "description": {
"description": "Human-readable description of what the permission does. Tauri convention is to use `<h4>` headings in markdown content for Tauri documentation generation purposes.", "description": "Human-readable description of what the permission does. Tauri convention is to use <h4> headings in markdown content for Tauri documentation generation purposes.",
"type": [ "type": [
"string", "string",
"null" "null"
@@ -111,7 +111,7 @@
"type": "string" "type": "string"
}, },
"description": { "description": {
"description": "Human-readable description of what the permission does. Tauri internal convention is to use `<h4>` headings in markdown content for Tauri documentation generation purposes.", "description": "Human-readable description of what the permission does. Tauri internal convention is to use <h4> headings in markdown content for Tauri documentation generation purposes.",
"type": [ "type": [
"string", "string",
"null" "null"
@@ -297,80 +297,67 @@
{ {
"description": "Enables the clear command without any pre-configured scope.", "description": "Enables the clear command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "allow-clear", "const": "allow-clear"
"markdownDescription": "Enables the clear command without any pre-configured scope."
}, },
{ {
"description": "Denies the clear command without any pre-configured scope.", "description": "Denies the clear command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "deny-clear", "const": "deny-clear"
"markdownDescription": "Denies the clear command without any pre-configured scope."
}, },
{ {
"description": "Enables the read_image command without any pre-configured scope.", "description": "Enables the read_image command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "allow-read-image", "const": "allow-read-image"
"markdownDescription": "Enables the read_image command without any pre-configured scope."
}, },
{ {
"description": "Denies the read_image command without any pre-configured scope.", "description": "Denies the read_image command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "deny-read-image", "const": "deny-read-image"
"markdownDescription": "Denies the read_image command without any pre-configured scope."
}, },
{ {
"description": "Enables the read_text command without any pre-configured scope.", "description": "Enables the read_text command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "allow-read-text", "const": "allow-read-text"
"markdownDescription": "Enables the read_text command without any pre-configured scope."
}, },
{ {
"description": "Denies the read_text command without any pre-configured scope.", "description": "Denies the read_text command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "deny-read-text", "const": "deny-read-text"
"markdownDescription": "Denies the read_text command without any pre-configured scope."
}, },
{ {
"description": "Enables the write_html command without any pre-configured scope.", "description": "Enables the write_html command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "allow-write-html", "const": "allow-write-html"
"markdownDescription": "Enables the write_html command without any pre-configured scope."
}, },
{ {
"description": "Denies the write_html command without any pre-configured scope.", "description": "Denies the write_html command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "deny-write-html", "const": "deny-write-html"
"markdownDescription": "Denies the write_html command without any pre-configured scope."
}, },
{ {
"description": "Enables the write_image command without any pre-configured scope.", "description": "Enables the write_image command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "allow-write-image", "const": "allow-write-image"
"markdownDescription": "Enables the write_image command without any pre-configured scope."
}, },
{ {
"description": "Denies the write_image command without any pre-configured scope.", "description": "Denies the write_image command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "deny-write-image", "const": "deny-write-image"
"markdownDescription": "Denies the write_image command without any pre-configured scope."
}, },
{ {
"description": "Enables the write_text command without any pre-configured scope.", "description": "Enables the write_text command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "allow-write-text", "const": "allow-write-text"
"markdownDescription": "Enables the write_text command without any pre-configured scope."
}, },
{ {
"description": "Denies the write_text command without any pre-configured scope.", "description": "Denies the write_text command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "deny-write-text", "const": "deny-write-text"
"markdownDescription": "Denies the write_text command without any pre-configured scope."
}, },
{ {
"description": "No features are enabled by default, as we believe\nthe clipboard can be inherently dangerous and it is \napplication specific if read and/or write access is needed.\n\nClipboard interaction needs to be explicitly enabled.\n", "description": "No features are enabled by default, as we believe\nthe clipboard can be inherently dangerous and it is \napplication specific if read and/or write access is needed.\n\nClipboard interaction needs to be explicitly enabled.\n",
"type": "string", "type": "string",
"const": "default", "const": "default"
"markdownDescription": "No features are enabled by default, as we believe\nthe clipboard can be inherently dangerous and it is \napplication specific if read and/or write access is needed.\n\nClipboard interaction needs to be explicitly enabled.\n"
} }
] ]
} }
+6 -32
View File
@@ -14,7 +14,7 @@ pub fn init<R: Runtime, C: DeserializeOwned>(
) -> crate::Result<Clipboard<R>> { ) -> crate::Result<Clipboard<R>> {
Ok(Clipboard { Ok(Clipboard {
app: app.clone(), app: app.clone(),
clipboard: arboard::Clipboard::new().map(|c| Mutex::new(Some(c))), clipboard: arboard::Clipboard::new().map(Mutex::new),
}) })
} }
@@ -22,21 +22,13 @@ pub fn init<R: Runtime, C: DeserializeOwned>(
pub struct Clipboard<R: Runtime> { pub struct Clipboard<R: Runtime> {
#[allow(dead_code)] #[allow(dead_code)]
app: AppHandle<R>, app: AppHandle<R>,
// According to arboard docs the clipboard must be dropped before exit. clipboard: Result<Mutex<arboard::Clipboard>, arboard::Error>,
// Since tauri doesn't call drop on exit we'll use an Option to take() on RunEvent::Exit.
clipboard: Result<Mutex<Option<arboard::Clipboard>>, arboard::Error>,
} }
impl<R: Runtime> Clipboard<R> { impl<R: Runtime> Clipboard<R> {
pub fn write_text<'a, T: Into<Cow<'a, str>>>(&self, text: T) -> crate::Result<()> { pub fn write_text<'a, T: Into<Cow<'a, str>>>(&self, text: T) -> crate::Result<()> {
match &self.clipboard { match &self.clipboard {
Ok(clipboard) => clipboard Ok(clipboard) => clipboard.lock().unwrap().set_text(text).map_err(Into::into),
.lock()
.unwrap()
.as_mut()
.unwrap()
.set_text(text)
.map_err(Into::into),
Err(e) => Err(crate::Error::Clipboard(e.to_string())), Err(e) => Err(crate::Error::Clipboard(e.to_string())),
} }
} }
@@ -46,8 +38,6 @@ impl<R: Runtime> Clipboard<R> {
Ok(clipboard) => clipboard Ok(clipboard) => clipboard
.lock() .lock()
.unwrap() .unwrap()
.as_mut()
.unwrap()
.set_image(ImageData { .set_image(ImageData {
bytes: Cow::Borrowed(image.rgba()), bytes: Cow::Borrowed(image.rgba()),
width: image.width() as usize, width: image.width() as usize,
@@ -58,11 +48,10 @@ impl<R: Runtime> Clipboard<R> {
} }
} }
/// Warning: This method should not be used on the main thread! Otherwise the underlying libraries may deadlock on Linux, freezing the whole app, when trying to copy data copied from this app, for example if the user copies text from the WebView.
pub fn read_text(&self) -> crate::Result<String> { pub fn read_text(&self) -> crate::Result<String> {
match &self.clipboard { match &self.clipboard {
Ok(clipboard) => { Ok(clipboard) => {
let text = clipboard.lock().unwrap().as_mut().unwrap().get_text()?; let text = clipboard.lock().unwrap().get_text()?;
Ok(text) Ok(text)
} }
Err(e) => Err(crate::Error::Clipboard(e.to_string())), Err(e) => Err(crate::Error::Clipboard(e.to_string())),
@@ -78,8 +67,6 @@ impl<R: Runtime> Clipboard<R> {
Ok(clipboard) => clipboard Ok(clipboard) => clipboard
.lock() .lock()
.unwrap() .unwrap()
.as_mut()
.unwrap()
.set_html(html, alt_text) .set_html(html, alt_text)
.map_err(Into::into), .map_err(Into::into),
Err(e) => Err(crate::Error::Clipboard(e.to_string())), Err(e) => Err(crate::Error::Clipboard(e.to_string())),
@@ -88,22 +75,15 @@ impl<R: Runtime> Clipboard<R> {
pub fn clear(&self) -> crate::Result<()> { pub fn clear(&self) -> crate::Result<()> {
match &self.clipboard { match &self.clipboard {
Ok(clipboard) => clipboard Ok(clipboard) => clipboard.lock().unwrap().clear().map_err(Into::into),
.lock()
.unwrap()
.as_mut()
.unwrap()
.clear()
.map_err(Into::into),
Err(e) => Err(crate::Error::Clipboard(e.to_string())), Err(e) => Err(crate::Error::Clipboard(e.to_string())),
} }
} }
/// Warning: This method should not be used on the main thread! Otherwise the underlying libraries may deadlock on Linux, freezing the whole app, when trying to copy data copied from this app, for example if the user copies text from the WebView.
pub fn read_image(&self) -> crate::Result<Image<'_>> { pub fn read_image(&self) -> crate::Result<Image<'_>> {
match &self.clipboard { match &self.clipboard {
Ok(clipboard) => { Ok(clipboard) => {
let image = clipboard.lock().unwrap().as_mut().unwrap().get_image()?; let image = clipboard.lock().unwrap().get_image()?;
let image = Image::new_owned( let image = Image::new_owned(
image.bytes.to_vec(), image.bytes.to_vec(),
image.width as u32, image.width as u32,
@@ -114,10 +94,4 @@ impl<R: Runtime> Clipboard<R> {
Err(e) => Err(crate::Error::Clipboard(e.to_string())), Err(e) => Err(crate::Error::Clipboard(e.to_string())),
} }
} }
pub(crate) fn cleanup(&self) {
if let Ok(clipboard) = &self.clipboard {
clipboard.lock().unwrap().take();
}
}
} }
+1 -7
View File
@@ -11,7 +11,7 @@
use tauri::{ use tauri::{
plugin::{Builder, TauriPlugin}, plugin::{Builder, TauriPlugin},
Manager, RunEvent, Runtime, Manager, Runtime,
}; };
#[cfg(desktop)] #[cfg(desktop)]
@@ -59,11 +59,5 @@ pub fn init<R: Runtime>() -> TauriPlugin<R> {
app.manage(clipboard); app.manage(clipboard);
Ok(()) Ok(())
}) })
.on_event(|_app, _event| {
#[cfg(desktop)]
if let RunEvent::Exit = _event {
_app.clipboard().cleanup();
}
})
.build() .build()
} }
-20
View File
@@ -1,25 +1,5 @@
# Changelog # Changelog
## \[2.3.0]
- [`4d10acee`](https://github.com/tauri-apps/plugins-workspace/commit/4d10acee61bad8045705508121424ed5f2d381f6) ([#993](https://github.com/tauri-apps/plugins-workspace/pull/993) by [@m00nwtchr](https://github.com/tauri-apps/plugins-workspace/../../m00nwtchr)) Exposed Android's `path`, `pathPattern` and `pathSuffix` configurations.
- [`4d10acee`](https://github.com/tauri-apps/plugins-workspace/commit/4d10acee61bad8045705508121424ed5f2d381f6) ([#993](https://github.com/tauri-apps/plugins-workspace/pull/993) by [@m00nwtchr](https://github.com/tauri-apps/plugins-workspace/../../m00nwtchr)) Added a `scheme` configuration to set a scheme other than http/https. This is only supported on Android and will still default to http,https if not set.
## \[2.2.1]
### bug
- [`38deef43`](https://github.com/tauri-apps/plugins-workspace/commit/38deef43dca9d5a09a38ed2da45b0f86c6afa1c5) ([#2483](https://github.com/tauri-apps/plugins-workspace/pull/2483)) Fix `is_registered` not being able to pickup deep link registered in `HKEY_LOCAL_MACHINE` on Windows
- [`38deef43`](https://github.com/tauri-apps/plugins-workspace/commit/38deef43dca9d5a09a38ed2da45b0f86c6afa1c5) ([#2483](https://github.com/tauri-apps/plugins-workspace/pull/2483)) Fix `unregister` not being able to remove deep link registered in `HKEY_LOCAL_MACHINE` on Windows
## \[2.2.0]
- [`3a79266b`](https://github.com/tauri-apps/plugins-workspace/commit/3a79266b8cf96a55b1ae6339d725567d45a44b1d) ([#2173](https://github.com/tauri-apps/plugins-workspace/pull/2173) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Bumped all plugins to `v2.2.0`. From now, the versions for the Rust and JavaScript packages of each plugin will be in sync with each other.
## \[2.0.1]
- [`b2aea045`](https://github.com/tauri-apps/plugins-workspace/commit/b2aea0456799775a7243706fdd7a5abf9a193992) ([#2008](https://github.com/tauri-apps/plugins-workspace/pull/2008) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) `onOpenUrl()` will now not call `getCurrent()` anymore, matching the documented behavior.
## \[2.0.1] ## \[2.0.1]
- [`a1a82208`](https://github.com/tauri-apps/plugins-workspace/commit/a1a82208ed4ab87f83310be0dc95428aec9ab241) ([#1873](https://github.com/tauri-apps/plugins-workspace/pull/1873) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Downgrade MSRV to 1.77.2 to support Windows 7. - [`a1a82208`](https://github.com/tauri-apps/plugins-workspace/commit/a1a82208ed4ab87f83310be0dc95428aec9ab241) ([#1873](https://github.com/tauri-apps/plugins-workspace/pull/1873) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Downgrade MSRV to 1.77.2 to support Windows 7.
+4 -4
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "tauri-plugin-deep-link" name = "tauri-plugin-deep-link"
version = "2.3.0" version = "2.0.1"
description = "Set your Tauri application as the default handler for an URL" description = "Set your Tauri application as the default handler for an URL"
authors = { workspace = true } authors = { workspace = true }
license = { workspace = true } license = { workspace = true }
@@ -32,14 +32,14 @@ serde = { workspace = true }
serde_json = { workspace = true } serde_json = { workspace = true }
tauri = { workspace = true } tauri = { workspace = true }
tauri-utils = { workspace = true } tauri-utils = { workspace = true }
tracing = { workspace = true } log = { workspace = true }
thiserror = { workspace = true } thiserror = { workspace = true }
url = { workspace = true } url = { workspace = true }
[target."cfg(windows)".dependencies] [target."cfg(windows)".dependencies]
dunce = "1" dunce = "1"
windows-registry = "0.5" windows-registry = "0.3"
windows-result = "0.3" windows-result = "0.2"
[target."cfg(target_os = \"linux\")".dependencies] [target."cfg(target_os = \"linux\")".dependencies]
rust-ini = "0.21" rust-ini = "0.21"
+1 -1
View File
@@ -133,7 +133,7 @@ Under `tauri.conf.json > plugins > deep-link`, configure the domains (mobile) an
First you need to register the core plugin with Tauri: First you need to register the core plugin with Tauri:
`src-tauri/src/lib.rs` `src-tauri/src/main.rs`
```rust ```rust
fn main() { fn main() {
+4 -29
View File
@@ -9,50 +9,25 @@ use config::{AssociatedDomain, Config};
const COMMANDS: &[&str] = &["get_current", "register", "unregister", "is_registered"]; const COMMANDS: &[&str] = &["get_current", "register", "unregister", "is_registered"];
// TODO: Consider using activity-alias in case users may have multiple activities in their app. // TODO: Consider using activity-alias in case users may have multiple activities in their app.
// TODO: Do we want to support the other path* configs too?
fn intent_filter(domain: &AssociatedDomain) -> String { fn intent_filter(domain: &AssociatedDomain) -> String {
format!( format!(
r#"<intent-filter android:autoVerify="true"> r#"<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" /> <category android:name="android.intent.category.BROWSABLE" />
{} <data android:scheme="http" />
<data android:scheme="https" />
<data android:host="{}" /> <data android:host="{}" />
{} {}
{}
{}
{}
</intent-filter>"#, </intent-filter>"#,
domain
.scheme
.iter()
.map(|scheme| format!(r#"<data android:scheme="{scheme}" />"#))
.collect::<Vec<_>>()
.join("\n "),
domain.host, domain.host,
domain
.path
.iter()
.map(|path| format!(r#"<data android:path="{path}" />"#))
.collect::<Vec<_>>()
.join("\n "),
domain
.path_pattern
.iter()
.map(|pattern| format!(r#"<data android:pathPattern="{pattern}" />"#))
.collect::<Vec<_>>()
.join("\n "),
domain domain
.path_prefix .path_prefix
.iter() .iter()
.map(|prefix| format!(r#"<data android:pathPrefix="{prefix}" />"#)) .map(|prefix| format!(r#"<data android:pathPrefix="{prefix}" />"#))
.collect::<Vec<_>>() .collect::<Vec<_>>()
.join("\n "), .join("\n ")
domain
.path_suffix
.iter()
.map(|suffix| format!(r#"<data android:pathSuffix="{suffix}" />"#))
.collect::<Vec<_>>()
.join("\n "),
) )
} }
@@ -1,29 +1,5 @@
# Changelog # Changelog
## \[2.2.2]
### Dependencies
- Upgraded to `deep-link-js@2.3.0`
## \[2.2.1]
### Dependencies
- Upgraded to `deep-link-js@2.2.1`
## \[2.2.0]
### Dependencies
- Upgraded to `deep-link-js@2.1.0`
## \[2.0.1]
### Dependencies
- Upgraded to `deep-link-js@2.0.1`
## \[2.0.0] ## \[2.0.0]
- [`e2c4dfb6`](https://github.com/tauri-apps/plugins-workspace/commit/e2c4dfb6af43e5dd8d9ceba232c315f5febd55c1) Update to tauri v2 stable release. - [`e2c4dfb6`](https://github.com/tauri-apps/plugins-workspace/commit/e2c4dfb6af43e5dd8d9ceba232c315f5febd55c1) Update to tauri v2 stable release.
+6 -6
View File
@@ -1,7 +1,7 @@
{ {
"name": "deep-link-example", "name": "deep-link-example",
"private": true, "private": true,
"version": "2.2.2", "version": "2.0.0",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
@@ -10,12 +10,12 @@
"tauri": "tauri" "tauri": "tauri"
}, },
"dependencies": { "dependencies": {
"@tauri-apps/api": "2.5.0", "@tauri-apps/api": "2.1.1",
"@tauri-apps/plugin-deep-link": "2.3.0" "@tauri-apps/plugin-deep-link": "2.0.0"
}, },
"devDependencies": { "devDependencies": {
"@tauri-apps/cli": "2.5.0", "@tauri-apps/cli": "2.1.0",
"typescript": "^5.7.3", "typescript": "^5.2.2",
"vite": "^6.2.6" "vite": "^5.4.7"
} }
} }
+2 -2
View File
@@ -73,7 +73,7 @@ export async function unregister(protocol: string): Promise<null> {
* await isRegistered("my-scheme"); * await isRegistered("my-scheme");
* ``` * ```
* *
* #### - **macOS / Android / iOS**: Unsupported. * #### - **macOS / Android / iOS**: Unsupported, always returns `true`.
* *
* @since 2.0.0 * @since 2.0.0
*/ */
@@ -92,7 +92,7 @@ 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. * #### - **Windows / Linux**: Unsupported, 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
@@ -1,6 +1,6 @@
{ {
"name": "@tauri-apps/plugin-deep-link", "name": "@tauri-apps/plugin-deep-link",
"version": "2.3.0", "version": "2.0.0",
"description": "Set your Tauri application as the default handler for an URL", "description": "Set your Tauri application as the default handler for an URL",
"license": "MIT OR Apache-2.0", "license": "MIT OR Apache-2.0",
"authors": [ "authors": [
@@ -2,8 +2,6 @@
Allows reading the opened deep link via the get_current command Allows reading the opened deep link via the get_current command
#### This default permission set includes the following:
- `allow-get-current` - `allow-get-current`
## Permission Table ## Permission Table
@@ -49,7 +49,7 @@
"minimum": 1.0 "minimum": 1.0
}, },
"description": { "description": {
"description": "Human-readable description of what the permission does. Tauri convention is to use `<h4>` headings in markdown content for Tauri documentation generation purposes.", "description": "Human-readable description of what the permission does. Tauri convention is to use <h4> headings in markdown content for Tauri documentation generation purposes.",
"type": [ "type": [
"string", "string",
"null" "null"
@@ -111,7 +111,7 @@
"type": "string" "type": "string"
}, },
"description": { "description": {
"description": "Human-readable description of what the permission does. Tauri internal convention is to use `<h4>` headings in markdown content for Tauri documentation generation purposes.", "description": "Human-readable description of what the permission does. Tauri internal convention is to use <h4> headings in markdown content for Tauri documentation generation purposes.",
"type": [ "type": [
"string", "string",
"null" "null"
@@ -297,56 +297,47 @@
{ {
"description": "Enables the get_current command without any pre-configured scope.", "description": "Enables the get_current command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "allow-get-current", "const": "allow-get-current"
"markdownDescription": "Enables the get_current command without any pre-configured scope."
}, },
{ {
"description": "Denies the get_current command without any pre-configured scope.", "description": "Denies the get_current command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "deny-get-current", "const": "deny-get-current"
"markdownDescription": "Denies the get_current command without any pre-configured scope."
}, },
{ {
"description": "Enables the is_registered command without any pre-configured scope.", "description": "Enables the is_registered command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "allow-is-registered", "const": "allow-is-registered"
"markdownDescription": "Enables the is_registered command without any pre-configured scope."
}, },
{ {
"description": "Denies the is_registered command without any pre-configured scope.", "description": "Denies the is_registered command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "deny-is-registered", "const": "deny-is-registered"
"markdownDescription": "Denies the is_registered command without any pre-configured scope."
}, },
{ {
"description": "Enables the register command without any pre-configured scope.", "description": "Enables the register command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "allow-register", "const": "allow-register"
"markdownDescription": "Enables the register command without any pre-configured scope."
}, },
{ {
"description": "Denies the register command without any pre-configured scope.", "description": "Denies the register command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "deny-register", "const": "deny-register"
"markdownDescription": "Denies the register command without any pre-configured scope."
}, },
{ {
"description": "Enables the unregister command without any pre-configured scope.", "description": "Enables the unregister command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "allow-unregister", "const": "allow-unregister"
"markdownDescription": "Enables the unregister command without any pre-configured scope."
}, },
{ {
"description": "Denies the unregister command without any pre-configured scope.", "description": "Denies the unregister command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "deny-unregister", "const": "deny-unregister"
"markdownDescription": "Denies the unregister command without any pre-configured scope."
}, },
{ {
"description": "Allows reading the opened deep link via the get_current command\n#### This default permission set includes:\n\n- `allow-get-current`", "description": "Allows reading the opened deep link via the get_current command",
"type": "string", "type": "string",
"const": "default", "const": "default"
"markdownDescription": "Allows reading the opened deep link via the get_current command\n#### This default permission set includes:\n\n- `allow-get-current`"
} }
] ]
} }
-15
View File
@@ -9,25 +9,10 @@ use tauri_utils::config::DeepLinkProtocol;
#[derive(Deserialize, Clone)] #[derive(Deserialize, Clone)]
pub struct AssociatedDomain { pub struct AssociatedDomain {
#[serde(default = "default_schemes")]
pub scheme: Vec<String>,
#[serde(deserialize_with = "deserialize_associated_host")] #[serde(deserialize_with = "deserialize_associated_host")]
pub host: String, pub host: String,
#[serde(default)]
pub path: Vec<String>,
#[serde(default, alias = "path-pattern", rename = "pathPattern")]
pub path_pattern: Vec<String>,
#[serde(default, alias = "path-prefix", rename = "pathPrefix")] #[serde(default, alias = "path-prefix", rename = "pathPrefix")]
pub path_prefix: Vec<String>, pub path_prefix: Vec<String>,
#[serde(default, alias = "path-suffix", rename = "pathSuffix")]
pub path_suffix: Vec<String>,
}
// TODO: Consider removing this in v3
fn default_schemes() -> Vec<String> {
vec!["https".to_string(), "http".to_string()]
} }
fn deserialize_associated_host<'de, D>(deserializer: D) -> Result<String, D::Error> fn deserialize_associated_host<'de, D>(deserializer: D) -> Result<String, D::Error>
+19 -26
View File
@@ -114,8 +114,8 @@ mod imp {
/// ## Platform-specific: /// ## 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. /// - **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.
pub fn get_current(&self) -> crate::Result<Option<Vec<url::Url>>> { pub fn get_current(&self) -> crate::Result<Option<Vec<url::Url>>> {
self.plugin_handle self.plugin_handle
.run_mobile_plugin::<GetCurrentResponse>("getCurrent", ()) .run_mobile_plugin::<GetCurrentResponse>("getCurrent", ())
@@ -172,7 +172,7 @@ mod imp {
use tauri::Manager; use tauri::Manager;
use tauri::{AppHandle, Runtime}; use tauri::{AppHandle, Runtime};
#[cfg(windows)] #[cfg(windows)]
use windows_registry::{CLASSES_ROOT, CURRENT_USER, LOCAL_MACHINE}; use windows_registry::CURRENT_USER;
/// Access to the deep-link APIs. /// Access to the deep-link APIs.
pub struct DeepLink<R: Runtime> { pub struct DeepLink<R: Runtime> {
@@ -215,7 +215,7 @@ mod imp {
current.replace(vec![url.clone()]); current.replace(vec![url.clone()]);
let _ = self.app.emit("deep-link://new-url", vec![url]); let _ = self.app.emit("deep-link://new-url", vec![url]);
} else if cfg!(debug_assertions) { } else if cfg!(debug_assertions) {
tracing::warn!("argument {url} does not match any configured deep link scheme; skipping it"); log::warn!("argument {url} does not match any configured deep link scheme; skipping it");
} }
} }
} }
@@ -226,8 +226,8 @@ mod imp {
/// ## Platform-specific: /// ## 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. /// - **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.
pub fn get_current(&self) -> crate::Result<Option<Vec<url::Url>>> { pub fn get_current(&self) -> crate::Result<Option<Vec<url::Url>>> {
return Ok(self.current.lock().unwrap().clone()); return Ok(self.current.lock().unwrap().clone());
} }
@@ -258,23 +258,25 @@ mod imp {
pub fn register<S: AsRef<str>>(&self, _protocol: S) -> crate::Result<()> { pub fn register<S: AsRef<str>>(&self, _protocol: S) -> crate::Result<()> {
#[cfg(windows)] #[cfg(windows)]
{ {
let protocol = _protocol.as_ref(); let key_base = format!("Software\\Classes\\{}", _protocol.as_ref());
let key_base = format!("Software\\Classes\\{protocol}");
let exe = dunce::simplified(&tauri::utils::platform::current_exe()?) let exe = dunce::simplified(&tauri::utils::platform::current_exe()?)
.display() .display()
.to_string(); .to_string();
let key_reg = CURRENT_USER.create(&key_base)?; let key_reg = CURRENT_USER.create(&key_base)?;
key_reg.set_string("", format!("URL:{} protocol", self.app.config().identifier))?; key_reg.set_string(
"",
&format!("URL:{} protocol", self.app.config().identifier),
)?;
key_reg.set_string("URL Protocol", "")?; key_reg.set_string("URL Protocol", "")?;
let icon_reg = CURRENT_USER.create(format!("{key_base}\\DefaultIcon"))?; let icon_reg = CURRENT_USER.create(format!("{key_base}\\DefaultIcon"))?;
icon_reg.set_string("", format!("{exe},0"))?; icon_reg.set_string("", &format!("{exe},0"))?;
let cmd_reg = CURRENT_USER.create(format!("{key_base}\\shell\\open\\command"))?; let cmd_reg = CURRENT_USER.create(format!("{key_base}\\shell\\open\\command"))?;
cmd_reg.set_string("", format!("\"{exe}\" \"%1\""))?; cmd_reg.set_string("", &format!("\"{exe}\" \"%1\""))?;
Ok(()) Ok(())
} }
@@ -349,21 +351,13 @@ mod imp {
/// ///
/// ## Platform-specific: /// ## Platform-specific:
/// ///
/// - **Windows**: Requires admin rights if the protocol is registered on local machine
/// (this can happen when registered from the NSIS installer when the install mode is set to both or per machine)
/// - **Linux**: Can only unregister the scheme if it was initially registered with [`register`](`Self::register`). May not work on older distros. /// - **Linux**: Can only unregister the scheme if it was initially registered with [`register`](`Self::register`). May not work on older distros.
/// - **macOS / Android / iOS**: Unsupported, will return [`Error::UnsupportedPlatform`](`crate::Error::UnsupportedPlatform`). /// - **macOS / Android / iOS**: Unsupported, will return [`Error::UnsupportedPlatform`](`crate::Error::UnsupportedPlatform`).
pub fn unregister<S: AsRef<str>>(&self, _protocol: S) -> crate::Result<()> { pub fn unregister<S: AsRef<str>>(&self, _protocol: S) -> crate::Result<()> {
#[cfg(windows)] #[cfg(windows)]
{ {
let protocol = _protocol.as_ref(); CURRENT_USER.remove_tree(format!("Software\\Classes\\{}", _protocol.as_ref()))?;
let path = format!("Software\\Classes\\{protocol}");
if LOCAL_MACHINE.open(&path).is_ok() {
LOCAL_MACHINE.remove_tree(&path)?;
}
if CURRENT_USER.open(&path).is_ok() {
CURRENT_USER.remove_tree(&path)?;
}
Ok(()) Ok(())
} }
@@ -407,11 +401,10 @@ mod imp {
pub fn is_registered<S: AsRef<str>>(&self, _protocol: S) -> crate::Result<bool> { pub fn is_registered<S: AsRef<str>>(&self, _protocol: S) -> crate::Result<bool> {
#[cfg(windows)] #[cfg(windows)]
{ {
let protocol = _protocol.as_ref(); let cmd_reg = CURRENT_USER.open(format!(
let Ok(cmd_reg) = CLASSES_ROOT.open(format!("{protocol}\\shell\\open\\command")) "Software\\Classes\\{}\\shell\\open\\command",
else { _protocol.as_ref()
return Ok(false); ))?;
};
let registered_cmd = cmd_reg.get_string("")?; let registered_cmd = cmd_reg.get_string("")?;
+85 -34
View File
@@ -1,39 +1,5 @@
# Changelog # Changelog
## \[2.2.2]
### Dependencies
- Upgraded to `fs-js@2.3.0`
## \[2.2.1]
### Dependencies
- Upgraded to `fs-js@2.2.1`
## \[2.2.0]
- [`3a79266b`](https://github.com/tauri-apps/plugins-workspace/commit/3a79266b8cf96a55b1ae6339d725567d45a44b1d) ([#2173](https://github.com/tauri-apps/plugins-workspace/pull/2173) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Bumped all plugins to `v2.2.0`. From now, the versions for the Rust and JavaScript packages of each plugin will be in sync with each other.
### Dependencies
- Upgraded to `fs-js@2.1.0`
## \[2.0.2]
### Dependencies
- Upgraded to `fs-js@2.0.4`
## \[2.0.4]
- [`76f99ce9`](https://github.com/tauri-apps/plugins-workspace/commit/76f99ce999a2ff9e40235c1675e3eb6570b5e1e2) ([#2108](https://github.com/tauri-apps/plugins-workspace/pull/2108) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) The `Dialog` struct is now correctly exported, primarily to fix the documentation on `docs.rs`.
### Dependencies
- Upgraded to `fs@2.1.0`
## \[2.0.3] ## \[2.0.3]
### Dependencies ### Dependencies
@@ -250,3 +216,88 @@
- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
d6e80b)([#545](https://github.com/tauri-apps/plugins-workspace/pull/545)) Fixes docs.rs build by enabling the `tauri/dox` feature flag. d6e80b)([#545](https://github.com/tauri-apps/plugins-workspace/pull/545)) Fixes docs.rs build by enabling the `tauri/dox` feature flag.
- [`d74fc0a`](https://github.com/tauri-apps/plugins-workspace/commit/d74fc0a097996e90a37be8f57d50b7d1f6ca616f)([#555](https://github.com/tauri-apps/plugins-workspace/pull/555)) Update to alpha.11.
### Dependencies
- Upgraded to `fs@2.0.0-alpha.1`
## \[2.0.0-alpha.0]
- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
\`
## \[2.0.0-alpha.0]
- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
pull/371)) First v2 alpha release!
ri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
\`
## \[2.0.0-alpha.0]
- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
pull/371)) First v2 alpha release!
hub.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
pull/371)) First v2 alpha release!
ri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
\`
## \[2.0.0-alpha.0]
- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
pull/371)) First v2 alpha release!
alpha release!
pull/371)) First v2 alpha release!
ri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
\`
## \[2.0.0-alpha.0]
- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
pull/371)) First v2 alpha release!
kspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
pull/371)) First v2 alpha release!
71]\(https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
pull/371)) First v2 alpha release!
kspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
pull/371)) First v2 alpha release!
lpha release!
pull/371)) First v2 alpha release!
7ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
pull/371)) First v2 alpha release!
71]\(https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
pull/371)) First v2 alpha release!
kspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
pull/371)) First v2 alpha release!
lpha release!
pull/371)) First v2 alpha release!
lpha release!
pull/371)) First v2 alpha release!
lpha release!
pull/371)) First v2 alpha release!
lpha release!
pull/371)) First v2 alpha release!
lpha release!
lpha release!
pull/371)) First v2 alpha release!
lpha release!
pull/371)) First v2 alpha release!
lpha release!
pull/371)) First v2 alpha release!
v2 alpha release!
lpha release!
pull/371)) First v2 alpha release!
lpha release!
pull/371)) First v2 alpha release!
lpha release!
pull/371)) First v2 alpha release!
lpha release!
lpha release!
pull/371)) First v2 alpha release!
lpha release!
pull/371)) First v2 alpha release!
lpha release!
pull/371)) First v2 alpha release!
lease!
pull/371)) First v2 alpha release!
+2 -2
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "tauri-plugin-dialog" name = "tauri-plugin-dialog"
version = "2.2.2" version = "2.0.3"
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 }
@@ -34,7 +34,7 @@ tauri = { workspace = true }
log = { workspace = true } log = { workspace = true }
thiserror = { workspace = true } thiserror = { workspace = true }
url = { workspace = true } url = { workspace = true }
tauri-plugin-fs = { path = "../fs", version = "2.3.0" } tauri-plugin-fs = { path = "../fs", version = "2.0.3" }
[target.'cfg(target_os = "ios")'.dependencies] [target.'cfg(target_os = "ios")'.dependencies]
tauri = { workspace = true, features = ["wry"] } tauri = { workspace = true, features = ["wry"] }
+1 -1
View File
@@ -54,7 +54,7 @@ yarn add https://github.com/tauri-apps/tauri-plugin-dialog#v2
First you need to register the core plugin with Tauri: First you need to register the core plugin with Tauri:
`src-tauri/src/lib.rs` `src-tauri/src/main.rs`
```rust ```rust
fn main() { fn main() {
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@tauri-apps/plugin-dialog", "name": "@tauri-apps/plugin-dialog",
"version": "2.2.2", "version": "2.0.1",
"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"
@@ -10,8 +10,6 @@ All dialog types are enabled.
#### This default permission set includes the following:
- `allow-ask` - `allow-ask`
- `allow-confirm` - `allow-confirm`
- `allow-message` - `allow-message`
+14 -25
View File
@@ -49,7 +49,7 @@
"minimum": 1.0 "minimum": 1.0
}, },
"description": { "description": {
"description": "Human-readable description of what the permission does. Tauri convention is to use `<h4>` headings in markdown content for Tauri documentation generation purposes.", "description": "Human-readable description of what the permission does. Tauri convention is to use <h4> headings in markdown content for Tauri documentation generation purposes.",
"type": [ "type": [
"string", "string",
"null" "null"
@@ -111,7 +111,7 @@
"type": "string" "type": "string"
}, },
"description": { "description": {
"description": "Human-readable description of what the permission does. Tauri internal convention is to use `<h4>` headings in markdown content for Tauri documentation generation purposes.", "description": "Human-readable description of what the permission does. Tauri internal convention is to use <h4> headings in markdown content for Tauri documentation generation purposes.",
"type": [ "type": [
"string", "string",
"null" "null"
@@ -297,68 +297,57 @@
{ {
"description": "Enables the ask command without any pre-configured scope.", "description": "Enables the ask command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "allow-ask", "const": "allow-ask"
"markdownDescription": "Enables the ask command without any pre-configured scope."
}, },
{ {
"description": "Denies the ask command without any pre-configured scope.", "description": "Denies the ask command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "deny-ask", "const": "deny-ask"
"markdownDescription": "Denies the ask command without any pre-configured scope."
}, },
{ {
"description": "Enables the confirm command without any pre-configured scope.", "description": "Enables the confirm command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "allow-confirm", "const": "allow-confirm"
"markdownDescription": "Enables the confirm command without any pre-configured scope."
}, },
{ {
"description": "Denies the confirm command without any pre-configured scope.", "description": "Denies the confirm command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "deny-confirm", "const": "deny-confirm"
"markdownDescription": "Denies the confirm command without any pre-configured scope."
}, },
{ {
"description": "Enables the message command without any pre-configured scope.", "description": "Enables the message command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "allow-message", "const": "allow-message"
"markdownDescription": "Enables the message command without any pre-configured scope."
}, },
{ {
"description": "Denies the message command without any pre-configured scope.", "description": "Denies the message command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "deny-message", "const": "deny-message"
"markdownDescription": "Denies the message command without any pre-configured scope."
}, },
{ {
"description": "Enables the open command without any pre-configured scope.", "description": "Enables the open command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "allow-open", "const": "allow-open"
"markdownDescription": "Enables the open command without any pre-configured scope."
}, },
{ {
"description": "Denies the open command without any pre-configured scope.", "description": "Denies the open command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "deny-open", "const": "deny-open"
"markdownDescription": "Denies the open command without any pre-configured scope."
}, },
{ {
"description": "Enables the save command without any pre-configured scope.", "description": "Enables the save command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "allow-save", "const": "allow-save"
"markdownDescription": "Enables the save command without any pre-configured scope."
}, },
{ {
"description": "Denies the save command without any pre-configured scope.", "description": "Denies the save command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "deny-save", "const": "deny-save"
"markdownDescription": "Denies the save command without any pre-configured scope."
}, },
{ {
"description": "This permission set configures the types of dialogs\navailable from the dialog plugin.\n\n#### Granted Permissions\n\nAll dialog types are enabled.\n\n\n\n#### This default permission set includes:\n\n- `allow-ask`\n- `allow-confirm`\n- `allow-message`\n- `allow-save`\n- `allow-open`", "description": "This permission set configures the types of dialogs\navailable from the dialog plugin.\n\n#### Granted Permissions\n\nAll dialog types are enabled.\n\n\n",
"type": "string", "type": "string",
"const": "default", "const": "default"
"markdownDescription": "This permission set configures the types of dialogs\navailable from the dialog plugin.\n\n#### Granted Permissions\n\nAll dialog types are enabled.\n\n\n\n#### This default permission set includes:\n\n- `allow-ask`\n- `allow-confirm`\n- `allow-message`\n- `allow-save`\n- `allow-open`"
} }
] ]
} }
+5 -5
View File
@@ -143,7 +143,7 @@ pub(crate) async fn open<R: Runtime>(
for folder in folders { for folder in folders {
if let Ok(path) = folder.clone().into_path() { if let Ok(path) = folder.clone().into_path() {
if let Some(s) = window.try_fs_scope() { if let Some(s) = window.try_fs_scope() {
s.allow_directory(&path, options.recursive)?; s.allow_directory(&path, options.recursive);
} }
tauri_scope.allow_directory(&path, options.directory)?; tauri_scope.allow_directory(&path, options.directory)?;
} }
@@ -157,7 +157,7 @@ pub(crate) async fn open<R: Runtime>(
if let Some(folder) = &folder { if let Some(folder) = &folder {
if let Ok(path) = folder.clone().into_path() { if let Ok(path) = folder.clone().into_path() {
if let Some(s) = window.try_fs_scope() { if let Some(s) = window.try_fs_scope() {
s.allow_directory(&path, options.recursive)?; s.allow_directory(&path, options.recursive);
} }
tauri_scope.allow_directory(&path, options.directory)?; tauri_scope.allow_directory(&path, options.directory)?;
} }
@@ -175,7 +175,7 @@ pub(crate) async fn open<R: Runtime>(
for file in files { for file in files {
if let Ok(path) = file.clone().into_path() { if let Ok(path) = file.clone().into_path() {
if let Some(s) = window.try_fs_scope() { if let Some(s) = window.try_fs_scope() {
s.allow_file(&path)?; s.allow_file(&path);
} }
tauri_scope.allow_file(&path)?; tauri_scope.allow_file(&path)?;
@@ -190,7 +190,7 @@ pub(crate) async fn open<R: Runtime>(
if let Some(file) = &file { if let Some(file) = &file {
if let Ok(path) = file.clone().into_path() { if let Ok(path) = file.clone().into_path() {
if let Some(s) = window.try_fs_scope() { if let Some(s) = window.try_fs_scope() {
s.allow_file(&path)?; s.allow_file(&path);
} }
tauri_scope.allow_file(&path)?; tauri_scope.allow_file(&path)?;
} }
@@ -232,7 +232,7 @@ pub(crate) async fn save<R: Runtime>(
if let Some(p) = &path { if let Some(p) = &path {
if let Ok(path) = p.clone().into_path() { if let Ok(path) = p.clone().into_path() {
if let Some(s) = window.try_fs_scope() { if let Some(s) = window.try_fs_scope() {
s.allow_file(&path)?; s.allow_file(&path);
} }
tauri_scope.allow_file(&path)?; tauri_scope.allow_file(&path)?;
} }
-5
View File
@@ -39,11 +39,6 @@ use desktop::*;
#[cfg(mobile)] #[cfg(mobile)]
use mobile::*; use mobile::*;
#[cfg(desktop)]
pub use desktop::Dialog;
#[cfg(mobile)]
pub use mobile::Dialog;
pub(crate) const OK: &str = "Ok"; pub(crate) const OK: &str = "Ok";
pub(crate) const CANCEL: &str = "Cancel"; pub(crate) const CANCEL: &str = "Cancel";
pub(crate) const YES: &str = "Yes"; pub(crate) const YES: &str = "Yes";
+30 -24
View File
@@ -1,29 +1,5 @@
# Changelog # Changelog
## \[2.3.0]
- [`dac4d537`](https://github.com/tauri-apps/plugins-workspace/commit/dac4d53724bb3430a00a3f0119857cba32a031e8) ([#2613](https://github.com/tauri-apps/plugins-workspace/pull/2613) by [@Legend-Master](https://github.com/tauri-apps/plugins-workspace/../../Legend-Master)) Reduce the overhead of `watch` and `unwatch`
## \[2.2.1]
### bug
- [`831c35ff`](https://github.com/tauri-apps/plugins-workspace/commit/831c35ff3940e841fe4418bb4cb104038b03304b) ([#2550](https://github.com/tauri-apps/plugins-workspace/pull/2550)) Fix `writeFile` ReadableStream handling due to missing async iterator support on macOS platform
## \[2.2.0]
- [`3a79266b`](https://github.com/tauri-apps/plugins-workspace/commit/3a79266b8cf96a55b1ae6339d725567d45a44b1d) ([#2173](https://github.com/tauri-apps/plugins-workspace/pull/2173) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Bumped all plugins to `v2.2.0`. From now, the versions for the Rust and JavaScript packages of each plugin will be in sync with each other.
## \[2.0.4]
- [`77b85507`](https://github.com/tauri-apps/plugins-workspace/commit/77b855074aad612f2b28e6a3b5881fac767a05ae) ([#2171](https://github.com/tauri-apps/plugins-workspace/pull/2171) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Fixed docs.rs build.
## \[2.0.3]
- [`ed981027`](https://github.com/tauri-apps/plugins-workspace/commit/ed981027dd4fba7d0e2f836eb5db34d344388d73) ([#1962](https://github.com/tauri-apps/plugins-workspace/pull/1962) by [@amrbashir](https://github.com/tauri-apps/plugins-workspace/../../amrbashir)) Improve performance of `readTextFile` and `readTextFileLines` APIs
- [`3e78173d`](https://github.com/tauri-apps/plugins-workspace/commit/3e78173df9ce90aa3b19e1f36d1f8712c5020fb6) ([#2018](https://github.com/tauri-apps/plugins-workspace/pull/2018) by [@amrbashir](https://github.com/tauri-apps/plugins-workspace/../../amrbashir)) Fix `readDir` function failing to read directories that contain broken symlinks.
- [`5092ea5e`](https://github.com/tauri-apps/plugins-workspace/commit/5092ea5e89817c0550d09b0a4ad17bf1253b23df) ([#1964](https://github.com/tauri-apps/plugins-workspace/pull/1964) by [@amrbashir](https://github.com/tauri-apps/plugins-workspace/../../amrbashir)) Add support for using `ReadableStream<Unit8Array>` with `writeFile` API.
## \[2.0.2] ## \[2.0.2]
- [`77149dc4`](https://github.com/tauri-apps/plugins-workspace/commit/77149dc4320d26b413e4a6bbe82c654367c51b32) ([#1965](https://github.com/tauri-apps/plugins-workspace/pull/1965) by [@amrbashir](https://github.com/tauri-apps/plugins-workspace/../../amrbashir)) Fix `writeTextFile` converting UTF-8 characters (for example `äöü`) in the given path into replacement character (``) - [`77149dc4`](https://github.com/tauri-apps/plugins-workspace/commit/77149dc4320d26b413e4a6bbe82c654367c51b32) ([#1965](https://github.com/tauri-apps/plugins-workspace/pull/1965) by [@amrbashir](https://github.com/tauri-apps/plugins-workspace/../../amrbashir)) Fix `writeTextFile` converting UTF-8 characters (for example `äöü`) in the given path into replacement character (``)
@@ -185,3 +161,33 @@
## \[2.0.0-alpha.0] ## \[2.0.0-alpha.0]
- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release! - [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
/pull/454)) Fix `writeBinaryFile` crashing with `command 'write_binary_file' not found`
- [`d74fc0a`](https://github.com/tauri-apps/plugins-workspace/commit/d74fc0a097996e90a37be8f57d50b7d1f6ca616f)([#555](https://github.com/tauri-apps/plugins-workspace/pull/555)) Update to alpha.11.
## \[2.0.0-alpha.0]
- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
ae67\`]\(https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
ac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
s/plugins-workspace/pull/371)) First v2 alpha release!
ac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
kspace/pull/371)) First v2 alpha release!
s/plugins-workspace/pull/371)) First v2 alpha release!
ac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
uri-apps/plugins-workspace/pull/371)) First v2 alpha release!
.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
kspace/pull/371)) First v2 alpha release!
s/plugins-workspace/pull/371)) First v2 alpha release!
ac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
+6 -7
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "tauri-plugin-fs" name = "tauri-plugin-fs"
version = "2.3.0" version = "2.0.3"
description = "Access the file system." description = "Access the file system."
authors = { workspace = true } authors = { workspace = true }
license = { workspace = true } license = { workspace = true }
@@ -14,7 +14,7 @@ rustc-args = ["--cfg", "docsrs"]
rustdoc-args = ["--cfg", "docsrs"] rustdoc-args = ["--cfg", "docsrs"]
[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 = "" }
linux = { level = "full", notes = "No write access to `$RESOURCES` folder" } linux = { level = "full", notes = "No write access to `$RESOURCES` folder" }
macos = { level = "full", notes = "No write access to `$RESOURCES` folder" } macos = { level = "full", notes = "No write access to `$RESOURCES` folder" }
android = { level = "partial", notes = "Access is restricted to Application folder by default" } android = { level = "partial", notes = "Access is restricted to Application folder by default" }
@@ -24,8 +24,6 @@ ios = { level = "partial", notes = "Access is restricted to Application folder b
tauri-plugin = { workspace = true, features = ["build"] } tauri-plugin = { workspace = true, features = ["build"] }
schemars = { workspace = true } schemars = { workspace = true }
serde = { workspace = true } serde = { workspace = true }
toml = "0.8"
tauri-utils = { workspace = true, features = ["build"] }
[dependencies] [dependencies]
serde = { workspace = true } serde = { workspace = true }
@@ -35,13 +33,14 @@ tauri = { workspace = true }
thiserror = { workspace = true } thiserror = { workspace = true }
url = { workspace = true } url = { workspace = true }
anyhow = "1" anyhow = "1"
glob = { workspace = true } uuid = { version = "1", features = ["v4"] }
glob = "0.3"
# TODO: Remove `serialization-compat-6` in v3 # TODO: Remove `serialization-compat-6` in v3
notify = { version = "8", optional = true, features = [ notify = { version = "7", optional = true, features = [
"serde", "serde",
"serialization-compat-6", "serialization-compat-6",
] } ] }
notify-debouncer-full = { version = "0.5", optional = true } notify-debouncer-full = { version = "0.4", optional = true }
dunce = { workspace = true } dunce = { workspace = true }
percent-encoding = "2" percent-encoding = "2"
+3 -3
View File
@@ -54,7 +54,7 @@ yarn add https://github.com/tauri-apps/tauri-plugin-fs#v2
First you need to register the core plugin with Tauri: First you need to register the core plugin with Tauri:
`src-tauri/src/lib.rs` `src-tauri/src/main.rs`
```rust ```rust
fn main() { fn main() {
@@ -68,9 +68,9 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings: Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript ```javascript
import { stat } from '@tauri-apps/plugin-fs' import { metadata } from '@tauri-apps/plugin-fs'
await stat('/path/to/file') await metadata('/path/to/file')
``` ```
## Contributing ## Contributing
File diff suppressed because one or more lines are too long
+32 -99
View File
@@ -7,8 +7,6 @@ use std::{
path::{Path, PathBuf}, path::{Path, PathBuf},
}; };
use tauri_utils::acl::manifest::PermissionFile;
#[path = "src/scope.rs"] #[path = "src/scope.rs"]
#[allow(dead_code)] #[allow(dead_code)]
mod scope; mod scope;
@@ -18,23 +16,10 @@ mod scope;
#[serde(untagged)] #[serde(untagged)]
#[allow(unused)] #[allow(unused)]
enum FsScopeEntry { enum FsScopeEntry {
/// A path that can be accessed by the webview when using the fs APIs. /// FS scope path.
/// FS scope path pattern.
///
/// The pattern can start with a variable that resolves to a system base directory.
/// The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`,
/// `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`,
/// `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$APP`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`,
/// `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.
Value(PathBuf), Value(PathBuf),
Object { Object {
/// A path that can be accessed by the webview when using the fs APIs. /// FS scope path.
///
/// The pattern can start with a variable that resolves to a system base directory.
/// The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`,
/// `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`,
/// `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$APP`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`,
/// `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.
path: PathBuf, path: PathBuf,
}, },
} }
@@ -77,33 +62,31 @@ const BASE_DIR_VARS: &[&str] = &[
"APPCACHE", "APPCACHE",
"APPLOG", "APPLOG",
]; ];
const COMMANDS: &[(&str, &[&str])] = &[ const COMMANDS: &[&str] = &[
("mkdir", &[]), "mkdir",
("create", &[]), "create",
("copy_file", &[]), "copy_file",
("remove", &[]), "remove",
("rename", &[]), "rename",
("truncate", &[]), "truncate",
("ftruncate", &[]), "ftruncate",
("write", &[]), "write",
("write_file", &["open", "write"]), "write_file",
("write_text_file", &[]), "write_text_file",
("read_dir", &[]), "read_dir",
("read_file", &[]), "read_file",
("read", &[]), "read",
("open", &[]), "open",
("read_text_file", &[]), "read_text_file",
("read_text_file_lines", &["read_text_file_lines_next"]), "read_text_file_lines",
("read_text_file_lines_next", &[]), "read_text_file_lines_next",
("seek", &[]), "seek",
("stat", &[]), "stat",
("lstat", &[]), "lstat",
("fstat", &[]), "fstat",
("exists", &[]), "exists",
("watch", &[]), "watch",
// TODO: Remove this in v3 "unwatch",
("unwatch", &[]),
("size", &[]),
]; ];
fn main() { fn main() {
@@ -209,59 +192,9 @@ permissions = [
} }
} }
tauri_plugin::Builder::new( tauri_plugin::Builder::new(COMMANDS)
&COMMANDS .global_api_script_path("./api-iife.js")
.iter() .global_scope_schema(schemars::schema_for!(FsScopeEntry))
// FIXME: https://docs.rs/crate/tauri-plugin-fs/2.1.0/builds/1571296 .android_path("android")
.filter(|c| c.1.is_empty()) .build();
.map(|c| c.0)
.collect::<Vec<_>>(),
)
.global_api_script_path("./api-iife.js")
.global_scope_schema(schemars::schema_for!(FsScopeEntry))
.android_path("android")
.build();
// workaround to include nested permissions as `tauri_plugin` doesn't support it
let permissions_dir = autogenerated.join("commands");
for (command, nested_commands) in COMMANDS {
if nested_commands.is_empty() {
continue;
}
let permission_path = permissions_dir.join(format!("{command}.toml"));
let content = std::fs::read_to_string(&permission_path)
.unwrap_or_else(|_| panic!("failed to read {command}.toml"));
let mut permission_file = toml::from_str::<PermissionFile>(&content)
.unwrap_or_else(|_| panic!("failed to deserialize {command}.toml"));
for p in permission_file
.permission
.iter_mut()
.filter(|p| p.identifier.starts_with("allow"))
{
for c in nested_commands.iter().map(|s| s.to_string()) {
if !p.commands.allow.contains(&c) {
p.commands.allow.push(c);
}
}
}
let out = toml::to_string_pretty(&permission_file)
.unwrap_or_else(|_| panic!("failed to serialize {command}.toml"));
let out = format!(
r#"# Automatically generated - DO NOT EDIT!
"$schema" = "../../schemas/schema.json"
{out}"#
);
if content != out {
std::fs::write(permission_path, out)
.unwrap_or_else(|_| panic!("failed to write {command}.toml"));
}
}
} }
+61 -111
View File
@@ -10,7 +10,7 @@
* This module prevents path traversal, not allowing parent directory accessors to be used * This module prevents path traversal, not allowing parent directory accessors to be used
* (i.e. "/usr/path/to/../file" or "../path/to/file" paths are not allowed). * (i.e. "/usr/path/to/../file" or "../path/to/file" paths are not allowed).
* Paths accessed with this API must be either relative to one of the {@link BaseDirectory | base directories} * Paths accessed with this API must be either relative to one of the {@link BaseDirectory | base directories}
* or created with the {@link https://v2.tauri.app/reference/javascript/api/namespacepath/ | path API}. * or created with the {@link https://v2.tauri.app/reference/javascript/api/namespacepath | path API}.
* *
* The API has a scope configuration that forces you to restrict the paths that can be accessed using glob patterns. * The API has a scope configuration that forces you to restrict the paths that can be accessed using glob patterns.
* *
@@ -266,7 +266,6 @@ function fromBytes(buffer: FixedSizeArray<number, 8>): number {
const size = bytes.byteLength const size = bytes.byteLength
let x = 0 let x = 0
for (let i = 0; i < size; i++) { for (let i = 0; i < size; i++) {
// eslint-disable-next-line security/detect-object-injection
const byte = bytes[i] const byte = bytes[i]
x *= 0x100 x *= 0x100
x += byte x += byte
@@ -428,11 +427,11 @@ class FileHandle extends Resource {
} }
/** /**
* Writes `data.byteLength` bytes from `data` to the underlying data stream. It * Writes `p.byteLength` bytes from `p` to the underlying data stream. It
* resolves to the number of bytes written from `data` (`0` <= `n` <= * resolves to the number of bytes written from `p` (`0` <= `n` <=
* `data.byteLength`) or reject with the error encountered that caused the * `p.byteLength`) or reject with the error encountered that caused the
* write to stop early. `write()` must reject with a non-null error if * write to stop early. `write()` must reject with a non-null error if
* would resolve to `n` < `data.byteLength`. `write()` must not modify the * would resolve to `n` < `p.byteLength`. `write()` must not modify the
* slice data, even temporarily. * slice data, even temporarily.
* *
* @example * @example
@@ -604,8 +603,8 @@ async function copyFile(
options?: CopyFileOptions options?: CopyFileOptions
): Promise<void> { ): Promise<void> {
if ( if (
(fromPath instanceof URL && fromPath.protocol !== 'file:') (fromPath instanceof URL && fromPath.protocol !== 'file:') ||
|| (toPath instanceof URL && toPath.protocol !== 'file:') (toPath instanceof URL && toPath.protocol !== 'file:')
) { ) {
throw new TypeError('Must be a file URL.') throw new TypeError('Must be a file URL.')
} }
@@ -770,14 +769,10 @@ async function readTextFile(
throw new TypeError('Must be a file URL.') throw new TypeError('Must be a file URL.')
} }
const arr = await invoke<ArrayBuffer | number[]>('plugin:fs|read_text_file', { return await invoke<string>('plugin:fs|read_text_file', {
path: path instanceof URL ? path.toString() : path, path: path instanceof URL ? path.toString() : path,
options options
}) })
const bytes = arr instanceof ArrayBuffer ? arr : Uint8Array.from(arr)
return new TextDecoder().decode(bytes)
} }
/** /**
@@ -808,7 +803,6 @@ async function readTextFileLines(
return await Promise.resolve({ return await Promise.resolve({
path: pathStr, path: pathStr,
rid: null as number | null, rid: null as number | null,
async next(): Promise<IteratorResult<string>> { async next(): Promise<IteratorResult<string>> {
if (this.rid === null) { if (this.rid === null) {
this.rid = await invoke<number>('plugin:fs|read_text_file_lines', { this.rid = await invoke<number>('plugin:fs|read_text_file_lines', {
@@ -817,35 +811,19 @@ async function readTextFileLines(
}) })
} }
const arr = await invoke<ArrayBuffer | number[]>( const [line, done] = await invoke<[string | null, boolean]>(
'plugin:fs|read_text_file_lines_next', 'plugin:fs|read_text_file_lines_next',
{ rid: this.rid } { rid: this.rid }
) )
const bytes = // an iteration is over, reset rid for next iteration
arr instanceof ArrayBuffer ? new Uint8Array(arr) : Uint8Array.from(arr) if (done) this.rid = null
// Rust side will never return an empty array for this command and
// ensure there is at least one elements there.
//
// This is an optimization to include whether we finished iteration or not (1 or 0)
// at the end of returned array to avoid serialization overhead of separate values.
const done = bytes[bytes.byteLength - 1] === 1
if (done) {
// a full iteration is over, reset rid for next iteration
this.rid = null
return { value: null, done }
}
const line = new TextDecoder().decode(bytes.slice(0, bytes.byteLength))
return { return {
value: line, value: done ? '' : line!,
done done
} }
}, },
[Symbol.asyncIterator](): AsyncIterableIterator<string> { [Symbol.asyncIterator](): AsyncIterableIterator<string> {
return this return this
} }
@@ -919,8 +897,8 @@ async function rename(
options?: RenameOptions options?: RenameOptions
): Promise<void> { ): Promise<void> {
if ( if (
(oldPath instanceof URL && oldPath.protocol !== 'file:') (oldPath instanceof URL && oldPath.protocol !== 'file:') ||
|| (newPath instanceof URL && newPath.protocol !== 'file:') (newPath instanceof URL && newPath.protocol !== 'file:')
) { ) {
throw new TypeError('Must be a file URL.') throw new TypeError('Must be a file URL.')
} }
@@ -1066,35 +1044,19 @@ interface WriteFileOptions {
*/ */
async function writeFile( async function writeFile(
path: string | URL, path: string | URL,
data: Uint8Array | ReadableStream<Uint8Array>, data: Uint8Array,
options?: WriteFileOptions options?: WriteFileOptions
): Promise<void> { ): Promise<void> {
if (path instanceof URL && path.protocol !== 'file:') { if (path instanceof URL && path.protocol !== 'file:') {
throw new TypeError('Must be a file URL.') throw new TypeError('Must be a file URL.')
} }
if (data instanceof ReadableStream) { await invoke('plugin:fs|write_file', data, {
const file = await open(path, options) headers: {
const reader = data.getReader() path: encodeURIComponent(path instanceof URL ? path.toString() : path),
options: JSON.stringify(options)
try {
while (true) {
const { done, value } = await reader.read()
if (done) break
await file.write(value)
}
} finally {
reader.releaseLock()
await file.close()
} }
} else { })
await invoke('plugin:fs|write_file', data, {
headers: {
path: encodeURIComponent(path instanceof URL ? path.toString() : path),
options: JSON.stringify(options)
}
})
}
} }
/** /**
@@ -1245,19 +1207,31 @@ type WatchEventKindRemove =
| { kind: 'folder' } | { kind: 'folder' }
| { kind: 'other' } | { kind: 'other' }
// TODO: Remove this in v3, return `Watcher` instead
/** /**
* @since 2.0.0 * @since 2.0.0
*/ */
type UnwatchFn = () => void type UnwatchFn = () => void
class Watcher extends Resource {} async function unwatch(rid: number): Promise<void> {
await invoke('plugin:fs|unwatch', { rid })
}
async function watchInternal( /**
* Watch changes (after a delay) on files or directories.
*
* @since 2.0.0
*/
async function watch(
paths: string | string[] | URL | URL[], paths: string | string[] | URL | URL[],
cb: (event: WatchEvent) => void, cb: (event: WatchEvent) => void,
options: DebouncedWatchOptions options?: DebouncedWatchOptions
): Promise<UnwatchFn> { ): Promise<UnwatchFn> {
const opts = {
recursive: false,
delayMs: 2000,
...options
}
const watchPaths = Array.isArray(paths) ? paths : [paths] const watchPaths = Array.isArray(paths) ? paths : [paths]
for (const path of watchPaths) { for (const path of watchPaths) {
@@ -1271,35 +1245,15 @@ async function watchInternal(
const rid: number = await invoke('plugin:fs|watch', { const rid: number = await invoke('plugin:fs|watch', {
paths: watchPaths.map((p) => (p instanceof URL ? p.toString() : p)), paths: watchPaths.map((p) => (p instanceof URL ? p.toString() : p)),
options, options: opts,
onEvent onEvent
}) })
const watcher = new Watcher(rid)
return () => { return () => {
void watcher.close() void unwatch(rid)
} }
} }
// TODO: Return `Watcher` instead in v3
/**
* Watch changes (after a delay) on files or directories.
*
* @since 2.0.0
*/
async function watch(
paths: string | string[] | URL | URL[],
cb: (event: WatchEvent) => void,
options?: DebouncedWatchOptions
): Promise<UnwatchFn> {
return await watchInternal(paths, cb, {
delayMs: 2000,
...options
})
}
// TODO: Return `Watcher` instead in v3
/** /**
* Watch changes on files or directories. * Watch changes on files or directories.
* *
@@ -1310,35 +1264,32 @@ async function watchImmediate(
cb: (event: WatchEvent) => void, cb: (event: WatchEvent) => void,
options?: WatchOptions options?: WatchOptions
): Promise<UnwatchFn> { ): Promise<UnwatchFn> {
return await watchInternal(paths, cb, { const opts = {
recursive: false,
...options, ...options,
delayMs: undefined delayMs: null
})
}
/**
* Get the size of a file or directory. For files, the `stat` functions can be used as well.
*
* If `path` is a directory, this function will recursively iterate over every file and every directory inside of `path` and therefore will be very time consuming if used on larger directories.
*
* @example
* ```typescript
* import { size, BaseDirectory } from '@tauri-apps/plugin-fs';
* // Get the size of the `$APPDATA/tauri` directory.
* const dirSize = await size('tauri', { baseDir: BaseDirectory.AppData });
* console.log(dirSize); // 1024
* ```
*
* @since 2.1.0
*/
async function size(path: string | URL): Promise<number> {
if (path instanceof URL && path.protocol !== 'file:') {
throw new TypeError('Must be a file URL.')
} }
return await invoke('plugin:fs|size', { const watchPaths = Array.isArray(paths) ? paths : [paths]
path: path instanceof URL ? path.toString() : path
for (const path of watchPaths) {
if (path instanceof URL && path.protocol !== 'file:') {
throw new TypeError('Must be a file URL.')
}
}
const onEvent = new Channel<WatchEvent>()
onEvent.onmessage = cb
const rid: number = await invoke('plugin:fs|watch', {
paths: watchPaths.map((p) => (p instanceof URL ? p.toString() : p)),
options: opts,
onEvent
}) })
return () => {
void unwatch(rid)
}
} }
export type { export type {
@@ -1388,6 +1339,5 @@ export {
writeTextFile, writeTextFile,
exists, exists,
watch, watch,
watchImmediate, watchImmediate
size
} }

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