mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-05-01 12:08:06 +02:00
Compare commits
213 Commits
sql-v2.2.0
...
fs-v2.3.0
| Author | SHA1 | Date | |
|---|---|---|---|
| 85635a2807 | |||
| 848e703b78 | |||
| b768b0623b | |||
| 047081c3d5 | |||
| 7cd8c7806e | |||
| 6c9e08dccb | |||
| a6b854032d | |||
| 494d1fea13 | |||
| 4a29dd6cc6 | |||
| fa778d602a | |||
| 323afd1b6d | |||
| 682bb47cda | |||
| 98e268a98f | |||
| 4d10acee61 | |||
| 2448e717e5 | |||
| 91d1521a4c | |||
| dce04b7d72 | |||
| d8e627522c | |||
| 5cb158983c | |||
| dde6f3c31c | |||
| dac4d53724 | |||
| 5e78988f72 | |||
| 4089002880 | |||
| dc84f8d8bb | |||
| ff384cbabe | |||
| 4bb51b3cc8 | |||
| c5b0f51cfd | |||
| 10f9e66e32 | |||
| c97e9c511d | |||
| 60075f0fb6 | |||
| f81e8003c0 | |||
| 686a839c96 | |||
| db7baff3fc | |||
| c9b21f6f43 | |||
| c698e72594 | |||
| 4ec8716155 | |||
| 2445e103f2 | |||
| 4cd625049d | |||
| d88387ace6 | |||
| ba611e4341 | |||
| 60fc35d35c | |||
| 9629c2f4f9 | |||
| d1609913be | |||
| c2fd60ab3f | |||
| 996975ce52 | |||
| 20770a96ae | |||
| efe3f88acd | |||
| 8b39aefb1b | |||
| beab018b21 | |||
| 9cf0390a52 | |||
| 4dd5c51436 | |||
| d2aef2fddb | |||
| 02e886b21a | |||
| d78930cdd4 | |||
| a35fea5015 | |||
| a77b1353e9 | |||
| 6fa388d0b2 | |||
| 2d731f8022 | |||
| 0bc5d58874 | |||
| 517a29a1a1 | |||
| 8ecb418a1a | |||
| 286e3c6252 | |||
| 174b31b8b1 | |||
| 35c1cd9aa5 | |||
| 37c0477afe | |||
| 831c35ff39 | |||
| a9cbefc910 | |||
| 43f0f95da6 | |||
| 38deef43dc | |||
| c245f123ea | |||
| 8c540d54a1 | |||
| 9ebbfb2e3c | |||
| 4bbcdbd556 | |||
| 12c4537b8e | |||
| a15eedf378 | |||
| 5347de8db9 | |||
| d3183aa99d | |||
| 1e9e496b06 | |||
| 1bb1ced538 | |||
| 68eb74353b | |||
| 95e8f909b1 | |||
| 8882dea3b9 | |||
| b40a02c525 | |||
| a1b3fa27f1 | |||
| e54cfcb261 | |||
| 22ba197b80 | |||
| 77520a3587 | |||
| dbc5fe120a | |||
| faefcc9fd8 | |||
| ac60d589ec | |||
| cb38f54f4a | |||
| d37bbdef8d | |||
| 3a750c7300 | |||
| 5c9cf52e75 | |||
| 02df0421d6 | |||
| f7f5bbf259 | |||
| 561cf39f64 | |||
| 024815018f | |||
| e90cd9fab1 | |||
| 1b86af8e26 | |||
| 1dba334f00 | |||
| 54e7864507 | |||
| 45c7848714 | |||
| 393e956728 | |||
| 1a9846599b | |||
| 71f95c9f05 | |||
| 8b3cd9e827 | |||
| 39c022eea2 | |||
| 7527a3465a | |||
| abca2ebc0d | |||
| ddcfad46f9 | |||
| fbd4d28920 | |||
| 0af367f7d4 | |||
| 1ab5f15763 | |||
| c10d5bfb54 | |||
| f6838d507f | |||
| 5b3a1aaf73 | |||
| 3276d65801 | |||
| e0900f0451 | |||
| 4d38066ef9 | |||
| 3b37ce1508 | |||
| 6f881293fc | |||
| 9229f991fe | |||
| b3bf74212e | |||
| c5da9d2579 | |||
| 7a5495963b | |||
| 7d3869ced8 | |||
| fa8c544479 | |||
| 14660b6230 | |||
| 6b4c391738 | |||
| d5d9f7c970 | |||
| 63f9449c9a | |||
| e0cff9bcf4 | |||
| 5411db68a8 | |||
| 80804adc68 | |||
| 93edbd1434 | |||
| 3ebec74983 | |||
| 51f5aff58a | |||
| 5369898db7 | |||
| a7497b0aeb | |||
| aaa88fa45f | |||
| ca7395a5ce | |||
| 6ae853c2e6 | |||
| d5fb5337a0 | |||
| 512a188c7a | |||
| ad17266273 | |||
| 78acfa456f | |||
| 0b3b3a22d2 | |||
| 384b598fcf | |||
| b2fe305a84 | |||
| 68d8f3be38 | |||
| 9ac2aa88e6 | |||
| 18700f1e82 | |||
| 0afc9b6be0 | |||
| bda803fbdd | |||
| 105136494c | |||
| ce11079f19 | |||
| 784a54a390 | |||
| bdb7febf9c | |||
| e76272b619 | |||
| cf0dff049b | |||
| 28f5c33d65 | |||
| 5b82118158 | |||
| 125ec1dbcf | |||
| c545fcf896 | |||
| 0ec895c378 | |||
| 406e6f484c | |||
| b63d724e85 | |||
| c73b773724 | |||
| d467313d0c | |||
| efc7bb19a8 | |||
| c9c13a0fe7 | |||
| da5c59e2fe | |||
| f555d2981d | |||
| 4c7cb96bbd | |||
| 0ad53785ab | |||
| e2203b760f | |||
| b0d9b3b4eb | |||
| 8a5813940c | |||
| ba6d0f1a63 | |||
| a431d63b96 | |||
| 5ab167f419 | |||
| fb67ab2b92 | |||
| ec548035ff | |||
| 6112867735 | |||
| c21eda24a9 | |||
| 05cca602d9 | |||
| 3a826fb6bf | |||
| 86bae64a52 | |||
| 8d4c925a62 | |||
| 6149e70916 | |||
| a9ac1e3c93 | |||
| 3461a7ae2c | |||
| 7a83d4f7e1 | |||
| 1fe70dc61c | |||
| b21915938f | |||
| 57efb47c11 | |||
| c4d50aa9ec | |||
| 768b72acf8 | |||
| 8d6c992661 | |||
| 83b6507269 | |||
| da64d9b665 | |||
| aa2f2bfba0 | |||
| 51919fb26c | |||
| ee0f65de5c | |||
| 319ef556cd | |||
| 802399a969 | |||
| c9acff99c6 | |||
| 18dffc9dfe | |||
| 829b632650 | |||
| 501eae173b | |||
| 3ff5ccd8fb | |||
| eb94dda28a |
@@ -46,7 +46,7 @@ jobs:
|
||||
node-version: 'lts/*'
|
||||
- uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 9.x.x
|
||||
version: 10.x.x
|
||||
run_install: true
|
||||
- name: audit
|
||||
run: pnpm audit
|
||||
|
||||
@@ -8,6 +8,7 @@ on:
|
||||
pull_request:
|
||||
paths:
|
||||
- '.github/workflows/check-generated-files.yml'
|
||||
- pnpm-lock.yaml
|
||||
- '**/guest-js/**'
|
||||
|
||||
concurrency:
|
||||
@@ -27,94 +28,117 @@ jobs:
|
||||
filters: |
|
||||
autostart:
|
||||
- .github/workflows/check-generated-files.yml
|
||||
- pnpm-lock.yaml
|
||||
- plugins/autostart/guest-js/**
|
||||
- plugins/autostart/src/api-iife.js
|
||||
cli:
|
||||
- .github/workflows/check-generated-files.yml
|
||||
- pnpm-lock.yaml
|
||||
- plugins/cli/guest-js/**
|
||||
- plugins/cli/src/api-iife.js
|
||||
clipboard-manager:
|
||||
- .github/workflows/check-generated-files.yml
|
||||
- pnpm-lock.yaml
|
||||
- plugins/clipboard-manager/guest-js/**
|
||||
- plugins/clipboard-manager/src/api-iife.js
|
||||
dialog:
|
||||
- .github/workflows/check-generated-files.yml
|
||||
- pnpm-lock.yaml
|
||||
- plugins/dialog/guest-js/**
|
||||
- plugins/dialog/src/api-iife.js
|
||||
fs:
|
||||
- .github/workflows/check-generated-files.yml
|
||||
- pnpm-lock.yaml
|
||||
- plugins/fs/guest-js/**
|
||||
- plugins/fs/src/api-iife.js
|
||||
geolocation:
|
||||
- .github/workflows/check-generated-files.yml
|
||||
- pnpm-lock.yaml
|
||||
- plugins/geolocation/guest-js/**
|
||||
- plugins/geolocation/src/api-iife.js
|
||||
global-shortcut:
|
||||
- .github/workflows/check-generated-files.yml
|
||||
- pnpm-lock.yaml
|
||||
- plugins/global-shortcut/guest-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:
|
||||
- .github/workflows/check-generated-files.yml
|
||||
- pnpm-lock.yaml
|
||||
- plugins/haptics/guest-js/**
|
||||
- plugins/haptics/src/api-iife.js
|
||||
http:
|
||||
- .github/workflows/check-generated-files.yml
|
||||
- pnpm-lock.yaml
|
||||
- plugins/http/guest-js/**
|
||||
- plugins/http/src/api-iife.js
|
||||
log:
|
||||
- .github/workflows/check-generated-files.yml
|
||||
- pnpm-lock.yaml
|
||||
- plugins/log/guest-js/**
|
||||
- plugins/log/src/api-iife.js
|
||||
notification:
|
||||
- .github/workflows/check-generated-files.yml
|
||||
- pnpm-lock.yaml
|
||||
- plugins/notification/guest-js/**
|
||||
- plugins/notification/src/api-iife.js
|
||||
os:
|
||||
- .github/workflows/check-generated-files.yml
|
||||
- pnpm-lock.yaml
|
||||
- plugins/os/guest-js/**
|
||||
- plugins/os/src/api-iife.js
|
||||
positioner:
|
||||
- .github/workflows/check-generated-files.yml
|
||||
- pnpm-lock.yaml
|
||||
- plugins/positioner/guest-js/**
|
||||
- plugins/positioner/src/api-iife.js
|
||||
process:
|
||||
- .github/workflows/check-generated-files.yml
|
||||
- pnpm-lock.yaml
|
||||
- plugins/process/guest-js/**
|
||||
- plugins/process/src/api-iife.js
|
||||
shell:
|
||||
- .github/workflows/check-generated-files.yml
|
||||
- pnpm-lock.yaml
|
||||
- plugins/shell/guest-js/**
|
||||
- plugins/shell/src/api-iife.js
|
||||
sql:
|
||||
- .github/workflows/check-generated-files.yml
|
||||
- pnpm-lock.yaml
|
||||
- plugins/sql/guest-js/**
|
||||
- plugins/sql/src/api-iife.js
|
||||
store:
|
||||
- .github/workflows/check-generated-files.yml
|
||||
- pnpm-lock.yaml
|
||||
- plugins/store/guest-js/**
|
||||
- plugins/store/src/api-iife.js
|
||||
stronghold:
|
||||
- .github/workflows/check-generated-files.yml
|
||||
- pnpm-lock.yaml
|
||||
- plugins/stronghold/guest-js/**
|
||||
- plugins/stronghold/src/api-iife.js
|
||||
updater:
|
||||
- .github/workflows/check-generated-files.yml
|
||||
- pnpm-lock.yaml
|
||||
- plugins/updater/guest-js/**
|
||||
- plugins/updater/src/api-iife.js
|
||||
upload:
|
||||
- .github/workflows/check-generated-files.yml
|
||||
- pnpm-lock.yaml
|
||||
- plugins/upload/guest-js/**
|
||||
- plugins/upload/src/api-iife.js
|
||||
websocket:
|
||||
- .github/workflows/check-generated-files.yml
|
||||
- pnpm-lock.yaml
|
||||
- plugins/websocket/guest-js/**
|
||||
- plugins/websocket/src/api-iife.js
|
||||
window-state:
|
||||
- .github/workflows/check-generated-files.yml
|
||||
- pnpm-lock.yaml
|
||||
- plugins/window-state/guest-js/**
|
||||
- plugins/window-state/src/api-iife.js
|
||||
|
||||
@@ -143,7 +167,7 @@ jobs:
|
||||
node-version: 'lts/*'
|
||||
- uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 9.x.x
|
||||
version: 10.x.x
|
||||
run_install: true
|
||||
|
||||
- name: build api
|
||||
|
||||
@@ -39,7 +39,7 @@ jobs:
|
||||
|
||||
- uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 9.x.x
|
||||
version: 10.x.x
|
||||
run_install: true
|
||||
|
||||
- name: cargo login
|
||||
@@ -75,7 +75,7 @@ jobs:
|
||||
|
||||
- name: Create Pull Request With Versions Bumped
|
||||
id: cpr
|
||||
uses: tauri-apps/create-pull-request@v3
|
||||
uses: peter-evans/create-pull-request@dd2324fc52d5d43c699a5636bcf19fceaa70c284 # 7.0.7
|
||||
if: steps.covector.outputs.commandRan == 'version'
|
||||
with:
|
||||
title: 'Publish New Versions (${{ github.ref_name }})'
|
||||
|
||||
@@ -38,7 +38,7 @@ jobs:
|
||||
node-version: 'lts/*'
|
||||
- uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 9.x.x
|
||||
version: 10.x.x
|
||||
run_install: true
|
||||
- run: pnpm format:check
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ jobs:
|
||||
node-version: 'lts/*'
|
||||
- uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 9.x.x
|
||||
version: 10.x.x
|
||||
run_install: true
|
||||
- name: eslint
|
||||
run: pnpm lint
|
||||
|
||||
@@ -38,7 +38,7 @@ jobs:
|
||||
|
||||
- uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 9.x.x
|
||||
version: 10.x.x
|
||||
run_install: true
|
||||
|
||||
- name: Build packages
|
||||
|
||||
@@ -14,6 +14,8 @@ target/
|
||||
|
||||
# .vscode workspace settings file
|
||||
.vscode/settings.json
|
||||
.vscode/launch.json
|
||||
.vscode/tasks.json
|
||||
|
||||
# npm, yarn and bun lock files
|
||||
package-lock.json
|
||||
|
||||
+2
-1
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"singleQuote": true,
|
||||
"semi": false,
|
||||
"trailingComma": "none"
|
||||
"trailingComma": "none",
|
||||
"experimentalOperatorPosition": "start"
|
||||
}
|
||||
|
||||
@@ -32,8 +32,8 @@ const ignore = [
|
||||
|
||||
async function checkFile(file) {
|
||||
if (
|
||||
extensions.some((e) => file.endsWith(e)) &&
|
||||
!ignore.some((i) => file.includes(`${path.sep}${i}`))
|
||||
extensions.some((e) => file.endsWith(e))
|
||||
&& !ignore.some((i) => file.includes(`${path.sep}${i}`))
|
||||
) {
|
||||
const fileStream = fs.createReadStream(file)
|
||||
const rl = readline.createInterface({
|
||||
@@ -46,10 +46,10 @@ async function checkFile(file) {
|
||||
for await (let line of rl) {
|
||||
// ignore empty lines, allow shebang, swift-tools-version and bundler license
|
||||
if (
|
||||
line.length === 0 ||
|
||||
line.startsWith('#!') ||
|
||||
line.startsWith('// swift-tools-version:') ||
|
||||
ignoredLicenses.includes(line)
|
||||
line.length === 0
|
||||
|| line.startsWith('#!')
|
||||
|| line.startsWith('// swift-tools-version:')
|
||||
|| ignoredLicenses.includes(line)
|
||||
) {
|
||||
continue
|
||||
}
|
||||
|
||||
+2
-1
@@ -1 +1,2 @@
|
||||
plugins/*/permissions/autogenerated/
|
||||
plugins/*/permissions/autogenerated/
|
||||
plugins/*/android/.tauri/tauri-api/build/
|
||||
|
||||
Generated
+1381
-1271
File diff suppressed because it is too large
Load Diff
+2
-3
@@ -21,10 +21,9 @@ thiserror = "2"
|
||||
url = "2"
|
||||
schemars = "0.8"
|
||||
dunce = "1"
|
||||
specta = "=2.0.0-rc.20"
|
||||
specta = "^2.0.0-rc.16"
|
||||
glob = "0.3"
|
||||
zbus = "4"
|
||||
#tauri-specta = "=2.0.0-rc.11"
|
||||
zbus = "5"
|
||||
|
||||
[workspace.package]
|
||||
edition = "2021"
|
||||
|
||||
@@ -29,7 +29,7 @@ This repo and all plugins require a Rust version of at least **1.77.2**
|
||||
| [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. | ✅ | ✅ | ✅ | ? | ? |
|
||||
| [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. | ✅ | ✅ | ✅ | ✅ | ✅ |
|
||||
| [stronghold](plugins/stronghold) | Encrypted, secure database. | ✅ | ✅ | ✅ | ? | ? |
|
||||
| [updater](plugins/updater) | In-app updates for Tauri applications. | ✅ | ✅ | ✅ | ❌ | ❌ |
|
||||
|
||||
@@ -1,5 +1,126 @@
|
||||
# Changelog
|
||||
|
||||
## \[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
|
||||
|
||||
+28
-28
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "api",
|
||||
"private": true,
|
||||
"version": "2.0.6",
|
||||
"version": "2.0.22",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite --clearScreen false",
|
||||
@@ -10,35 +10,35 @@
|
||||
"tauri": "tauri"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "2.1.1",
|
||||
"@tauri-apps/plugin-barcode-scanner": "2.1.0",
|
||||
"@tauri-apps/plugin-biometric": "2.1.0",
|
||||
"@tauri-apps/plugin-cli": "2.1.0",
|
||||
"@tauri-apps/plugin-clipboard-manager": "2.1.0",
|
||||
"@tauri-apps/plugin-dialog": "2.1.0",
|
||||
"@tauri-apps/plugin-fs": "2.1.0",
|
||||
"@tauri-apps/plugin-geolocation": "2.0.0",
|
||||
"@tauri-apps/plugin-global-shortcut": "2.1.0",
|
||||
"@tauri-apps/plugin-opener": "2.1.0",
|
||||
"@tauri-apps/plugin-haptics": "2.0.0",
|
||||
"@tauri-apps/plugin-http": "2.1.0",
|
||||
"@tauri-apps/plugin-nfc": "2.1.0",
|
||||
"@tauri-apps/plugin-notification": "2.1.0",
|
||||
"@tauri-apps/plugin-os": "2.1.0",
|
||||
"@tauri-apps/plugin-process": "2.1.0",
|
||||
"@tauri-apps/plugin-shell": "2.1.0",
|
||||
"@tauri-apps/plugin-store": "2.2.0",
|
||||
"@tauri-apps/plugin-updater": "2.1.0",
|
||||
"@tauri-apps/api": "2.5.0",
|
||||
"@tauri-apps/plugin-barcode-scanner": "^2.2.0",
|
||||
"@tauri-apps/plugin-biometric": "^2.2.1",
|
||||
"@tauri-apps/plugin-cli": "^2.2.0",
|
||||
"@tauri-apps/plugin-clipboard-manager": "^2.2.2",
|
||||
"@tauri-apps/plugin-dialog": "^2.2.2",
|
||||
"@tauri-apps/plugin-fs": "^2.3.0",
|
||||
"@tauri-apps/plugin-geolocation": "^2.2.0",
|
||||
"@tauri-apps/plugin-global-shortcut": "^2.2.1",
|
||||
"@tauri-apps/plugin-haptics": "^2.2.0",
|
||||
"@tauri-apps/plugin-http": "^2.4.4",
|
||||
"@tauri-apps/plugin-nfc": "^2.2.0",
|
||||
"@tauri-apps/plugin-notification": "^2.2.2",
|
||||
"@tauri-apps/plugin-opener": "^2.2.7",
|
||||
"@tauri-apps/plugin-os": "^2.2.1",
|
||||
"@tauri-apps/plugin-process": "^2.2.1",
|
||||
"@tauri-apps/plugin-shell": "^2.2.1",
|
||||
"@tauri-apps/plugin-store": "^2.2.0",
|
||||
"@tauri-apps/plugin-updater": "^2.7.1",
|
||||
"@zerodevx/svelte-json-view": "1.0.11"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@iconify-json/codicon": "^1.1.37",
|
||||
"@iconify-json/ph": "^1.1.8",
|
||||
"@sveltejs/vite-plugin-svelte": "^5.0.0",
|
||||
"@tauri-apps/cli": "2.1.0",
|
||||
"@unocss/extractor-svelte": "^0.65.0",
|
||||
"svelte": "^5.0.0",
|
||||
"unocss": "^0.65.0",
|
||||
"vite": "^6.0.0"
|
||||
"@iconify-json/codicon": "^1.2.12",
|
||||
"@iconify-json/ph": "^1.2.2",
|
||||
"@sveltejs/vite-plugin-svelte": "^5.0.3",
|
||||
"@tauri-apps/cli": "2.5.0",
|
||||
"@unocss/extractor-svelte": "^66.0.0",
|
||||
"svelte": "^5.20.4",
|
||||
"unocss": "^66.0.0",
|
||||
"vite": "^6.2.6"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,139 @@
|
||||
# Changelog
|
||||
|
||||
## \[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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "api"
|
||||
publish = false
|
||||
version = "2.0.9"
|
||||
version = "2.0.26"
|
||||
description = "An example Tauri Application showcasing the api"
|
||||
edition = "2021"
|
||||
rust-version = { workspace = true }
|
||||
@@ -18,23 +18,25 @@ tauri-build = { workspace = true, features = ["codegen", "isolation"] }
|
||||
serde_json = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
tiny_http = "0.12"
|
||||
time = "0.3"
|
||||
log = { workspace = true }
|
||||
tauri-plugin-log = { path = "../../../plugins/log", version = "2.1.0" }
|
||||
tauri-plugin-fs = { path = "../../../plugins/fs", version = "2.2.0", features = [
|
||||
tauri-plugin-log = { path = "../../../plugins/log", version = "2.4.0" }
|
||||
tauri-plugin-fs = { path = "../../../plugins/fs", version = "2.3.0", features = [
|
||||
"watch",
|
||||
] }
|
||||
tauri-plugin-clipboard-manager = { path = "../../../plugins/clipboard-manager", version = "2.1.0" }
|
||||
tauri-plugin-dialog = { path = "../../../plugins/dialog", version = "2.1.0" }
|
||||
tauri-plugin-clipboard-manager = { path = "../../../plugins/clipboard-manager", version = "2.2.2" }
|
||||
tauri-plugin-dialog = { path = "../../../plugins/dialog", version = "2.2.2" }
|
||||
tauri-plugin-http = { path = "../../../plugins/http", features = [
|
||||
"multipart",
|
||||
], version = "2.1.0" }
|
||||
tauri-plugin-notification = { path = "../../../plugins/notification", version = "2.1.0", features = [
|
||||
"cookies",
|
||||
], version = "2.4.4" }
|
||||
tauri-plugin-notification = { path = "../../../plugins/notification", version = "2.2.2", features = [
|
||||
"windows7-compat",
|
||||
] }
|
||||
tauri-plugin-os = { path = "../../../plugins/os", version = "2.1.0" }
|
||||
tauri-plugin-process = { path = "../../../plugins/process", version = "2.1.0" }
|
||||
tauri-plugin-opener = { path = "../../../plugins/opener", version = "2.1.0" }
|
||||
tauri-plugin-shell = { path = "../../../plugins/shell", version = "2.1.0" }
|
||||
tauri-plugin-os = { path = "../../../plugins/os", version = "2.2.1" }
|
||||
tauri-plugin-process = { path = "../../../plugins/process", version = "2.2.1" }
|
||||
tauri-plugin-opener = { path = "../../../plugins/opener", version = "2.2.7" }
|
||||
tauri-plugin-shell = { path = "../../../plugins/shell", version = "2.2.1" }
|
||||
tauri-plugin-store = { path = "../../../plugins/store", version = "2.2.0" }
|
||||
|
||||
[dependencies.tauri]
|
||||
@@ -51,17 +53,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]
|
||||
tauri-plugin-cli = { path = "../../../plugins/cli", version = "2.1.0" }
|
||||
tauri-plugin-global-shortcut = { path = "../../../plugins/global-shortcut", version = "2.1.0" }
|
||||
tauri-plugin-updater = { path = "../../../plugins/updater", version = "2.2.0" }
|
||||
tauri-plugin-window-state = { path = "../../../plugins/window-state", version = "2.0.0" }
|
||||
tauri-plugin-cli = { path = "../../../plugins/cli", version = "2.2.0" }
|
||||
tauri-plugin-global-shortcut = { path = "../../../plugins/global-shortcut", version = "2.2.1" }
|
||||
tauri-plugin-updater = { path = "../../../plugins/updater", version = "2.7.1" }
|
||||
tauri-plugin-window-state = { path = "../../../plugins/window-state", version = "2.2.0" }
|
||||
|
||||
[target."cfg(any(target_os = \"android\", target_os = \"ios\"))".dependencies]
|
||||
tauri-plugin-barcode-scanner = { path = "../../../plugins/barcode-scanner/", version = "2.1.0" }
|
||||
tauri-plugin-nfc = { path = "../../../plugins/nfc", version = "2.1.0" }
|
||||
tauri-plugin-biometric = { path = "../../../plugins/biometric/", version = "2.1.0" }
|
||||
tauri-plugin-geolocation = { path = "../../../plugins/geolocation/", version = "2.1.0" }
|
||||
tauri-plugin-haptics = { path = "../../../plugins/haptics/", version = "2.1.0" }
|
||||
tauri-plugin-barcode-scanner = { path = "../../../plugins/barcode-scanner/", version = "2.2.0" }
|
||||
tauri-plugin-nfc = { path = "../../../plugins/nfc", version = "2.2.0" }
|
||||
tauri-plugin-biometric = { path = "../../../plugins/biometric/", version = "2.2.1" }
|
||||
tauri-plugin-geolocation = { path = "../../../plugins/geolocation/", version = "2.2.4" }
|
||||
tauri-plugin-haptics = { path = "../../../plugins/haptics/", version = "2.2.4" }
|
||||
|
||||
[features]
|
||||
prod = ["tauri/custom-protocol"]
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"shell:allow-open",
|
||||
"shell:default",
|
||||
"shell:allow-kill",
|
||||
"shell:allow-stdin-write",
|
||||
"process:allow-exit",
|
||||
@@ -69,6 +69,7 @@
|
||||
"fs:allow-mkdir",
|
||||
"fs:allow-remove",
|
||||
"fs:allow-write-text-file",
|
||||
"fs:read-meta",
|
||||
"fs:scope-download-recursive",
|
||||
"fs:scope-resource-recursive",
|
||||
{
|
||||
|
||||
@@ -102,9 +102,28 @@ pub fn run() {
|
||||
if let Ok(mut request) = server.recv() {
|
||||
let mut body = Vec::new();
|
||||
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(
|
||||
tiny_http::StatusCode(200),
|
||||
request.headers().to_vec(),
|
||||
headers,
|
||||
std::io::Cursor::new(body),
|
||||
request.body_length(),
|
||||
None,
|
||||
|
||||
@@ -45,7 +45,7 @@ pub fn create_tray<R: Runtime>(app: &tauri::AppHandle<R>) -> tauri::Result<()> {
|
||||
.tooltip("Tauri")
|
||||
.icon(app.default_window_icon().unwrap().clone())
|
||||
.menu(&menu1)
|
||||
.menu_on_left_click(false)
|
||||
.show_menu_on_left_click(false)
|
||||
.on_menu_event(move |app, event| match event.id.as_ref() {
|
||||
"quit" => {
|
||||
app.exit(0);
|
||||
|
||||
@@ -2,16 +2,18 @@
|
||||
import * as fs from "@tauri-apps/plugin-fs";
|
||||
import { convertFileSrc } from "@tauri-apps/api/core";
|
||||
import { arrayBufferToBase64 } from "../lib/utils";
|
||||
import { onDestroy } from "svelte";
|
||||
|
||||
export let onMessage;
|
||||
export let insecureRenderHtml;
|
||||
|
||||
let path = "";
|
||||
let img;
|
||||
/** @type {fs.FileHandle} */
|
||||
let file;
|
||||
let renameTo;
|
||||
let watchPath = "";
|
||||
let watchDebounceDelay = 0;
|
||||
let watchDebounceDelay = "0";
|
||||
let watchRecursive = false;
|
||||
let unwatchFn;
|
||||
let unwatchPath = "";
|
||||
@@ -118,7 +120,7 @@
|
||||
.getElementById("file-save")
|
||||
.addEventListener("click", function () {
|
||||
fs.writeTextFile(path, fileInput.value, {
|
||||
dir: getDir(),
|
||||
baseDir: getDir(),
|
||||
}).catch(onMessage);
|
||||
});
|
||||
});
|
||||
@@ -170,6 +172,15 @@
|
||||
unwatchFn = undefined;
|
||||
unwatchPath = undefined;
|
||||
}
|
||||
|
||||
onDestroy(() => {
|
||||
if (file) {
|
||||
file.close();
|
||||
}
|
||||
if (unwatchFn) {
|
||||
unwatchFn();
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<div class="flex flex-col">
|
||||
|
||||
@@ -12,10 +12,14 @@
|
||||
isChecking = true
|
||||
try {
|
||||
const update = await check()
|
||||
onMessage(`Should update: ${update.available}`)
|
||||
onMessage(update)
|
||||
if (update) {
|
||||
onMessage(`Should update: ${update.available}`)
|
||||
onMessage(update)
|
||||
|
||||
newUpdate = update
|
||||
newUpdate = update
|
||||
} else {
|
||||
onMessage('No update available')
|
||||
}
|
||||
} catch (e) {
|
||||
onMessage(e)
|
||||
} finally {
|
||||
|
||||
+18
-15
@@ -11,26 +11,29 @@
|
||||
"example:api:dev": "pnpm run --filter \"api\" tauri dev"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "9.16.0",
|
||||
"@rollup/plugin-node-resolve": "15.3.0",
|
||||
"@eslint/js": "9.27.0",
|
||||
"@rollup/plugin-node-resolve": "16.0.1",
|
||||
"@rollup/plugin-terser": "0.4.4",
|
||||
"@rollup/plugin-typescript": "11.1.6",
|
||||
"@types/eslint__js": "8.42.3",
|
||||
"covector": "^0.12.3",
|
||||
"eslint": "9.16.0",
|
||||
"eslint-config-prettier": "9.1.0",
|
||||
"@rollup/plugin-typescript": "12.1.2",
|
||||
"covector": "^0.12.4",
|
||||
"eslint": "9.27.0",
|
||||
"eslint-config-prettier": "10.1.5",
|
||||
"eslint-plugin-security": "3.0.1",
|
||||
"prettier": "3.4.2",
|
||||
"rollup": "4.28.1",
|
||||
"prettier": "3.5.3",
|
||||
"rollup": "4.41.0",
|
||||
"tslib": "2.8.1",
|
||||
"typescript": "5.7.2",
|
||||
"typescript-eslint": "8.17.0"
|
||||
"typescript": "5.8.3",
|
||||
"typescript-eslint": "8.32.1"
|
||||
},
|
||||
"resolutions": {
|
||||
"semver": ">=7.5.2",
|
||||
"optionator": ">=0.9.3"
|
||||
"pnpm": {
|
||||
"overrides": {
|
||||
"esbuild@<0.25.0": ">=0.25.0"
|
||||
},
|
||||
"onlyBuiltDependencies": [
|
||||
"esbuild"
|
||||
]
|
||||
},
|
||||
"engines": {
|
||||
"pnpm": "^9.0.0"
|
||||
"pnpm": "^10.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
# Changelog
|
||||
|
||||
## \[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.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "tauri-plugin-autostart"
|
||||
version = "2.2.0"
|
||||
version = "2.3.0"
|
||||
description = "Automatically launch your application at startup."
|
||||
authors = { workspace = true }
|
||||
license = { workspace = true }
|
||||
|
||||
@@ -57,11 +57,9 @@ First you need to register the core plugin with Tauri:
|
||||
`src-tauri/src/lib.rs`
|
||||
|
||||
```rust
|
||||
use tauri_plugin_autostart::MacosLauncher;
|
||||
|
||||
fn main() {
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_autostart::init(MacosLauncher::LaunchAgent, Some(vec!["--flag1", "--flag2"]) /* arbitrary number of args to pass to your app */))
|
||||
.plugin(tauri_plugin_autostart::Builder::new().args((["--flag1", "--flag2"])).build()))
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@tauri-apps/plugin-autostart",
|
||||
"version": "2.2.0",
|
||||
"version": "2.3.0",
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"authors": [
|
||||
"Tauri Programme within The Commons Conservancy"
|
||||
|
||||
@@ -11,6 +11,8 @@ disable the automatic start on boot.
|
||||
|
||||
|
||||
|
||||
#### This default permission set includes the following:
|
||||
|
||||
- `allow-enable`
|
||||
- `allow-disable`
|
||||
- `allow-is-enabled`
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
"minimum": 1.0
|
||||
},
|
||||
"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": [
|
||||
"string",
|
||||
"null"
|
||||
@@ -111,7 +111,7 @@
|
||||
"type": "string"
|
||||
},
|
||||
"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": [
|
||||
"string",
|
||||
"null"
|
||||
@@ -297,37 +297,44 @@
|
||||
{
|
||||
"description": "Enables the disable command without any pre-configured scope.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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",
|
||||
"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`",
|
||||
"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`"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
+125
-49
@@ -14,7 +14,7 @@ use auto_launch::{AutoLaunch, AutoLaunchBuilder};
|
||||
use serde::{ser::Serializer, Serialize};
|
||||
use tauri::{
|
||||
command,
|
||||
plugin::{Builder, TauriPlugin},
|
||||
plugin::{Builder as PluginBuilder, TauriPlugin},
|
||||
Manager, Runtime, State,
|
||||
};
|
||||
|
||||
@@ -22,8 +22,9 @@ use std::env::current_exe;
|
||||
|
||||
type Result<T> = std::result::Result<T, Error>;
|
||||
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
#[derive(Debug, Default, Copy, Clone)]
|
||||
pub enum MacosLauncher {
|
||||
#[default]
|
||||
LaunchAgent,
|
||||
AppleScript,
|
||||
}
|
||||
@@ -71,10 +72,12 @@ impl AutoLaunchManager {
|
||||
}
|
||||
|
||||
pub trait ManagerExt<R: Runtime> {
|
||||
/// TODO: Rename these to `autostart` or `auto_start` in v3
|
||||
fn autolaunch(&self) -> State<'_, AutoLaunchManager>;
|
||||
}
|
||||
|
||||
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> {
|
||||
self.state::<AutoLaunchManager>()
|
||||
}
|
||||
@@ -95,59 +98,132 @@ async fn is_enabled(manager: State<'_, AutoLaunchManager>) -> Result<bool> {
|
||||
manager.is_enabled()
|
||||
}
|
||||
|
||||
/// Initializes the plugin.
|
||||
///
|
||||
/// `args` - are passed to your app on startup.
|
||||
pub fn init<R: Runtime>(
|
||||
#[derive(Default)]
|
||||
pub struct Builder {
|
||||
#[cfg(target_os = "macos")]
|
||||
macos_launcher: MacosLauncher,
|
||||
args: Option<Vec<&'static str>>,
|
||||
) -> TauriPlugin<R> {
|
||||
Builder::new("autostart")
|
||||
.invoke_handler(tauri::generate_handler![enable, disable, is_enabled])
|
||||
.setup(move |app, _api| {
|
||||
let mut builder = AutoLaunchBuilder::new();
|
||||
builder.set_app_name(&app.package_info().name);
|
||||
if let Some(args) = args {
|
||||
builder.set_args(&args);
|
||||
}
|
||||
builder.set_use_launch_agent(matches!(macos_launcher, MacosLauncher::LaunchAgent));
|
||||
args: Vec<String>,
|
||||
}
|
||||
|
||||
let current_exe = current_exe()?;
|
||||
impl Builder {
|
||||
/// Create a new auto start builder with default settings
|
||||
pub fn new() -> Self {
|
||||
Self::default()
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
builder.set_app_path(¤t_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) {
|
||||
/// 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
|
||||
}
|
||||
|
||||
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();
|
||||
builder.set_app_name(&app.package_info().name);
|
||||
builder.set_args(&self.args);
|
||||
|
||||
let current_exe = current_exe()?;
|
||||
|
||||
#[cfg(windows)]
|
||||
builder.set_app_path(¤t_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(¤t_exe.display().to_string());
|
||||
}
|
||||
builder.set_app_path(&app_path);
|
||||
}
|
||||
|
||||
app.manage(AutoLaunchManager(
|
||||
builder.build().map_err(|e| e.to_string())?,
|
||||
));
|
||||
Ok(())
|
||||
})
|
||||
.build()
|
||||
#[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(¤t_exe.display().to_string());
|
||||
}
|
||||
|
||||
app.manage(AutoLaunchManager(
|
||||
builder.build().map_err(|e| e.to_string())?,
|
||||
));
|
||||
Ok(())
|
||||
})
|
||||
.build()
|
||||
}
|
||||
}
|
||||
|
||||
/// Initializes the plugin.
|
||||
///
|
||||
/// `args` - are passed to your app on startup.
|
||||
pub fn init<R: Runtime>(
|
||||
#[allow(unused)] macos_launcher: MacosLauncher,
|
||||
args: Option<Vec<&'static str>>,
|
||||
) -> TauriPlugin<R> {
|
||||
let mut builder = Builder::new();
|
||||
if let Some(args) = args {
|
||||
builder = builder.args(args)
|
||||
}
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
builder = builder.macos_launcher(macos_launcher);
|
||||
}
|
||||
builder.build()
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@ It allows all barcode related features.
|
||||
|
||||
|
||||
|
||||
#### This default permission set includes the following:
|
||||
|
||||
- `allow-cancel`
|
||||
- `allow-check-permissions`
|
||||
- `allow-open-app-settings`
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
"minimum": 1.0
|
||||
},
|
||||
"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": [
|
||||
"string",
|
||||
"null"
|
||||
@@ -111,7 +111,7 @@
|
||||
"type": "string"
|
||||
},
|
||||
"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": [
|
||||
"string",
|
||||
"null"
|
||||
@@ -297,67 +297,80 @@
|
||||
{
|
||||
"description": "Enables the cancel command without any pre-configured scope.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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",
|
||||
"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`",
|
||||
"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`"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# Changelog
|
||||
|
||||
## \[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.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "tauri-plugin-biometric"
|
||||
version = "2.2.0"
|
||||
version = "2.2.1"
|
||||
description = "Prompt the user for biometric authentication on Android and iOS."
|
||||
edition = { workspace = true }
|
||||
authors = { workspace = true }
|
||||
|
||||
@@ -98,7 +98,12 @@ class BiometricPlugin: Plugin {
|
||||
}
|
||||
|
||||
@objc func authenticate(_ invoke: Invoke) throws {
|
||||
guard self.status.available else {
|
||||
let args = try invoke.parseArgs(AuthOptions.self)
|
||||
|
||||
let allowDeviceCredential = args.allowDeviceCredential ?? false
|
||||
|
||||
guard self.status.available || allowDeviceCredential else {
|
||||
// Biometry unavailable, fallback disabled
|
||||
invoke.reject(
|
||||
self.status.errorReason ?? "",
|
||||
code: self.status.errorCode ?? ""
|
||||
@@ -106,15 +111,11 @@ class BiometricPlugin: Plugin {
|
||||
return
|
||||
}
|
||||
|
||||
let args = try invoke.parseArgs(AuthOptions.self)
|
||||
|
||||
let context = LAContext()
|
||||
context.localizedFallbackTitle = args.fallbackTitle
|
||||
context.localizedCancelTitle = args.cancelTitle
|
||||
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)
|
||||
if allowDeviceCredential,
|
||||
let fallbackTitle = context.localizedFallbackTitle,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@tauri-apps/plugin-biometric",
|
||||
"version": "2.2.0",
|
||||
"version": "2.2.1",
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"authors": [
|
||||
"Tauri Programme within The Commons Conservancy"
|
||||
|
||||
@@ -9,6 +9,8 @@ It allows acccess to all biometric commands.
|
||||
|
||||
|
||||
|
||||
#### This default permission set includes the following:
|
||||
|
||||
- `allow-authenticate`
|
||||
- `allow-status`
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
"minimum": 1.0
|
||||
},
|
||||
"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": [
|
||||
"string",
|
||||
"null"
|
||||
@@ -111,7 +111,7 @@
|
||||
"type": "string"
|
||||
},
|
||||
"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": [
|
||||
"string",
|
||||
"null"
|
||||
@@ -297,27 +297,32 @@
|
||||
{
|
||||
"description": "Enables the authenticate command without any pre-configured scope.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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",
|
||||
"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`",
|
||||
"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`"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
Allows reading the CLI matches
|
||||
|
||||
#### This default permission set includes the following:
|
||||
|
||||
- `allow-cli-matches`
|
||||
|
||||
## Permission Table
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
"minimum": 1.0
|
||||
},
|
||||
"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": [
|
||||
"string",
|
||||
"null"
|
||||
@@ -111,7 +111,7 @@
|
||||
"type": "string"
|
||||
},
|
||||
"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": [
|
||||
"string",
|
||||
"null"
|
||||
@@ -297,17 +297,20 @@
|
||||
{
|
||||
"description": "Enables the cli_matches command without any pre-configured scope.",
|
||||
"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.",
|
||||
"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",
|
||||
"description": "Allows reading the CLI matches\n#### This default permission set includes:\n\n- `allow-cli-matches`",
|
||||
"type": "string",
|
||||
"const": "default"
|
||||
"const": "default",
|
||||
"markdownDescription": "Allows reading the CLI matches\n#### This default permission set includes:\n\n- `allow-cli-matches`"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
# Changelog
|
||||
|
||||
## \[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.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "tauri-plugin-clipboard-manager"
|
||||
version = "2.2.0"
|
||||
version = "2.2.2"
|
||||
description = "Read and write to the system clipboard."
|
||||
edition = { workspace = true }
|
||||
authors = { workspace = true }
|
||||
@@ -36,4 +36,4 @@ thiserror = { workspace = true }
|
||||
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]
|
||||
arboard = "3"
|
||||
arboard = { version = "3", features = ["wayland-data-control"] }
|
||||
|
||||
@@ -72,7 +72,6 @@ import {
|
||||
writeText,
|
||||
readText,
|
||||
writeHtml,
|
||||
readHtml,
|
||||
clear
|
||||
} from '@tauri-apps/plugin-clipboard-manager'
|
||||
await writeText('Tauri is awesome!')
|
||||
|
||||
@@ -1 +1 @@
|
||||
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,altText: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__})}
|
||||
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||!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__})}
|
||||
|
||||
@@ -91,7 +91,7 @@ async function writeImage(
|
||||
* import { readImage } from '@tauri-apps/plugin-clipboard-manager';
|
||||
*
|
||||
* const clipboardImage = await readImage();
|
||||
* const blob = new Blob([await clipboardImage.rbga()], { type: 'image' })
|
||||
* const blob = new Blob([await clipboardImage.rgba()], { type: 'image' })
|
||||
* const url = URL.createObjectURL(blob)
|
||||
* ```
|
||||
* @since 2.0.0
|
||||
@@ -111,9 +111,11 @@ async function readImage(): Promise<Image> {
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* import { writeHtml, readHtml } from '@tauri-apps/plugin-clipboard-manager';
|
||||
* import { writeHtml } from '@tauri-apps/plugin-clipboard-manager';
|
||||
* await writeHtml('<h1>Tauri is awesome!</h1>', 'plaintext');
|
||||
* await writeHtml('<h1>Tauri is awesome!</h1>', '<h1>Tauri is awesome</h1>'); // Will write "<h1>Tauri is awesome</h1>" as plain text
|
||||
* // The following 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>');
|
||||
* ```
|
||||
*
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@tauri-apps/plugin-clipboard-manager",
|
||||
"version": "2.2.0",
|
||||
"version": "2.2.2",
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"authors": [
|
||||
"Tauri Programme within The Commons Conservancy"
|
||||
|
||||
@@ -7,6 +7,8 @@ application specific if read and/or write access is needed.
|
||||
Clipboard interaction needs to be explicitly enabled.
|
||||
|
||||
|
||||
#### This default permission set includes the following:
|
||||
|
||||
|
||||
## Permission Table
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
"minimum": 1.0
|
||||
},
|
||||
"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": [
|
||||
"string",
|
||||
"null"
|
||||
@@ -111,7 +111,7 @@
|
||||
"type": "string"
|
||||
},
|
||||
"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": [
|
||||
"string",
|
||||
"null"
|
||||
@@ -297,67 +297,80 @@
|
||||
{
|
||||
"description": "Enables the clear command without any pre-configured scope.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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",
|
||||
"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"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ pub fn init<R: Runtime, C: DeserializeOwned>(
|
||||
) -> crate::Result<Clipboard<R>> {
|
||||
Ok(Clipboard {
|
||||
app: app.clone(),
|
||||
clipboard: arboard::Clipboard::new().map(Mutex::new),
|
||||
clipboard: arboard::Clipboard::new().map(|c| Mutex::new(Some(c))),
|
||||
})
|
||||
}
|
||||
|
||||
@@ -22,13 +22,21 @@ pub fn init<R: Runtime, C: DeserializeOwned>(
|
||||
pub struct Clipboard<R: Runtime> {
|
||||
#[allow(dead_code)]
|
||||
app: AppHandle<R>,
|
||||
clipboard: Result<Mutex<arboard::Clipboard>, arboard::Error>,
|
||||
// According to arboard docs the clipboard must be dropped before exit.
|
||||
// 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> {
|
||||
pub fn write_text<'a, T: Into<Cow<'a, str>>>(&self, text: T) -> crate::Result<()> {
|
||||
match &self.clipboard {
|
||||
Ok(clipboard) => clipboard.lock().unwrap().set_text(text).map_err(Into::into),
|
||||
Ok(clipboard) => clipboard
|
||||
.lock()
|
||||
.unwrap()
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.set_text(text)
|
||||
.map_err(Into::into),
|
||||
Err(e) => Err(crate::Error::Clipboard(e.to_string())),
|
||||
}
|
||||
}
|
||||
@@ -38,6 +46,8 @@ impl<R: Runtime> Clipboard<R> {
|
||||
Ok(clipboard) => clipboard
|
||||
.lock()
|
||||
.unwrap()
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.set_image(ImageData {
|
||||
bytes: Cow::Borrowed(image.rgba()),
|
||||
width: image.width() as usize,
|
||||
@@ -48,10 +58,11 @@ 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> {
|
||||
match &self.clipboard {
|
||||
Ok(clipboard) => {
|
||||
let text = clipboard.lock().unwrap().get_text()?;
|
||||
let text = clipboard.lock().unwrap().as_mut().unwrap().get_text()?;
|
||||
Ok(text)
|
||||
}
|
||||
Err(e) => Err(crate::Error::Clipboard(e.to_string())),
|
||||
@@ -67,6 +78,8 @@ impl<R: Runtime> Clipboard<R> {
|
||||
Ok(clipboard) => clipboard
|
||||
.lock()
|
||||
.unwrap()
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.set_html(html, alt_text)
|
||||
.map_err(Into::into),
|
||||
Err(e) => Err(crate::Error::Clipboard(e.to_string())),
|
||||
@@ -75,15 +88,22 @@ impl<R: Runtime> Clipboard<R> {
|
||||
|
||||
pub fn clear(&self) -> crate::Result<()> {
|
||||
match &self.clipboard {
|
||||
Ok(clipboard) => clipboard.lock().unwrap().clear().map_err(Into::into),
|
||||
Ok(clipboard) => clipboard
|
||||
.lock()
|
||||
.unwrap()
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.clear()
|
||||
.map_err(Into::into),
|
||||
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<'_>> {
|
||||
match &self.clipboard {
|
||||
Ok(clipboard) => {
|
||||
let image = clipboard.lock().unwrap().get_image()?;
|
||||
let image = clipboard.lock().unwrap().as_mut().unwrap().get_image()?;
|
||||
let image = Image::new_owned(
|
||||
image.bytes.to_vec(),
|
||||
image.width as u32,
|
||||
@@ -94,4 +114,10 @@ impl<R: Runtime> Clipboard<R> {
|
||||
Err(e) => Err(crate::Error::Clipboard(e.to_string())),
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn cleanup(&self) {
|
||||
if let Ok(clipboard) = &self.clipboard {
|
||||
clipboard.lock().unwrap().take();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
use tauri::{
|
||||
plugin::{Builder, TauriPlugin},
|
||||
Manager, Runtime,
|
||||
Manager, RunEvent, Runtime,
|
||||
};
|
||||
|
||||
#[cfg(desktop)]
|
||||
@@ -59,5 +59,11 @@ pub fn init<R: Runtime>() -> TauriPlugin<R> {
|
||||
app.manage(clipboard);
|
||||
Ok(())
|
||||
})
|
||||
.on_event(|_app, _event| {
|
||||
#[cfg(desktop)]
|
||||
if let RunEvent::Exit = _event {
|
||||
_app.clipboard().cleanup();
|
||||
}
|
||||
})
|
||||
.build()
|
||||
}
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
# 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.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "tauri-plugin-deep-link"
|
||||
version = "2.2.0"
|
||||
version = "2.3.0"
|
||||
description = "Set your Tauri application as the default handler for an URL"
|
||||
authors = { workspace = true }
|
||||
license = { workspace = true }
|
||||
@@ -38,8 +38,8 @@ url = { workspace = true }
|
||||
|
||||
[target."cfg(windows)".dependencies]
|
||||
dunce = "1"
|
||||
windows-registry = "0.3"
|
||||
windows-result = "0.2"
|
||||
windows-registry = "0.5"
|
||||
windows-result = "0.3"
|
||||
|
||||
[target."cfg(target_os = \"linux\")".dependencies]
|
||||
rust-ini = "0.21"
|
||||
|
||||
@@ -9,25 +9,50 @@ use config::{AssociatedDomain, Config};
|
||||
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: Do we want to support the other path* configs too?
|
||||
fn intent_filter(domain: &AssociatedDomain) -> String {
|
||||
format!(
|
||||
r#"<intent-filter android:autoVerify="true">
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:scheme="http" />
|
||||
<data android:scheme="https" />
|
||||
{}
|
||||
<data android:host="{}" />
|
||||
{}
|
||||
{}
|
||||
{}
|
||||
{}
|
||||
</intent-filter>"#,
|
||||
domain
|
||||
.scheme
|
||||
.iter()
|
||||
.map(|scheme| format!(r#"<data android:scheme="{scheme}" />"#))
|
||||
.collect::<Vec<_>>()
|
||||
.join("\n "),
|
||||
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
|
||||
.path_prefix
|
||||
.iter()
|
||||
.map(|prefix| format!(r#"<data android:pathPrefix="{prefix}" />"#))
|
||||
.collect::<Vec<_>>()
|
||||
.join("\n ")
|
||||
.join("\n "),
|
||||
domain
|
||||
.path_suffix
|
||||
.iter()
|
||||
.map(|suffix| format!(r#"<data android:pathSuffix="{suffix}" />"#))
|
||||
.collect::<Vec<_>>()
|
||||
.join("\n "),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
# 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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "deep-link-example",
|
||||
"private": true,
|
||||
"version": "2.2.0",
|
||||
"version": "2.2.2",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
@@ -10,12 +10,12 @@
|
||||
"tauri": "tauri"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "2.1.1",
|
||||
"@tauri-apps/plugin-deep-link": "2.1.0"
|
||||
"@tauri-apps/api": "2.5.0",
|
||||
"@tauri-apps/plugin-deep-link": "2.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tauri-apps/cli": "2.1.0",
|
||||
"typescript": "^5.2.2",
|
||||
"vite": "^6.0.0"
|
||||
"@tauri-apps/cli": "2.5.0",
|
||||
"typescript": "^5.7.3",
|
||||
"vite": "^6.2.6"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@tauri-apps/plugin-deep-link",
|
||||
"version": "2.2.0",
|
||||
"version": "2.3.0",
|
||||
"description": "Set your Tauri application as the default handler for an URL",
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"authors": [
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
Allows reading the opened deep link via the get_current command
|
||||
|
||||
#### This default permission set includes the following:
|
||||
|
||||
- `allow-get-current`
|
||||
|
||||
## Permission Table
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
"minimum": 1.0
|
||||
},
|
||||
"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": [
|
||||
"string",
|
||||
"null"
|
||||
@@ -111,7 +111,7 @@
|
||||
"type": "string"
|
||||
},
|
||||
"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": [
|
||||
"string",
|
||||
"null"
|
||||
@@ -297,47 +297,56 @@
|
||||
{
|
||||
"description": "Enables the get_current command without any pre-configured scope.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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",
|
||||
"description": "Allows reading the opened deep link via the get_current command\n#### This default permission set includes:\n\n- `allow-get-current`",
|
||||
"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`"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -9,10 +9,25 @@ use tauri_utils::config::DeepLinkProtocol;
|
||||
|
||||
#[derive(Deserialize, Clone)]
|
||||
pub struct AssociatedDomain {
|
||||
#[serde(default = "default_schemes")]
|
||||
pub scheme: Vec<String>,
|
||||
|
||||
#[serde(deserialize_with = "deserialize_associated_host")]
|
||||
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")]
|
||||
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>
|
||||
|
||||
@@ -114,8 +114,8 @@ mod imp {
|
||||
/// ## Platform-specific:
|
||||
///
|
||||
/// - **Windows / Linux**: This function reads the command line arguments and checks if there's only one value, which must be an URL with scheme matching one of the configured values.
|
||||
/// Note that you must manually check the arguments when registering deep link schemes dynamically with [`Self::register`].
|
||||
/// Additionally, the deep link might have been provided as a CLI argument so you should check if its format matches what you expect.
|
||||
/// 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.
|
||||
pub fn get_current(&self) -> crate::Result<Option<Vec<url::Url>>> {
|
||||
self.plugin_handle
|
||||
.run_mobile_plugin::<GetCurrentResponse>("getCurrent", ())
|
||||
@@ -172,7 +172,7 @@ mod imp {
|
||||
use tauri::Manager;
|
||||
use tauri::{AppHandle, Runtime};
|
||||
#[cfg(windows)]
|
||||
use windows_registry::CURRENT_USER;
|
||||
use windows_registry::{CLASSES_ROOT, CURRENT_USER, LOCAL_MACHINE};
|
||||
|
||||
/// Access to the deep-link APIs.
|
||||
pub struct DeepLink<R: Runtime> {
|
||||
@@ -226,8 +226,8 @@ mod imp {
|
||||
/// ## Platform-specific:
|
||||
///
|
||||
/// - **Windows / Linux**: This function reads the command line arguments and checks if there's only one value, which must be an URL with scheme matching one of the configured values.
|
||||
/// Note that you must manually check the arguments when registering deep link schemes dynamically with [`Self::register`].
|
||||
/// Additionally, the deep link might have been provided as a CLI argument so you should check if its format matches what you expect.
|
||||
/// 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.
|
||||
pub fn get_current(&self) -> crate::Result<Option<Vec<url::Url>>> {
|
||||
return Ok(self.current.lock().unwrap().clone());
|
||||
}
|
||||
@@ -258,25 +258,23 @@ mod imp {
|
||||
pub fn register<S: AsRef<str>>(&self, _protocol: S) -> crate::Result<()> {
|
||||
#[cfg(windows)]
|
||||
{
|
||||
let key_base = format!("Software\\Classes\\{}", _protocol.as_ref());
|
||||
let protocol = _protocol.as_ref();
|
||||
let key_base = format!("Software\\Classes\\{protocol}");
|
||||
|
||||
let exe = dunce::simplified(&tauri::utils::platform::current_exe()?)
|
||||
.display()
|
||||
.to_string();
|
||||
|
||||
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", "")?;
|
||||
|
||||
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"))?;
|
||||
|
||||
cmd_reg.set_string("", &format!("\"{exe}\" \"%1\""))?;
|
||||
cmd_reg.set_string("", format!("\"{exe}\" \"%1\""))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -351,13 +349,21 @@ mod imp {
|
||||
///
|
||||
/// ## 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.
|
||||
/// - **macOS / Android / iOS**: Unsupported, will return [`Error::UnsupportedPlatform`](`crate::Error::UnsupportedPlatform`).
|
||||
pub fn unregister<S: AsRef<str>>(&self, _protocol: S) -> crate::Result<()> {
|
||||
#[cfg(windows)]
|
||||
{
|
||||
CURRENT_USER.remove_tree(format!("Software\\Classes\\{}", _protocol.as_ref()))?;
|
||||
|
||||
let protocol = _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(())
|
||||
}
|
||||
|
||||
@@ -401,10 +407,11 @@ mod imp {
|
||||
pub fn is_registered<S: AsRef<str>>(&self, _protocol: S) -> crate::Result<bool> {
|
||||
#[cfg(windows)]
|
||||
{
|
||||
let cmd_reg = CURRENT_USER.open(format!(
|
||||
"Software\\Classes\\{}\\shell\\open\\command",
|
||||
_protocol.as_ref()
|
||||
))?;
|
||||
let protocol = _protocol.as_ref();
|
||||
let Ok(cmd_reg) = CLASSES_ROOT.open(format!("{protocol}\\shell\\open\\command"))
|
||||
else {
|
||||
return Ok(false);
|
||||
};
|
||||
|
||||
let registered_cmd = cmd_reg.get_string("")?;
|
||||
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
# 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.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "tauri-plugin-dialog"
|
||||
version = "2.2.0"
|
||||
version = "2.2.2"
|
||||
description = "Native system dialogs for opening and saving files along with message dialogs on your Tauri application."
|
||||
edition = { workspace = true }
|
||||
authors = { workspace = true }
|
||||
@@ -34,7 +34,7 @@ tauri = { workspace = true }
|
||||
log = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
url = { workspace = true }
|
||||
tauri-plugin-fs = { path = "../fs", version = "2.2.0" }
|
||||
tauri-plugin-fs = { path = "../fs", version = "2.3.0" }
|
||||
|
||||
[target.'cfg(target_os = "ios")'.dependencies]
|
||||
tauri = { workspace = true, features = ["wry"] }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@tauri-apps/plugin-dialog",
|
||||
"version": "2.2.0",
|
||||
"version": "2.2.2",
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"authors": [
|
||||
"Tauri Programme within The Commons Conservancy"
|
||||
|
||||
@@ -10,6 +10,8 @@ All dialog types are enabled.
|
||||
|
||||
|
||||
|
||||
#### This default permission set includes the following:
|
||||
|
||||
- `allow-ask`
|
||||
- `allow-confirm`
|
||||
- `allow-message`
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
"minimum": 1.0
|
||||
},
|
||||
"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": [
|
||||
"string",
|
||||
"null"
|
||||
@@ -111,7 +111,7 @@
|
||||
"type": "string"
|
||||
},
|
||||
"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": [
|
||||
"string",
|
||||
"null"
|
||||
@@ -297,57 +297,68 @@
|
||||
{
|
||||
"description": "Enables the ask command without any pre-configured scope.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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",
|
||||
"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`",
|
||||
"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`"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
# 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.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "tauri-plugin-fs"
|
||||
version = "2.2.0"
|
||||
version = "2.3.0"
|
||||
description = "Access the file system."
|
||||
authors = { workspace = true }
|
||||
license = { workspace = true }
|
||||
@@ -14,7 +14,7 @@ rustc-args = ["--cfg", "docsrs"]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
|
||||
[package.metadata.platforms.support]
|
||||
windows = { level = "full", notes = "Apps installed via MSI or NSIS in `perMachine` and `both` mode require admin permissions for write acces in `$RESOURCES` folder" }
|
||||
windows = { level = "full", notes = "Apps installed via MSI or NSIS in `perMachine` and `both` mode require admin permissions for write access in `$RESOURCES` folder" }
|
||||
linux = { level = "full", notes = "No write access to `$RESOURCES` folder" }
|
||||
macos = { level = "full", notes = "No write access to `$RESOURCES` folder" }
|
||||
android = { level = "partial", notes = "Access is restricted to Application folder by default" }
|
||||
@@ -35,14 +35,13 @@ tauri = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
url = { workspace = true }
|
||||
anyhow = "1"
|
||||
uuid = { version = "1", features = ["v4"] }
|
||||
glob = { workspace = true }
|
||||
# TODO: Remove `serialization-compat-6` in v3
|
||||
notify = { version = "7", optional = true, features = [
|
||||
notify = { version = "8", optional = true, features = [
|
||||
"serde",
|
||||
"serialization-compat-6",
|
||||
] }
|
||||
notify-debouncer-full = { version = "0.4", optional = true }
|
||||
notify-debouncer-full = { version = "0.5", optional = true }
|
||||
dunce = { workspace = true }
|
||||
percent-encoding = "2"
|
||||
|
||||
|
||||
@@ -68,9 +68,9 @@ fn main() {
|
||||
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
|
||||
|
||||
```javascript
|
||||
import { metadata } from '@tauri-apps/plugin-fs'
|
||||
import { stat } from '@tauri-apps/plugin-fs'
|
||||
|
||||
await metadata('/path/to/file')
|
||||
await stat('/path/to/file')
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -101,6 +101,7 @@ const COMMANDS: &[(&str, &[&str])] = &[
|
||||
("fstat", &[]),
|
||||
("exists", &[]),
|
||||
("watch", &[]),
|
||||
// TODO: Remove this in v3
|
||||
("unwatch", &[]),
|
||||
("size", &[]),
|
||||
];
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
* 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).
|
||||
* 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.
|
||||
*
|
||||
@@ -604,8 +604,8 @@ async function copyFile(
|
||||
options?: CopyFileOptions
|
||||
): Promise<void> {
|
||||
if (
|
||||
(fromPath instanceof URL && fromPath.protocol !== 'file:') ||
|
||||
(toPath instanceof URL && toPath.protocol !== 'file:')
|
||||
(fromPath instanceof URL && fromPath.protocol !== 'file:')
|
||||
|| (toPath instanceof URL && toPath.protocol !== 'file:')
|
||||
) {
|
||||
throw new TypeError('Must be a file URL.')
|
||||
}
|
||||
@@ -919,8 +919,8 @@ async function rename(
|
||||
options?: RenameOptions
|
||||
): Promise<void> {
|
||||
if (
|
||||
(oldPath instanceof URL && oldPath.protocol !== 'file:') ||
|
||||
(newPath instanceof URL && newPath.protocol !== 'file:')
|
||||
(oldPath instanceof URL && oldPath.protocol !== 'file:')
|
||||
|| (newPath instanceof URL && newPath.protocol !== 'file:')
|
||||
) {
|
||||
throw new TypeError('Must be a file URL.')
|
||||
}
|
||||
@@ -1075,10 +1075,18 @@ async function writeFile(
|
||||
|
||||
if (data instanceof ReadableStream) {
|
||||
const file = await open(path, options)
|
||||
for await (const chunk of data) {
|
||||
await file.write(chunk)
|
||||
const reader = data.getReader()
|
||||
|
||||
try {
|
||||
while (true) {
|
||||
const { done, value } = await reader.read()
|
||||
if (done) break
|
||||
await file.write(value)
|
||||
}
|
||||
} finally {
|
||||
reader.releaseLock()
|
||||
await file.close()
|
||||
}
|
||||
await file.close()
|
||||
} else {
|
||||
await invoke('plugin:fs|write_file', data, {
|
||||
headers: {
|
||||
@@ -1237,15 +1245,44 @@ type WatchEventKindRemove =
|
||||
| { kind: 'folder' }
|
||||
| { kind: 'other' }
|
||||
|
||||
// TODO: Remove this in v3, return `Watcher` instead
|
||||
/**
|
||||
* @since 2.0.0
|
||||
*/
|
||||
type UnwatchFn = () => void
|
||||
|
||||
async function unwatch(rid: number): Promise<void> {
|
||||
await invoke('plugin:fs|unwatch', { rid })
|
||||
class Watcher extends Resource {}
|
||||
|
||||
async function watchInternal(
|
||||
paths: string | string[] | URL | URL[],
|
||||
cb: (event: WatchEvent) => void,
|
||||
options: DebouncedWatchOptions
|
||||
): Promise<UnwatchFn> {
|
||||
const watchPaths = Array.isArray(paths) ? paths : [paths]
|
||||
|
||||
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,
|
||||
onEvent
|
||||
})
|
||||
|
||||
const watcher = new Watcher(rid)
|
||||
|
||||
return () => {
|
||||
void watcher.close()
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Return `Watcher` instead in v3
|
||||
/**
|
||||
* Watch changes (after a delay) on files or directories.
|
||||
*
|
||||
@@ -1256,34 +1293,13 @@ async function watch(
|
||||
cb: (event: WatchEvent) => void,
|
||||
options?: DebouncedWatchOptions
|
||||
): Promise<UnwatchFn> {
|
||||
const opts = {
|
||||
recursive: false,
|
||||
return await watchInternal(paths, cb, {
|
||||
delayMs: 2000,
|
||||
...options
|
||||
}
|
||||
|
||||
const watchPaths = Array.isArray(paths) ? paths : [paths]
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Return `Watcher` instead in v3
|
||||
/**
|
||||
* Watch changes on files or directories.
|
||||
*
|
||||
@@ -1294,32 +1310,10 @@ async function watchImmediate(
|
||||
cb: (event: WatchEvent) => void,
|
||||
options?: WatchOptions
|
||||
): Promise<UnwatchFn> {
|
||||
const opts = {
|
||||
recursive: false,
|
||||
return await watchInternal(paths, cb, {
|
||||
...options,
|
||||
delayMs: null
|
||||
}
|
||||
|
||||
const watchPaths = Array.isArray(paths) ? paths : [paths]
|
||||
|
||||
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
|
||||
delayMs: undefined
|
||||
})
|
||||
|
||||
return () => {
|
||||
void unwatch(rid)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@tauri-apps/plugin-fs",
|
||||
"version": "2.2.0",
|
||||
"version": "2.3.0",
|
||||
"description": "Access the file system.",
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"authors": [
|
||||
|
||||
@@ -24,8 +24,8 @@ This default permission set prevents access to critical components
|
||||
of the Tauri application by default.
|
||||
On Windows the webview data folder access is denied.
|
||||
|
||||
#### Included permissions within this default permission set:
|
||||
|
||||
#### This default permission set includes the following:
|
||||
|
||||
- `create-app-specific-dirs`
|
||||
- `read-app-specific-dirs-recursive`
|
||||
|
||||
@@ -25,8 +25,6 @@ the `mkdir` command.
|
||||
This default permission set prevents access to critical components
|
||||
of the Tauri application by default.
|
||||
On Windows the webview data folder access is denied.
|
||||
|
||||
#### Included permissions within this default permission set:
|
||||
"""
|
||||
permissions = [
|
||||
"create-app-specific-dirs",
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -150,11 +150,6 @@ pub fn open<R: Runtime>(
|
||||
Ok(rid)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn close<R: Runtime>(webview: Webview<R>, rid: ResourceId) -> CommandResult<()> {
|
||||
webview.resources_table().close(rid).map_err(Into::into)
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct CopyFileOptions {
|
||||
|
||||
@@ -53,10 +53,7 @@ impl FilePath {
|
||||
#[inline]
|
||||
pub fn into_path(self) -> Result<PathBuf> {
|
||||
match self {
|
||||
Self::Url(url) => url
|
||||
.to_file_path()
|
||||
.map(PathBuf::from)
|
||||
.map_err(|_| Error::InvalidPathUrl),
|
||||
Self::Url(url) => url.to_file_path().map_err(|_| Error::InvalidPathUrl),
|
||||
Self::Path(p) => Ok(p),
|
||||
}
|
||||
}
|
||||
@@ -91,10 +88,7 @@ impl SafeFilePath {
|
||||
#[inline]
|
||||
pub fn into_path(self) -> Result<PathBuf> {
|
||||
match self {
|
||||
Self::Url(url) => url
|
||||
.to_file_path()
|
||||
.map(PathBuf::from)
|
||||
.map_err(|_| Error::InvalidPathUrl),
|
||||
Self::Url(url) => url.to_file_path().map_err(|_| Error::InvalidPathUrl),
|
||||
Self::Path(p) => Ok(p.as_ref().to_owned()),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -397,7 +397,6 @@ pub fn init<R: Runtime>() -> TauriPlugin<R, Option<config::Config>> {
|
||||
commands::create,
|
||||
commands::open,
|
||||
commands::copy_file,
|
||||
commands::close,
|
||||
commands::mkdir,
|
||||
commands::read_dir,
|
||||
commands::read,
|
||||
@@ -420,8 +419,6 @@ pub fn init<R: Runtime>() -> TauriPlugin<R, Option<config::Config>> {
|
||||
commands::size,
|
||||
#[cfg(feature = "watch")]
|
||||
watcher::watch,
|
||||
#[cfg(feature = "watch")]
|
||||
watcher::unwatch
|
||||
])
|
||||
.setup(|app, api| {
|
||||
let scope = Scope {
|
||||
|
||||
+43
-98
@@ -2,8 +2,8 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
use notify::{Config, Event, RecommendedWatcher, RecursiveMode, Watcher};
|
||||
use notify_debouncer_full::{new_debouncer, DebounceEventResult, Debouncer, RecommendedCache};
|
||||
use notify::{Config, RecommendedWatcher, RecursiveMode, Watcher};
|
||||
use notify_debouncer_full::{new_debouncer, DebouncedEvent, Debouncer, RecommendedCache};
|
||||
use serde::Deserialize;
|
||||
use tauri::{
|
||||
ipc::{Channel, CommandScope, GlobalScope},
|
||||
@@ -11,15 +11,7 @@ use tauri::{
|
||||
Manager, Resource, ResourceId, Runtime, Webview,
|
||||
};
|
||||
|
||||
use std::{
|
||||
path::PathBuf,
|
||||
sync::{
|
||||
mpsc::{channel, Receiver},
|
||||
Mutex,
|
||||
},
|
||||
thread::spawn,
|
||||
time::Duration,
|
||||
};
|
||||
use std::time::Duration;
|
||||
|
||||
use crate::{
|
||||
commands::{resolve_path, CommandResult},
|
||||
@@ -27,79 +19,44 @@ use crate::{
|
||||
SafeFilePath,
|
||||
};
|
||||
|
||||
struct InnerWatcher {
|
||||
pub kind: WatcherKind,
|
||||
paths: Vec<PathBuf>,
|
||||
}
|
||||
|
||||
pub struct WatcherResource(Mutex<InnerWatcher>);
|
||||
impl WatcherResource {
|
||||
fn new(kind: WatcherKind, paths: Vec<PathBuf>) -> Self {
|
||||
Self(Mutex::new(InnerWatcher { kind, paths }))
|
||||
}
|
||||
|
||||
fn with_lock<R, F: FnMut(&mut InnerWatcher) -> R>(&self, mut f: F) -> R {
|
||||
let mut watcher = self.0.lock().unwrap();
|
||||
f(&mut watcher)
|
||||
}
|
||||
}
|
||||
|
||||
impl Resource for WatcherResource {}
|
||||
|
||||
#[allow(unused)]
|
||||
enum WatcherKind {
|
||||
Debouncer(Debouncer<RecommendedWatcher, RecommendedCache>),
|
||||
Watcher(RecommendedWatcher),
|
||||
}
|
||||
|
||||
fn watch_raw(on_event: Channel<Event>, rx: Receiver<notify::Result<Event>>) {
|
||||
spawn(move || {
|
||||
while let Ok(event) = rx.recv() {
|
||||
if let Ok(event) = event {
|
||||
// TODO: Should errors be emitted too?
|
||||
let _ = on_event.send(event);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
fn watch_debounced(on_event: Channel<Event>, rx: Receiver<DebounceEventResult>) {
|
||||
spawn(move || {
|
||||
while let Ok(Ok(events)) = rx.recv() {
|
||||
for event in events {
|
||||
// TODO: Should errors be emitted too?
|
||||
let _ = on_event.send(event.event);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
impl Resource for WatcherKind {}
|
||||
|
||||
#[derive(Clone, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct WatchOptions {
|
||||
base_dir: Option<BaseDirectory>,
|
||||
#[serde(default)]
|
||||
recursive: bool,
|
||||
delay_ms: Option<u64>,
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn watch<R: Runtime>(
|
||||
pub fn watch<R: Runtime>(
|
||||
webview: Webview<R>,
|
||||
paths: Vec<SafeFilePath>,
|
||||
options: WatchOptions,
|
||||
on_event: Channel<Event>,
|
||||
on_event: Channel<notify::Event>,
|
||||
global_scope: GlobalScope<Entry>,
|
||||
command_scope: CommandScope<Entry>,
|
||||
) -> CommandResult<ResourceId> {
|
||||
let mut resolved_paths = Vec::with_capacity(paths.capacity());
|
||||
for path in paths {
|
||||
resolved_paths.push(resolve_path(
|
||||
&webview,
|
||||
&global_scope,
|
||||
&command_scope,
|
||||
path,
|
||||
options.base_dir,
|
||||
)?);
|
||||
}
|
||||
let resolved_paths = paths
|
||||
.into_iter()
|
||||
.map(|path| {
|
||||
resolve_path(
|
||||
&webview,
|
||||
&global_scope,
|
||||
&command_scope,
|
||||
path,
|
||||
options.base_dir,
|
||||
)
|
||||
})
|
||||
.collect::<CommandResult<Vec<_>>>()?;
|
||||
|
||||
let recursive_mode = if options.recursive {
|
||||
RecursiveMode::Recursive
|
||||
@@ -107,52 +64,40 @@ pub async fn watch<R: Runtime>(
|
||||
RecursiveMode::NonRecursive
|
||||
};
|
||||
|
||||
let kind = if let Some(delay) = options.delay_ms {
|
||||
let (tx, rx) = channel();
|
||||
let mut debouncer = new_debouncer(Duration::from_millis(delay), None, tx)?;
|
||||
let watcher_kind = if let Some(delay) = options.delay_ms {
|
||||
let mut debouncer = new_debouncer(
|
||||
Duration::from_millis(delay),
|
||||
None,
|
||||
move |events: Result<Vec<DebouncedEvent>, Vec<notify::Error>>| {
|
||||
if let Ok(events) = events {
|
||||
for event in events {
|
||||
// TODO: Should errors be emitted too?
|
||||
let _ = on_event.send(event.event);
|
||||
}
|
||||
}
|
||||
},
|
||||
)?;
|
||||
for path in &resolved_paths {
|
||||
debouncer.watch(path, recursive_mode)?;
|
||||
}
|
||||
watch_debounced(on_event, rx);
|
||||
WatcherKind::Debouncer(debouncer)
|
||||
} else {
|
||||
let (tx, rx) = channel();
|
||||
let mut watcher = RecommendedWatcher::new(tx, Config::default())?;
|
||||
let mut watcher = RecommendedWatcher::new(
|
||||
move |event| {
|
||||
if let Ok(event) = event {
|
||||
// TODO: Should errors be emitted too?
|
||||
let _ = on_event.send(event);
|
||||
}
|
||||
},
|
||||
Config::default(),
|
||||
)?;
|
||||
for path in &resolved_paths {
|
||||
watcher.watch(path, recursive_mode)?;
|
||||
}
|
||||
watch_raw(on_event, rx);
|
||||
WatcherKind::Watcher(watcher)
|
||||
};
|
||||
|
||||
let rid = webview
|
||||
.resources_table()
|
||||
.add(WatcherResource::new(kind, resolved_paths));
|
||||
let rid = webview.resources_table().add(watcher_kind);
|
||||
|
||||
Ok(rid)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn unwatch<R: Runtime>(webview: Webview<R>, rid: ResourceId) -> CommandResult<()> {
|
||||
let watcher = webview.resources_table().take::<WatcherResource>(rid)?;
|
||||
WatcherResource::with_lock(&watcher, |watcher| {
|
||||
match &mut watcher.kind {
|
||||
WatcherKind::Debouncer(ref mut debouncer) => {
|
||||
for path in &watcher.paths {
|
||||
debouncer.unwatch(path).map_err(|e| {
|
||||
format!("failed to unwatch path: {} with error: {e}", path.display())
|
||||
})?;
|
||||
}
|
||||
}
|
||||
WatcherKind::Watcher(ref mut w) => {
|
||||
for path in &watcher.paths {
|
||||
w.unwatch(path).map_err(|e| {
|
||||
format!("failed to unwatch path: {} with error: {e}", path.display())
|
||||
})?;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,5 +1,22 @@
|
||||
# Changelog
|
||||
|
||||
## \[2.2.4]
|
||||
|
||||
- [`a1b3fa27`](https://github.com/tauri-apps/plugins-workspace/commit/a1b3fa27f11022c9b6622b4fab12d93239eb05de) ([#2515](https://github.com/tauri-apps/plugins-workspace/pull/2515) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Re-exported the `Geolocation`, `Haptics`, `Notification`, and `Os` structs so that they show up on docs.rs.
|
||||
|
||||
## \[2.2.3]
|
||||
|
||||
- [`406e6f48`](https://github.com/tauri-apps/plugins-workspace/commit/406e6f484cdc13d35c50fb949f7489ca9eeccc44) ([#2323](https://github.com/tauri-apps/plugins-workspace/pull/2323) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Fixed an issue that caused build failures when the `haptics` or `geolocation` plugin was used without their `specta` feature flag enabled.
|
||||
|
||||
## \[2.2.2]
|
||||
|
||||
- [`c9c13a0f`](https://github.com/tauri-apps/plugins-workspace/commit/c9c13a0fe7cdaac223843f5ba33176252f8e22f5) ([#2316](https://github.com/tauri-apps/plugins-workspace/pull/2316) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) **Breaking change:** `specta` integration is now behind a `specta` feature flag like in Tauri.
|
||||
- [`c9c13a0f`](https://github.com/tauri-apps/plugins-workspace/commit/c9c13a0fe7cdaac223843f5ba33176252f8e22f5) ([#2316](https://github.com/tauri-apps/plugins-workspace/pull/2316) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Unlock and widen `specta` version range to match Tauri. No API changes.
|
||||
|
||||
## \[2.2.1]
|
||||
|
||||
- [`fb67ab2b`](https://github.com/tauri-apps/plugins-workspace/commit/fb67ab2b926502bfc20d6b43fbdd156691ea8526) ([#2281](https://github.com/tauri-apps/plugins-workspace/pull/2281) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Added `specta-util` to fix a "dependency not found" compilation error.
|
||||
|
||||
## \[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.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "tauri-plugin-geolocation"
|
||||
description = "Get and track the device's current position"
|
||||
version = "2.2.0"
|
||||
version = "2.2.4"
|
||||
edition = { workspace = true }
|
||||
authors = { workspace = true }
|
||||
license = { workspace = true }
|
||||
@@ -26,10 +26,13 @@ tauri-plugin = { workspace = true, features = ["build"] }
|
||||
[dependencies]
|
||||
serde = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
tauri = { workspace = true, features = ["specta"] }
|
||||
tauri = { workspace = true }
|
||||
log = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
specta = { workspace = true }
|
||||
specta = { workspace = true, optional = true }
|
||||
|
||||
[target.'cfg(target_os = "ios")'.dependencies]
|
||||
tauri = { workspace = true, features = ["wry"] }
|
||||
|
||||
[features]
|
||||
specta = ["dep:specta", "tauri/specta"]
|
||||
|
||||
@@ -118,8 +118,8 @@ import {
|
||||
|
||||
let permissions = await checkPermissions()
|
||||
if (
|
||||
permissions.location === 'prompt' ||
|
||||
permissions.location === 'prompt-with-rationale'
|
||||
permissions.location === 'prompt'
|
||||
|| permissions.location === 'prompt-with-rationale'
|
||||
) {
|
||||
permissions = await requestPermissions(['location'])
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
if("__TAURI__"in window){var __TAURI_PLUGIN_GEOLOCATION__=function(t){"use strict";function e(t,e,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(t):i?i.value:e.get(t)}function n(t,e,n,i,o){if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,n),n}var i,o,s;"function"==typeof SuppressedError&&SuppressedError;const r="__TAURI_TO_IPC_KEY__";class a{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,i.set(this,(()=>{})),o.set(this,0),s.set(this,{}),this.id=function(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}((({message:t,id:r})=>{if(r===e(this,o,"f")){n(this,o,r+1),e(this,i,"f").call(this,t);const a=Object.keys(e(this,s,"f"));if(a.length>0){let t=r+1;for(const n of a.sort()){if(parseInt(n)!==t)break;{const o=e(this,s,"f")[n];delete e(this,s,"f")[n],e(this,i,"f").call(this,o),t+=1}}n(this,o,t)}}else e(this,s,"f")[r.toString()]=t}))}set onmessage(t){n(this,i,t)}get onmessage(){return e(this,i,"f")}[(i=new WeakMap,o=new WeakMap,s=new WeakMap,r)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[r]()}}async function c(t,e={},n){return window.__TAURI_INTERNALS__.invoke(t,e,n)}return t.checkPermissions=async function(){return await async function(t){return c(`plugin:${t}|check_permissions`)}("geolocation")},t.clearWatch=async function(t){await c("plugin:geolocation|clear_watch",{channelId:t})},t.getCurrentPosition=async function(t){return await c("plugin:geolocation|get_current_position",{options:t})},t.requestPermissions=async function(t){return await c("plugin:geolocation|request_permissions",{permissions:t})},t.watchPosition=async function(t,e){const n=new a;return n.onmessage=t=>{"string"==typeof t?e(null,t):e(t)},await c("plugin:geolocation|watch_position",{options:t,channel:n}),n.id},t}({});Object.defineProperty(window.__TAURI__,"geolocation",{value:__TAURI_PLUGIN_GEOLOCATION__})}
|
||||
if("__TAURI__"in window){var __TAURI_PLUGIN_GEOLOCATION__=function(t){"use strict";function n(t,n,e,i){if("function"==typeof n||!n.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===e?i:"a"===e?i.call(t):i?i.value:n.get(t)}function e(t,n,e,i,s){if("function"==typeof n||!n.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n.set(t,e),e}var i,s,o,r;"function"==typeof SuppressedError&&SuppressedError;const a="__TAURI_TO_IPC_KEY__";class c{constructor(t){i.set(this,void 0),s.set(this,0),o.set(this,[]),r.set(this,void 0),e(this,i,t||(()=>{})),this.id=function(t,n=!1){return window.__TAURI_INTERNALS__.transformCallback(t,n)}((t=>{const a=t.index;if("end"in t)return void(a==n(this,s,"f")?this.cleanupCallback():e(this,r,a));const c=t.message;if(a==n(this,s,"f")){for(n(this,i,"f").call(this,c),e(this,s,n(this,s,"f")+1);n(this,s,"f")in n(this,o,"f");){const t=n(this,o,"f")[n(this,s,"f")];n(this,i,"f").call(this,t),delete n(this,o,"f")[n(this,s,"f")],e(this,s,n(this,s,"f")+1)}n(this,s,"f")===n(this,r,"f")&&this.cleanupCallback()}else n(this,o,"f")[a]=c}))}cleanupCallback(){Reflect.deleteProperty(window,`_${this.id}`)}set onmessage(t){e(this,i,t)}get onmessage(){return n(this,i,"f")}[(i=new WeakMap,s=new WeakMap,o=new WeakMap,r=new WeakMap,a)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[a]()}}async function _(t,n={},e){return window.__TAURI_INTERNALS__.invoke(t,n,e)}return t.checkPermissions=async function(){return await async function(t){return _(`plugin:${t}|check_permissions`)}("geolocation")},t.clearWatch=async function(t){await _("plugin:geolocation|clear_watch",{channelId:t})},t.getCurrentPosition=async function(t){return await _("plugin:geolocation|get_current_position",{options:t})},t.requestPermissions=async function(t){return await _("plugin:geolocation|request_permissions",{permissions:t})},t.watchPosition=async function(t,n){const e=new c;return e.onmessage=t=>{"string"==typeof t?n(null,t):n(t)},await _("plugin:geolocation|watch_position",{options:t,channel:e}),e.id},t}({});Object.defineProperty(window.__TAURI__,"geolocation",{value:__TAURI_PLUGIN_GEOLOCATION__})}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@tauri-apps/plugin-geolocation",
|
||||
"version": "2.2.0",
|
||||
"version": "2.2.4",
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"authors": [
|
||||
"Tauri Programme within The Commons Conservancy"
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
"minimum": 1.0
|
||||
},
|
||||
"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": [
|
||||
"string",
|
||||
"null"
|
||||
@@ -111,7 +111,7 @@
|
||||
"type": "string"
|
||||
},
|
||||
"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": [
|
||||
"string",
|
||||
"null"
|
||||
@@ -297,62 +297,74 @@
|
||||
{
|
||||
"description": "Enables the check_permissions command without any pre-configured scope.",
|
||||
"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.",
|
||||
"type": "string",
|
||||
"const": "deny-check-permissions"
|
||||
"const": "deny-check-permissions",
|
||||
"markdownDescription": "Denies the check_permissions command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the clear_permissions command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "allow-clear-permissions"
|
||||
"const": "allow-clear-permissions",
|
||||
"markdownDescription": "Enables the clear_permissions command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the clear_permissions command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "deny-clear-permissions"
|
||||
"const": "deny-clear-permissions",
|
||||
"markdownDescription": "Denies the clear_permissions command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the clear_watch command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "allow-clear-watch"
|
||||
"const": "allow-clear-watch",
|
||||
"markdownDescription": "Enables the clear_watch command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the clear_watch command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "deny-clear-watch"
|
||||
"const": "deny-clear-watch",
|
||||
"markdownDescription": "Denies the clear_watch command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the get_current_position command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "allow-get-current-position"
|
||||
"const": "allow-get-current-position",
|
||||
"markdownDescription": "Enables the get_current_position command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the get_current_position command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "deny-get-current-position"
|
||||
"const": "deny-get-current-position",
|
||||
"markdownDescription": "Denies the get_current_position command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the request_permissions command without any pre-configured scope.",
|
||||
"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.",
|
||||
"type": "string",
|
||||
"const": "deny-request-permissions"
|
||||
"const": "deny-request-permissions",
|
||||
"markdownDescription": "Denies the request_permissions command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the watch_position command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "allow-watch-position"
|
||||
"const": "allow-watch-position",
|
||||
"markdownDescription": "Enables the watch_position command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the watch_position command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "deny-watch-position"
|
||||
"const": "deny-watch-position",
|
||||
"markdownDescription": "Denies the watch_position command without any pre-configured scope."
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ use tauri::{command, ipc::Channel, AppHandle, Runtime};
|
||||
use crate::{GeolocationExt, PermissionStatus, PermissionType, Position, PositionOptions, Result};
|
||||
|
||||
#[command]
|
||||
#[specta::specta]
|
||||
pub(crate) async fn get_current_position<R: Runtime>(
|
||||
app: AppHandle<R>,
|
||||
options: Option<PositionOptions>,
|
||||
@@ -16,7 +15,6 @@ pub(crate) async fn get_current_position<R: Runtime>(
|
||||
}
|
||||
|
||||
#[command]
|
||||
#[specta::specta]
|
||||
pub(crate) async fn watch_position<R: Runtime>(
|
||||
app: AppHandle<R>,
|
||||
options: PositionOptions,
|
||||
@@ -26,19 +24,16 @@ pub(crate) async fn watch_position<R: Runtime>(
|
||||
}
|
||||
|
||||
#[command]
|
||||
#[specta::specta]
|
||||
pub(crate) async fn clear_watch<R: Runtime>(app: AppHandle<R>, channel_id: u32) -> Result<()> {
|
||||
app.geolocation().clear_watch(channel_id)
|
||||
}
|
||||
|
||||
#[command]
|
||||
#[specta::specta]
|
||||
pub(crate) async fn check_permissions<R: Runtime>(app: AppHandle<R>) -> Result<PermissionStatus> {
|
||||
app.geolocation().check_permissions()
|
||||
}
|
||||
|
||||
#[command]
|
||||
#[specta::specta]
|
||||
pub(crate) async fn request_permissions<R: Runtime>(
|
||||
app: AppHandle<R>,
|
||||
permissions: Option<Vec<PermissionType>>,
|
||||
|
||||
@@ -3,18 +3,18 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
use serde::{ser::Serializer, Serialize};
|
||||
use specta::Type;
|
||||
|
||||
pub type Result<T> = std::result::Result<T, Error>;
|
||||
|
||||
// TODO: Improve Error handling (different typed errors instead of one (stringified) PluginInvokeError for all mobile errors)
|
||||
|
||||
#[derive(Debug, thiserror::Error, Type)]
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
#[cfg_attr(feature = "specta", derive(specta::Type))]
|
||||
pub enum Error {
|
||||
#[cfg(mobile)]
|
||||
#[error(transparent)]
|
||||
PluginInvoke(
|
||||
#[serde(skip)]
|
||||
#[cfg_attr(feature = "specta", serde(skip))]
|
||||
#[from]
|
||||
tauri::plugin::mobile::PluginInvokeError,
|
||||
),
|
||||
|
||||
@@ -7,8 +7,6 @@ use tauri::{
|
||||
Manager, Runtime,
|
||||
};
|
||||
|
||||
//use tauri_specta::*;
|
||||
|
||||
pub use models::*;
|
||||
|
||||
#[cfg(desktop)]
|
||||
@@ -23,27 +21,9 @@ mod models;
|
||||
pub use error::{Error, Result};
|
||||
|
||||
#[cfg(desktop)]
|
||||
use desktop::Geolocation;
|
||||
pub use desktop::Geolocation;
|
||||
#[cfg(mobile)]
|
||||
use mobile::Geolocation;
|
||||
|
||||
/* macro_rules! specta_builder {
|
||||
() => {
|
||||
ts::builder()
|
||||
.commands(collect_commands![
|
||||
commands::get_current_position,
|
||||
commands::watch_position,
|
||||
commands::clear_watch,
|
||||
commands::check_permissions,
|
||||
commands::request_permissions
|
||||
])
|
||||
.header("// @ts-nocheck")
|
||||
.config(
|
||||
specta::ts::ExportConfig::default()
|
||||
.bigint(specta::ts::BigIntExportBehavior::Number),
|
||||
)
|
||||
};
|
||||
} */
|
||||
pub use mobile::Geolocation;
|
||||
|
||||
/// Extensions to [`tauri::App`], [`tauri::AppHandle`], [`tauri::WebviewWindow`], [`tauri::Webview`] and [`tauri::Window`] to access the geolocation APIs.
|
||||
pub trait GeolocationExt<R: Runtime> {
|
||||
@@ -58,9 +38,6 @@ impl<R: Runtime, T: Manager<R>> crate::GeolocationExt<R> for T {
|
||||
|
||||
/// Initializes the plugin.
|
||||
pub fn init<R: Runtime>() -> TauriPlugin<R> {
|
||||
/* let (invoke_handler, register_events) =
|
||||
specta_builder!().build_plugin_utils("geolocation").unwrap(); */
|
||||
|
||||
Builder::new("geolocation")
|
||||
.invoke_handler(tauri::generate_handler![
|
||||
commands::get_current_position,
|
||||
@@ -79,22 +56,3 @@ pub fn init<R: Runtime>() -> TauriPlugin<R> {
|
||||
})
|
||||
.build()
|
||||
}
|
||||
|
||||
/* #[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn export_types() {
|
||||
specta_builder!()
|
||||
.path("./guest-js/bindings.ts")
|
||||
.config(
|
||||
specta::ts::ExportConfig::default()
|
||||
.formatter(specta::ts::formatter::prettier)
|
||||
.bigint(specta::ts::BigIntExportBehavior::Number),
|
||||
)
|
||||
.export_for_plugin("geolocation")
|
||||
.expect("failed to export specta types");
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use specta::Type;
|
||||
use tauri::plugin::PermissionState;
|
||||
|
||||
#[derive(Debug, Clone, Default, Serialize, Deserialize, Type)]
|
||||
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "specta", derive(specta::Type))]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct PermissionStatus {
|
||||
/// Permission state for the location alias.
|
||||
@@ -25,7 +25,8 @@ pub struct PermissionStatus {
|
||||
pub coarse_location: PermissionState,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default, Serialize, Deserialize, Type)]
|
||||
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "specta", derive(specta::Type))]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct PositionOptions {
|
||||
/// High accuracy mode (such as GPS, if available)
|
||||
@@ -46,14 +47,16 @@ pub struct PositionOptions {
|
||||
pub maximum_age: u32,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, Type)]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "specta", derive(specta::Type))]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub enum PermissionType {
|
||||
Location,
|
||||
CoarseLocation,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default, Serialize, Deserialize, Type)]
|
||||
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "specta", derive(specta::Type))]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Coordinates {
|
||||
/// Latitude in decimal degrees.
|
||||
@@ -73,7 +76,8 @@ pub struct Coordinates {
|
||||
pub heading: Option<f64>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default, Serialize, Deserialize, Type)]
|
||||
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "specta", derive(specta::Type))]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Position {
|
||||
/// Creation time for these coordinates.
|
||||
@@ -83,7 +87,8 @@ pub struct Position {
|
||||
pub coords: Coordinates,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, Type)]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "specta", derive(specta::Type))]
|
||||
#[serde(untagged)]
|
||||
pub enum WatchEvent {
|
||||
Position(Position),
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
# Changelog
|
||||
|
||||
## \[2.2.1]
|
||||
|
||||
- [`494d1fea`](https://github.com/tauri-apps/plugins-workspace/commit/494d1fea137ffd60da98b25305c9d666df62cc63) ([#2684](https://github.com/tauri-apps/plugins-workspace/pull/2684) by [@renovate](https://github.com/tauri-apps/plugins-workspace/../../renovate)) Updated `global-hotkey` crate to `0.7` to fix a panic when trying to register a key combination which was already registered by another program. No API changes.
|
||||
|
||||
## \[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.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "tauri-plugin-global-shortcut"
|
||||
version = "2.2.0"
|
||||
version = "2.2.1"
|
||||
description = "Register global hotkeys listeners on your Tauri application."
|
||||
edition = { workspace = true }
|
||||
authors = { workspace = true }
|
||||
@@ -31,4 +31,4 @@ log = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
|
||||
[target."cfg(not(any(target_os = \"android\", target_os = \"ios\")))".dependencies]
|
||||
global-hotkey = { version = "0.6", features = ["serde"] }
|
||||
global-hotkey = { version = "0.7", features = ["serde"] }
|
||||
|
||||
@@ -1 +1 @@
|
||||
if("__TAURI__"in window){var __TAURI_PLUGIN_GLOBAL_SHORTCUT__=function(t){"use strict";function e(t,e,r,s){if("a"===r&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!s:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?s:"a"===r?s.call(t):s?s.value:e.get(t)}function r(t,e,r,s,n){if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,r),r}var s,n,i;"function"==typeof SuppressedError&&SuppressedError;const o="__TAURI_TO_IPC_KEY__";class a{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,s.set(this,(()=>{})),n.set(this,0),i.set(this,{}),this.id=function(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}((({message:t,id:o})=>{if(o===e(this,n,"f")){r(this,n,o+1),e(this,s,"f").call(this,t);const a=Object.keys(e(this,i,"f"));if(a.length>0){let t=o+1;for(const r of a.sort()){if(parseInt(r)!==t)break;{const n=e(this,i,"f")[r];delete e(this,i,"f")[r],e(this,s,"f").call(this,n),t+=1}}r(this,n,t)}}else e(this,i,"f")[o.toString()]=t}))}set onmessage(t){r(this,s,t)}get onmessage(){return e(this,s,"f")}[(s=new WeakMap,n=new WeakMap,i=new WeakMap,o)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[o]()}}async function _(t,e={},r){return window.__TAURI_INTERNALS__.invoke(t,e,r)}return t.isRegistered=async function(t){return await _("plugin:global-shortcut|is_registered",{shortcut:t})},t.register=async function(t,e){const r=new a;return r.onmessage=e,await _("plugin:global-shortcut|register",{shortcuts:Array.isArray(t)?t:[t],handler:r})},t.unregister=async function(t){return await _("plugin:global-shortcut|unregister",{shortcuts:Array.isArray(t)?t:[t]})},t.unregisterAll=async function(){return await _("plugin:global-shortcut|unregister_all",{})},t}({});Object.defineProperty(window.__TAURI__,"globalShortcut",{value:__TAURI_PLUGIN_GLOBAL_SHORTCUT__})}
|
||||
if("__TAURI__"in window){var __TAURI_PLUGIN_GLOBAL_SHORTCUT__=function(t){"use strict";function e(t,e,s,i){if("function"==typeof e||!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?i:"a"===s?i.call(t):i?i.value:e.get(t)}function s(t,e,s,i,r){if("function"==typeof e||!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,s),s}var i,r,n,a;"function"==typeof SuppressedError&&SuppressedError;const o="__TAURI_TO_IPC_KEY__";class c{constructor(t){i.set(this,void 0),r.set(this,0),n.set(this,[]),a.set(this,void 0),s(this,i,t||(()=>{})),this.id=function(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}((t=>{const o=t.index;if("end"in t)return void(o==e(this,r,"f")?this.cleanupCallback():s(this,a,o));const c=t.message;if(o==e(this,r,"f")){for(e(this,i,"f").call(this,c),s(this,r,e(this,r,"f")+1);e(this,r,"f")in e(this,n,"f");){const t=e(this,n,"f")[e(this,r,"f")];e(this,i,"f").call(this,t),delete e(this,n,"f")[e(this,r,"f")],s(this,r,e(this,r,"f")+1)}e(this,r,"f")===e(this,a,"f")&&this.cleanupCallback()}else e(this,n,"f")[o]=c}))}cleanupCallback(){Reflect.deleteProperty(window,`_${this.id}`)}set onmessage(t){s(this,i,t)}get onmessage(){return e(this,i,"f")}[(i=new WeakMap,r=new WeakMap,n=new WeakMap,a=new WeakMap,o)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[o]()}}async function u(t,e={},s){return window.__TAURI_INTERNALS__.invoke(t,e,s)}return t.isRegistered=async function(t){return await u("plugin:global-shortcut|is_registered",{shortcut:t})},t.register=async function(t,e){const s=new c;return s.onmessage=e,await u("plugin:global-shortcut|register",{shortcuts:Array.isArray(t)?t:[t],handler:s})},t.unregister=async function(t){return await u("plugin:global-shortcut|unregister",{shortcuts:Array.isArray(t)?t:[t]})},t.unregisterAll=async function(){return await u("plugin:global-shortcut|unregister_all",{})},t}({});Object.defineProperty(window.__TAURI__,"globalShortcut",{value:__TAURI_PLUGIN_GLOBAL_SHORTCUT__})}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@tauri-apps/plugin-global-shortcut",
|
||||
"version": "2.2.0",
|
||||
"version": "2.2.1",
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"authors": [
|
||||
"Tauri Programme within The Commons Conservancy"
|
||||
|
||||
@@ -6,6 +6,8 @@ application specific if specific shortcuts should be
|
||||
registered or unregistered.
|
||||
|
||||
|
||||
#### This default permission set includes the following:
|
||||
|
||||
|
||||
## Permission Table
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
"minimum": 1.0
|
||||
},
|
||||
"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": [
|
||||
"string",
|
||||
"null"
|
||||
@@ -111,7 +111,7 @@
|
||||
"type": "string"
|
||||
},
|
||||
"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": [
|
||||
"string",
|
||||
"null"
|
||||
@@ -297,57 +297,68 @@
|
||||
{
|
||||
"description": "Enables the is_registered command without any pre-configured scope.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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.",
|
||||
"type": "string",
|
||||
"const": "deny-register"
|
||||
"const": "deny-register",
|
||||
"markdownDescription": "Denies the register command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the register_all command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "allow-register-all"
|
||||
"const": "allow-register-all",
|
||||
"markdownDescription": "Enables the register_all command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the register_all command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "deny-register-all"
|
||||
"const": "deny-register-all",
|
||||
"markdownDescription": "Denies the register_all command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the unregister command without any pre-configured scope.",
|
||||
"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.",
|
||||
"type": "string",
|
||||
"const": "deny-unregister"
|
||||
"const": "deny-unregister",
|
||||
"markdownDescription": "Denies the unregister command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the unregister_all command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "allow-unregister-all"
|
||||
"const": "allow-unregister-all",
|
||||
"markdownDescription": "Enables the unregister_all command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the unregister_all command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "deny-unregister-all"
|
||||
"const": "deny-unregister-all",
|
||||
"markdownDescription": "Denies the unregister_all command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "No features are enabled by default, as we believe\nthe shortcuts can be inherently dangerous and it is\napplication specific if specific shortcuts should be\nregistered or unregistered.\n",
|
||||
"type": "string",
|
||||
"const": "default"
|
||||
"const": "default",
|
||||
"markdownDescription": "No features are enabled by default, as we believe\nthe shortcuts can be inherently dangerous and it is\napplication specific if specific shortcuts should be\nregistered or unregistered.\n"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,5 +1,22 @@
|
||||
# Changelog
|
||||
|
||||
## \[2.2.4]
|
||||
|
||||
- [`a1b3fa27`](https://github.com/tauri-apps/plugins-workspace/commit/a1b3fa27f11022c9b6622b4fab12d93239eb05de) ([#2515](https://github.com/tauri-apps/plugins-workspace/pull/2515) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Re-exported the `Geolocation`, `Haptics`, `Notification`, and `Os` structs so that they show up on docs.rs.
|
||||
|
||||
## \[2.2.3]
|
||||
|
||||
- [`406e6f48`](https://github.com/tauri-apps/plugins-workspace/commit/406e6f484cdc13d35c50fb949f7489ca9eeccc44) ([#2323](https://github.com/tauri-apps/plugins-workspace/pull/2323) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Fixed an issue that caused build failures when the `haptics` or `geolocation` plugin was used without their `specta` feature flag enabled.
|
||||
|
||||
## \[2.2.2]
|
||||
|
||||
- [`c9c13a0f`](https://github.com/tauri-apps/plugins-workspace/commit/c9c13a0fe7cdaac223843f5ba33176252f8e22f5) ([#2316](https://github.com/tauri-apps/plugins-workspace/pull/2316) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) **Breaking change:** `specta` integration is now behind a `specta` feature flag like in Tauri.
|
||||
- [`c9c13a0f`](https://github.com/tauri-apps/plugins-workspace/commit/c9c13a0fe7cdaac223843f5ba33176252f8e22f5) ([#2316](https://github.com/tauri-apps/plugins-workspace/pull/2316) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Unlock and widen `specta` version range to match Tauri. No API changes.
|
||||
|
||||
## \[2.2.1]
|
||||
|
||||
- [`fb67ab2b`](https://github.com/tauri-apps/plugins-workspace/commit/fb67ab2b926502bfc20d6b43fbdd156691ea8526) ([#2281](https://github.com/tauri-apps/plugins-workspace/pull/2281) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Added `specta-util` to fix a "dependency not found" compilation error.
|
||||
|
||||
## \[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.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "tauri-plugin-haptics"
|
||||
description = "Haptic feedback and vibrations on Android and iOS"
|
||||
version = "2.2.0"
|
||||
version = "2.2.4"
|
||||
edition = { workspace = true }
|
||||
authors = { workspace = true }
|
||||
license = { workspace = true }
|
||||
@@ -26,10 +26,13 @@ tauri-plugin = { workspace = true, features = ["build"] }
|
||||
[dependencies]
|
||||
serde = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
tauri = { workspace = true, features = ["specta"] }
|
||||
tauri = { workspace = true }
|
||||
log = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
specta = { workspace = true }
|
||||
specta = { workspace = true, optional = true }
|
||||
|
||||
[target.'cfg(target_os = "ios")'.dependencies]
|
||||
tauri = { workspace = true, features = ["wry"] }
|
||||
|
||||
[features]
|
||||
specta = ["dep:specta", "tauri/specta"]
|
||||
|
||||
@@ -69,6 +69,19 @@ fn main() {
|
||||
}
|
||||
```
|
||||
|
||||
Second, add the required permissions in the project:
|
||||
|
||||
`src-tauri/capabilities/default.json`
|
||||
|
||||
```json
|
||||
"permissions": [
|
||||
"haptics:allow-impact-feedback",
|
||||
"haptics:allow-notification-feedback",
|
||||
"haptics:allow-selection-feedback",
|
||||
"haptics:allow-vibrate"
|
||||
]
|
||||
```
|
||||
|
||||
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
|
||||
|
||||
```javascript
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@tauri-apps/plugin-haptics",
|
||||
"version": "2.2.0",
|
||||
"version": "2.2.4",
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"authors": [
|
||||
"Tauri Programme within The Commons Conservancy"
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
"minimum": 1.0
|
||||
},
|
||||
"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": [
|
||||
"string",
|
||||
"null"
|
||||
@@ -111,7 +111,7 @@
|
||||
"type": "string"
|
||||
},
|
||||
"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": [
|
||||
"string",
|
||||
"null"
|
||||
@@ -297,42 +297,50 @@
|
||||
{
|
||||
"description": "Enables the impact_feedback command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "allow-impact-feedback"
|
||||
"const": "allow-impact-feedback",
|
||||
"markdownDescription": "Enables the impact_feedback command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the impact_feedback command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "deny-impact-feedback"
|
||||
"const": "deny-impact-feedback",
|
||||
"markdownDescription": "Denies the impact_feedback command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the notification_feedback command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "allow-notification-feedback"
|
||||
"const": "allow-notification-feedback",
|
||||
"markdownDescription": "Enables the notification_feedback command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the notification_feedback command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "deny-notification-feedback"
|
||||
"const": "deny-notification-feedback",
|
||||
"markdownDescription": "Denies the notification_feedback command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the selection_feedback command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "allow-selection-feedback"
|
||||
"const": "allow-selection-feedback",
|
||||
"markdownDescription": "Enables the selection_feedback command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the selection_feedback command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "deny-selection-feedback"
|
||||
"const": "deny-selection-feedback",
|
||||
"markdownDescription": "Denies the selection_feedback command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the vibrate command without any pre-configured scope.",
|
||||
"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.",
|
||||
"type": "string",
|
||||
"const": "deny-vibrate"
|
||||
"const": "deny-vibrate",
|
||||
"markdownDescription": "Denies the vibrate command without any pre-configured scope."
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user