mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-05-03 12:15:11 +02:00
Compare commits
102 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 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 |
@@ -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
|
||||
|
||||
|
||||
+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
+312
-303
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,60 @@
|
||||
# Changelog
|
||||
|
||||
## \[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.14",
|
||||
"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.2.0",
|
||||
"@tauri-apps/plugin-barcode-scanner": "^2.2.0",
|
||||
"@tauri-apps/plugin-biometric": "^2.2.0",
|
||||
"@tauri-apps/plugin-cli": "^2.2.0",
|
||||
"@tauri-apps/plugin-clipboard-manager": "^2.2.1",
|
||||
"@tauri-apps/plugin-dialog": "^2.2.0",
|
||||
"@tauri-apps/plugin-fs": "^2.2.0",
|
||||
"@tauri-apps/plugin-geolocation": "^2.2.0",
|
||||
"@tauri-apps/plugin-global-shortcut": "^2.2.0",
|
||||
"@tauri-apps/plugin-opener": "^2.2.5",
|
||||
"@tauri-apps/plugin-haptics": "^2.2.0",
|
||||
"@tauri-apps/plugin-http": "^2.3.0",
|
||||
"@tauri-apps/plugin-nfc": "^2.2.0",
|
||||
"@tauri-apps/plugin-notification": "^2.2.1",
|
||||
"@tauri-apps/plugin-os": "^2.2.0",
|
||||
"@tauri-apps/plugin-process": "^2.2.0",
|
||||
"@tauri-apps/plugin-shell": "^2.2.0",
|
||||
"@tauri-apps/plugin-store": "^2.2.0",
|
||||
"@tauri-apps/plugin-updater": "^2.5.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.6",
|
||||
"@iconify-json/ph": "^1.2.1",
|
||||
"@sveltejs/vite-plugin-svelte": "^5.0.1",
|
||||
"@tauri-apps/cli": "2.2.7",
|
||||
"@unocss/extractor-svelte": "^66.0.0",
|
||||
"svelte": "^5.10.0",
|
||||
"unocss": "^66.0.0",
|
||||
"vite": "^6.0.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,71 @@
|
||||
# Changelog
|
||||
|
||||
## \[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.18"
|
||||
description = "An example Tauri Application showcasing the api"
|
||||
edition = "2021"
|
||||
rust-version = { workspace = true }
|
||||
@@ -19,22 +19,22 @@ serde_json = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
tiny_http = "0.12"
|
||||
log = { workspace = true }
|
||||
tauri-plugin-log = { path = "../../../plugins/log", version = "2.1.0" }
|
||||
tauri-plugin-log = { path = "../../../plugins/log", version = "2.2.2" }
|
||||
tauri-plugin-fs = { path = "../../../plugins/fs", version = "2.2.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.1" }
|
||||
tauri-plugin-dialog = { path = "../../../plugins/dialog", version = "2.2.0" }
|
||||
tauri-plugin-http = { path = "../../../plugins/http", features = [
|
||||
"multipart",
|
||||
], version = "2.1.0" }
|
||||
tauri-plugin-notification = { path = "../../../plugins/notification", version = "2.1.0", features = [
|
||||
], version = "2.3.0" }
|
||||
tauri-plugin-notification = { path = "../../../plugins/notification", version = "2.2.1", 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.0" }
|
||||
tauri-plugin-process = { path = "../../../plugins/process", version = "2.2.0" }
|
||||
tauri-plugin-opener = { path = "../../../plugins/opener", version = "2.2.5" }
|
||||
tauri-plugin-shell = { path = "../../../plugins/shell", version = "2.2.0" }
|
||||
tauri-plugin-store = { path = "../../../plugins/store", version = "2.2.0" }
|
||||
|
||||
[dependencies.tauri]
|
||||
@@ -51,17 +51,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.0" }
|
||||
tauri-plugin-updater = { path = "../../../plugins/updater", version = "2.5.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.0" }
|
||||
tauri-plugin-geolocation = { path = "../../../plugins/geolocation/", version = "2.2.3" }
|
||||
tauri-plugin-haptics = { path = "../../../plugins/haptics/", version = "2.2.3" }
|
||||
|
||||
[features]
|
||||
prod = ["tauri/custom-protocol"]
|
||||
|
||||
@@ -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);
|
||||
|
||||
+8
-9
@@ -11,20 +11,19 @@
|
||||
"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.21.0",
|
||||
"@rollup/plugin-node-resolve": "16.0.0",
|
||||
"@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",
|
||||
"eslint": "9.21.0",
|
||||
"eslint-config-prettier": "10.0.1",
|
||||
"eslint-plugin-security": "3.0.1",
|
||||
"prettier": "3.4.2",
|
||||
"rollup": "4.28.1",
|
||||
"prettier": "3.5.2",
|
||||
"rollup": "4.34.8",
|
||||
"tslib": "2.8.1",
|
||||
"typescript": "5.7.2",
|
||||
"typescript-eslint": "8.17.0"
|
||||
"typescript": "5.7.3",
|
||||
"typescript-eslint": "8.24.1"
|
||||
},
|
||||
"resolutions": {
|
||||
"semver": ">=7.5.2",
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
# Changelog
|
||||
|
||||
## \[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.1"
|
||||
description = "Read and write to the system clipboard."
|
||||
edition = { workspace = true }
|
||||
authors = { workspace = true }
|
||||
|
||||
@@ -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__})}
|
||||
|
||||
@@ -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.1",
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"authors": [
|
||||
"Tauri Programme within The Commons Conservancy"
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
"tauri": "tauri"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "2.1.1",
|
||||
"@tauri-apps/plugin-deep-link": "2.1.0"
|
||||
"@tauri-apps/api": "2.2.0",
|
||||
"@tauri-apps/plugin-deep-link": "2.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tauri-apps/cli": "2.1.0",
|
||||
"@tauri-apps/cli": "2.2.7",
|
||||
"typescript": "^5.2.2",
|
||||
"vite": "^6.0.0"
|
||||
}
|
||||
|
||||
@@ -38,11 +38,11 @@ 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"
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -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.')
|
||||
}
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
# Changelog
|
||||
|
||||
## \[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.3"
|
||||
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;"function"==typeof SuppressedError&&SuppressedError;const r="__TAURI_TO_IPC_KEY__";class a{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,i.set(this,(()=>{})),s.set(this,0),o.set(this,[]),this.id=function(t,n=!1){return window.__TAURI_INTERNALS__.transformCallback(t,n)}((({message:t,id:r})=>{if(r==n(this,s,"f"))for(n(this,i,"f").call(this,t),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)}else n(this,o,"f")[r]=t}))}set onmessage(t){e(this,i,t)}get onmessage(){return n(this,i,"f")}[(i=new WeakMap,s=new WeakMap,o=new WeakMap,r)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[r]()}}async function c(t,n={},e){return window.__TAURI_INTERNALS__.invoke(t,n,e)}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,n){const e=new a;return e.onmessage=t=>{"string"==typeof t?n(null,t):n(t)},await c("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.3",
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"authors": [
|
||||
"Tauri Programme within The Commons Conservancy"
|
||||
|
||||
@@ -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)]
|
||||
@@ -27,24 +25,6 @@ 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),
|
||||
)
|
||||
};
|
||||
} */
|
||||
|
||||
/// Extensions to [`tauri::App`], [`tauri::AppHandle`], [`tauri::WebviewWindow`], [`tauri::Webview`] and [`tauri::Window`] to access the geolocation APIs.
|
||||
pub trait GeolocationExt<R: Runtime> {
|
||||
fn geolocation(&self) -> &Geolocation<R>;
|
||||
@@ -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 +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,r,s){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"===r?s:"a"===r?s.call(t):s?s.value:e.get(t)}function r(t,e,r,s,i){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,r),r}var s,i,n;"function"==typeof SuppressedError&&SuppressedError;const o="__TAURI_TO_IPC_KEY__";class a{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,s.set(this,(()=>{})),i.set(this,0),n.set(this,[]),this.id=function(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}((({message:t,id:o})=>{if(o==e(this,i,"f"))for(e(this,s,"f").call(this,t),r(this,i,e(this,i,"f")+1);e(this,i,"f")in e(this,n,"f");){const t=e(this,n,"f")[e(this,i,"f")];e(this,s,"f").call(this,t),delete e(this,n,"f")[e(this,i,"f")],r(this,i,e(this,i,"f")+1)}else e(this,n,"f")[o]=t}))}set onmessage(t){r(this,s,t)}get onmessage(){return e(this,s,"f")}[(s=new WeakMap,i=new WeakMap,n=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__})}
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
# Changelog
|
||||
|
||||
## \[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.3"
|
||||
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.3",
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"authors": [
|
||||
"Tauri Programme within The Commons Conservancy"
|
||||
|
||||
@@ -7,13 +7,11 @@ use tauri::{command, AppHandle, Runtime};
|
||||
use crate::{HapticsExt, ImpactFeedbackStyle, NotificationFeedbackType, Result};
|
||||
|
||||
#[command]
|
||||
#[specta::specta]
|
||||
pub(crate) async fn vibrate<R: Runtime>(app: AppHandle<R>, duration: u32) -> Result<()> {
|
||||
app.haptics().vibrate(duration)
|
||||
}
|
||||
|
||||
#[command]
|
||||
#[specta::specta]
|
||||
pub(crate) async fn impact_feedback<R: Runtime>(
|
||||
app: AppHandle<R>,
|
||||
style: ImpactFeedbackStyle,
|
||||
@@ -22,7 +20,6 @@ pub(crate) async fn impact_feedback<R: Runtime>(
|
||||
}
|
||||
|
||||
#[command]
|
||||
#[specta::specta]
|
||||
pub(crate) async fn notification_feedback<R: Runtime>(
|
||||
app: AppHandle<R>,
|
||||
r#type: NotificationFeedbackType,
|
||||
@@ -31,7 +28,6 @@ pub(crate) async fn notification_feedback<R: Runtime>(
|
||||
}
|
||||
|
||||
#[command]
|
||||
#[specta::specta]
|
||||
pub(crate) async fn selection_feedback<R: Runtime>(app: AppHandle<R>) -> Result<()> {
|
||||
app.haptics().selection_feedback()
|
||||
}
|
||||
|
||||
@@ -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)]
|
||||
@@ -27,23 +25,6 @@ use desktop::Haptics;
|
||||
#[cfg(mobile)]
|
||||
use mobile::Haptics;
|
||||
|
||||
/* macro_rules! specta_builder {
|
||||
() => {
|
||||
ts::builder()
|
||||
.commands(collect_commands![
|
||||
commands::vibrate,
|
||||
commands::impact_feedback,
|
||||
commands::notification_feedback,
|
||||
commands::selection_feedback
|
||||
])
|
||||
.header("// @ts-nocheck")
|
||||
.config(
|
||||
specta::ts::ExportConfig::default()
|
||||
.bigint(specta::ts::BigIntExportBehavior::Number),
|
||||
)
|
||||
};
|
||||
} */
|
||||
|
||||
/// Extensions to [`tauri::App`], [`tauri::AppHandle`], [`tauri::WebviewWindow`], [`tauri::Webview`] and [`tauri::Window`] to access the haptics APIs.
|
||||
pub trait HapticsExt<R: Runtime> {
|
||||
fn haptics(&self) -> &Haptics<R>;
|
||||
@@ -57,9 +38,6 @@ impl<R: Runtime, T: Manager<R>> crate::HapticsExt<R> for T {
|
||||
|
||||
/// Initializes the plugin.
|
||||
pub fn init<R: Runtime>() -> TauriPlugin<R> {
|
||||
/* let (invoke_handler, register_events) =
|
||||
specta_builder!().build_plugin_utils("haptics").unwrap(); */
|
||||
|
||||
Builder::new("haptics")
|
||||
.invoke_handler(tauri::generate_handler![
|
||||
commands::vibrate,
|
||||
@@ -77,22 +55,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("haptics")
|
||||
.expect("failed to export specta types");
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use specta::Type;
|
||||
/*
|
||||
#[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 HapticsOptions {
|
||||
// TODO: support array to match web api
|
||||
@@ -13,7 +13,8 @@ pub struct HapticsOptions {
|
||||
}
|
||||
*/
|
||||
|
||||
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize, Type)]
|
||||
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "specta", derive(specta::Type))]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub enum ImpactFeedbackStyle {
|
||||
Light,
|
||||
@@ -24,7 +25,8 @@ pub enum ImpactFeedbackStyle {
|
||||
Rigid,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize, Type)]
|
||||
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "specta", derive(specta::Type))]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub enum NotificationFeedbackType {
|
||||
#[default]
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
# Changelog
|
||||
|
||||
## \[2.3.0]
|
||||
|
||||
- [`10513649`](https://github.com/tauri-apps/plugins-workspace/commit/105136494c5a5bf4b1f1cc06cc71815412d17ec8) ([#2204](https://github.com/tauri-apps/plugins-workspace/pull/2204) by [@RickeyWard](https://github.com/tauri-apps/plugins-workspace/../../RickeyWard)) Add `dangerous-settings` feature flag and new JS `danger` option to disable tls hostname/certificate validation.
|
||||
|
||||
## \[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-http"
|
||||
version = "2.2.0"
|
||||
version = "2.3.0"
|
||||
description = "Access an HTTP client written in Rust."
|
||||
edition = { workspace = true }
|
||||
authors = { workspace = true }
|
||||
@@ -73,3 +73,4 @@ charset = ["reqwest/charset"]
|
||||
macos-system-configuration = ["reqwest/macos-system-configuration"]
|
||||
unsafe-headers = []
|
||||
tracing = ["dep:tracing"]
|
||||
dangerous-settings = []
|
||||
|
||||
@@ -1 +1 @@
|
||||
if("__TAURI__"in window){var __TAURI_PLUGIN_HTTP__=function(e){"use strict";async function t(e,t={},r){return window.__TAURI_INTERNALS__.invoke(e,t,r)}"function"==typeof SuppressedError&&SuppressedError;const r="Request canceled";return e.fetch=async function(e,n){const a=n?.signal;if(a?.aborted)throw new Error(r);const o=n?.maxRedirections,s=n?.connectTimeout,i=n?.proxy;n&&(delete n.maxRedirections,delete n.connectTimeout,delete n.proxy);const d=n?.headers?n.headers instanceof Headers?n.headers:new Headers(n.headers):new Headers,c=new Request(e,n),u=await c.arrayBuffer(),f=0!==u.byteLength?Array.from(new Uint8Array(u)):null;for(const[e,t]of c.headers)d.get(e)||d.set(e,t);const _=(d instanceof Headers?Array.from(d.entries()):Array.isArray(d)?d:Object.entries(d)).map((([e,t])=>[e,"string"==typeof t?t:t.toString()]));if(a?.aborted)throw new Error(r);const h=await t("plugin:http|fetch",{clientConfig:{method:c.method,url:c.url,headers:_,data:f,maxRedirections:o,connectTimeout:s,proxy:i}}),l=()=>t("plugin:http|fetch_cancel",{rid:h});if(a?.aborted)throw l(),new Error(r);a?.addEventListener("abort",(()=>{l()}));const{status:p,statusText:w,url:y,headers:T,rid:A}=await t("plugin:http|fetch_send",{rid:h}),g=await t("plugin:http|fetch_read_body",{rid:A}),R=new Response(g instanceof ArrayBuffer&&0!==g.byteLength?g:g instanceof Array&&g.length>0?new Uint8Array(g):null,{status:p,statusText:w});return Object.defineProperty(R,"url",{value:y}),Object.defineProperty(R,"headers",{value:new Headers(T)}),R},e}({});Object.defineProperty(window.__TAURI__,"http",{value:__TAURI_PLUGIN_HTTP__})}
|
||||
if("__TAURI__"in window){var __TAURI_PLUGIN_HTTP__=function(e){"use strict";async function t(e,t={},r){return window.__TAURI_INTERNALS__.invoke(e,t,r)}"function"==typeof SuppressedError&&SuppressedError;const r="Request canceled";return e.fetch=async function(e,n){const a=n?.signal;if(a?.aborted)throw new Error(r);const o=n?.maxRedirections,s=n?.connectTimeout,i=n?.proxy,d=n?.danger;n&&(delete n.maxRedirections,delete n.connectTimeout,delete n.proxy,delete n.danger);const c=n?.headers?n.headers instanceof Headers?n.headers:new Headers(n.headers):new Headers,u=new Request(e,n),f=await u.arrayBuffer(),_=0!==f.byteLength?Array.from(new Uint8Array(f)):null;for(const[e,t]of u.headers)c.get(e)||c.set(e,t);const h=(c instanceof Headers?Array.from(c.entries()):Array.isArray(c)?c:Object.entries(c)).map((([e,t])=>[e,"string"==typeof t?t:t.toString()]));if(a?.aborted)throw new Error(r);const l=await t("plugin:http|fetch",{clientConfig:{method:u.method,url:u.url,headers:h,data:_,maxRedirections:o,connectTimeout:s,proxy:i,danger:d}}),p=()=>t("plugin:http|fetch_cancel",{rid:l});if(a?.aborted)throw p(),new Error(r);a?.addEventListener("abort",(()=>{p()}));const{status:w,statusText:y,url:g,headers:T,rid:A}=await t("plugin:http|fetch_send",{rid:l}),R=await t("plugin:http|fetch_read_body",{rid:A}),b=new Response(R instanceof ArrayBuffer&&0!==R.byteLength?R:R instanceof Array&&R.length>0?new Uint8Array(R):null,{status:w,statusText:y});return Object.defineProperty(b,"url",{value:g}),Object.defineProperty(b,"headers",{value:new Headers(T)}),b},e}({});Object.defineProperty(window.__TAURI__,"http",{value:__TAURI_PLUGIN_HTTP__})}
|
||||
|
||||
@@ -84,6 +84,26 @@ export interface ClientOptions {
|
||||
* Configuration of a proxy that a Client should pass requests to.
|
||||
*/
|
||||
proxy?: Proxy
|
||||
/**
|
||||
* Configuration for dangerous settings on the client such as disabling SSL verification.
|
||||
*/
|
||||
danger?: DangerousSettings
|
||||
}
|
||||
|
||||
/**
|
||||
* Configuration for dangerous settings on the client such as disabling SSL verification.
|
||||
*
|
||||
* @since 2.3.0
|
||||
*/
|
||||
export interface DangerousSettings {
|
||||
/**
|
||||
* Disables SSL verification.
|
||||
*/
|
||||
acceptInvalidCerts?: boolean
|
||||
/**
|
||||
* Disables hostname verification.
|
||||
*/
|
||||
acceptInvalidHostnames?: boolean
|
||||
}
|
||||
|
||||
const ERROR_REQUEST_CANCELLED = 'Request canceled'
|
||||
@@ -115,12 +135,14 @@ export async function fetch(
|
||||
const maxRedirections = init?.maxRedirections
|
||||
const connectTimeout = init?.connectTimeout
|
||||
const proxy = init?.proxy
|
||||
const danger = init?.danger
|
||||
|
||||
// Remove these fields before creating the request
|
||||
if (init) {
|
||||
delete init.maxRedirections
|
||||
delete init.connectTimeout
|
||||
delete init.proxy
|
||||
delete init.danger
|
||||
}
|
||||
|
||||
const headers = init?.headers
|
||||
@@ -172,7 +194,8 @@ export async function fetch(
|
||||
data,
|
||||
maxRedirections,
|
||||
connectTimeout,
|
||||
proxy
|
||||
proxy,
|
||||
danger
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@tauri-apps/plugin-http",
|
||||
"version": "2.2.0",
|
||||
"version": "2.3.0",
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"authors": [
|
||||
"Tauri Programme within The Commons Conservancy"
|
||||
|
||||
@@ -75,6 +75,14 @@ pub struct FetchResponse {
|
||||
rid: ResourceId,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[allow(dead_code)] //feature flags shoudln't affect api
|
||||
pub struct DangerousSettings {
|
||||
accept_invalid_certs: bool,
|
||||
accept_invalid_hostnames: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ClientConfig {
|
||||
@@ -85,6 +93,7 @@ pub struct ClientConfig {
|
||||
connect_timeout: Option<u64>,
|
||||
max_redirections: Option<usize>,
|
||||
proxy: Option<Proxy>,
|
||||
danger: Option<DangerousSettings>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
@@ -181,6 +190,7 @@ pub async fn fetch<R: Runtime>(
|
||||
connect_timeout,
|
||||
max_redirections,
|
||||
proxy,
|
||||
danger,
|
||||
} = client_config;
|
||||
|
||||
let scheme = url.scheme();
|
||||
@@ -220,6 +230,24 @@ pub async fn fetch<R: Runtime>(
|
||||
{
|
||||
let mut builder = reqwest::ClientBuilder::new();
|
||||
|
||||
if let Some(danger_config) = danger {
|
||||
#[cfg(not(feature = "dangerous-settings"))]
|
||||
{
|
||||
#[cfg(debug_assertions)]
|
||||
{
|
||||
eprintln!("[\x1b[33mWARNING\x1b[0m] using dangerous settings requires `dangerous-settings` feature flag in your Cargo.toml");
|
||||
}
|
||||
let _ = danger_config;
|
||||
return Err(Error::DangerousSettings);
|
||||
}
|
||||
#[cfg(feature = "dangerous-settings")]
|
||||
{
|
||||
builder = builder
|
||||
.danger_accept_invalid_certs(danger_config.accept_invalid_certs)
|
||||
.danger_accept_invalid_hostnames(danger_config.accept_invalid_hostnames)
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(timeout) = connect_timeout {
|
||||
builder = builder.connect_timeout(Duration::from_millis(timeout));
|
||||
}
|
||||
|
||||
@@ -41,6 +41,8 @@ pub enum Error {
|
||||
Tauri(#[from] tauri::Error),
|
||||
#[error(transparent)]
|
||||
Utf8(#[from] std::string::FromUtf8Error),
|
||||
#[error("dangerous settings used but are not enabled")]
|
||||
DangerousSettings,
|
||||
}
|
||||
|
||||
impl Serialize for Error {
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# Changelog
|
||||
|
||||
## \[2.2.2]
|
||||
|
||||
- [`6b4c3917`](https://github.com/tauri-apps/plugins-workspace/commit/6b4c3917389f4bc489d03b48a837557ac0584175) ([#2401](https://github.com/tauri-apps/plugins-workspace/pull/2401) by [@Seishiin](https://github.com/tauri-apps/plugins-workspace/../../Seishiin)) Fix timezone_strategy overwriting previously set LogLevels.
|
||||
|
||||
## \[2.2.1]
|
||||
|
||||
- [`784a54a3`](https://github.com/tauri-apps/plugins-workspace/commit/784a54a39094dfbaaa8dd123eb083c04dc6c3bb2) ([#2344](https://github.com/tauri-apps/plugins-workspace/pull/2344) by [@madsmtm](https://github.com/tauri-apps/plugins-workspace/../../madsmtm)) Use `objc2` instead of `objc`.
|
||||
|
||||
## \[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-log"
|
||||
version = "2.2.0"
|
||||
version = "2.2.2"
|
||||
description = "Configurable logging for your Tauri app."
|
||||
authors = { workspace = true }
|
||||
license = { workspace = true }
|
||||
@@ -17,8 +17,8 @@ rustdoc-args = ["--cfg", "docsrs"]
|
||||
windows = { level = "full", notes = "" }
|
||||
linux = { level = "full", notes = "" }
|
||||
macos = { level = "full", notes = "" }
|
||||
android = { level = "unknown", notes = "" }
|
||||
ios = { level = "unknown", notes = "" }
|
||||
android = { level = "full", notes = "" }
|
||||
ios = { level = "full", notes = "" }
|
||||
|
||||
[build-dependencies]
|
||||
tauri-plugin = { workspace = true, features = ["build"] }
|
||||
@@ -39,8 +39,11 @@ android_logger = "0.14"
|
||||
|
||||
[target."cfg(target_os = \"ios\")".dependencies]
|
||||
swift-rs = "1"
|
||||
objc = "0.2"
|
||||
cocoa = "0.26"
|
||||
objc2 = "0.5"
|
||||
objc2-foundation = { version = "0.2", default-features = false, features = [
|
||||
"std",
|
||||
"NSString",
|
||||
] }
|
||||
|
||||
[features]
|
||||
colored = ["fern/colored"]
|
||||
|
||||
+17
-1
@@ -54,7 +54,23 @@ yarn add https://github.com/tauri-apps/tauri-plugin-log#v2
|
||||
|
||||
## Usage
|
||||
|
||||
First you need to register the core plugin with Tauri:
|
||||
First, you should enable the `log:default` capability:
|
||||
|
||||
```json
|
||||
{
|
||||
"$schema": "../gen/schemas/desktop-schema.json",
|
||||
"identifier": "default",
|
||||
"description": "Capability for the main window",
|
||||
"windows": ["main"],
|
||||
"permissions": [
|
||||
"core:default",
|
||||
"opener:default",
|
||||
"log:default" # add this!
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Then, you need to register the core plugin with Tauri:
|
||||
|
||||
`src-tauri/src/lib.rs`
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@tauri-apps/plugin-log",
|
||||
"version": "2.2.0",
|
||||
"version": "2.2.2",
|
||||
"description": "Configurable logging for your Tauri app.",
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"authors": [
|
||||
|
||||
+7
-27
@@ -35,31 +35,6 @@ pub const WEBVIEW_TARGET: &str = "webview";
|
||||
|
||||
#[cfg(target_os = "ios")]
|
||||
mod ios {
|
||||
use cocoa::base::id;
|
||||
use objc::*;
|
||||
|
||||
const UTF8_ENCODING: usize = 4;
|
||||
pub struct NSString(pub id);
|
||||
|
||||
impl NSString {
|
||||
pub fn new(s: &str) -> Self {
|
||||
// Safety: objc runtime calls are unsafe
|
||||
NSString(unsafe {
|
||||
let ns_string: id = msg_send![class!(NSString), alloc];
|
||||
let ns_string: id = msg_send![ns_string,
|
||||
initWithBytes:s.as_ptr()
|
||||
length:s.len()
|
||||
encoding:UTF8_ENCODING];
|
||||
|
||||
// The thing is allocated in rust, the thing must be set to autorelease in rust to relinquish control
|
||||
// or it can not be released correctly in OC runtime
|
||||
let _: () = msg_send![ns_string, autorelease];
|
||||
|
||||
ns_string
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
swift_rs::swift!(pub fn tauri_log(
|
||||
level: u8, message: *const std::ffi::c_void
|
||||
));
|
||||
@@ -303,7 +278,7 @@ impl Builder {
|
||||
let format =
|
||||
time::format_description::parse("[[[year]-[month]-[day]][[[hour]:[minute]:[second]]")
|
||||
.unwrap();
|
||||
self.dispatch = fern::Dispatch::new().format(move |out, message, record| {
|
||||
self.dispatch = self.dispatch.format(move |out, message, record| {
|
||||
out.finish(format_args!(
|
||||
"{}[{}][{}] {}",
|
||||
timezone_strategy.get_now().format(&format).unwrap(),
|
||||
@@ -429,7 +404,12 @@ impl Builder {
|
||||
log::Level::Info => 2,
|
||||
log::Level::Warn | log::Level::Error => 3,
|
||||
},
|
||||
ios::NSString::new(message.as_str()).0 as _,
|
||||
// The string is allocated in rust, so we must
|
||||
// autorelease it rust to give it to the Swift
|
||||
// runtime.
|
||||
objc2::rc::Retained::autorelease_ptr(
|
||||
objc2_foundation::NSString::from_str(message.as_str()),
|
||||
) as _,
|
||||
);
|
||||
}
|
||||
}),
|
||||
|
||||
@@ -181,8 +181,8 @@ function encodeURI(uri: string): number[] {
|
||||
|
||||
protocols.slice(1).forEach(function (protocol) {
|
||||
if (
|
||||
(prefix.length === 0 || prefix === 'urn:') &&
|
||||
uri.indexOf(protocol) === 0
|
||||
(prefix.length === 0 || prefix === 'urn:')
|
||||
&& uri.indexOf(protocol) === 0
|
||||
) {
|
||||
prefix = protocol
|
||||
}
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
# Changelog
|
||||
|
||||
## \[2.2.1]
|
||||
|
||||
- [`da5c59e2`](https://github.com/tauri-apps/plugins-workspace/commit/da5c59e2fe879d177e3cfd52fcacce85440423cb) ([#2271](https://github.com/tauri-apps/plugins-workspace/pull/2271) by [@renovate](https://github.com/tauri-apps/plugins-workspace/../../renovate)) Updated `zbus` dependency to version 5. 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-notification"
|
||||
version = "2.2.0"
|
||||
version = "2.2.1"
|
||||
description = "Send desktop and mobile notifications on your Tauri application."
|
||||
edition = { workspace = true }
|
||||
authors = { workspace = true }
|
||||
@@ -46,7 +46,7 @@ windows-version = { version = "0.1", optional = true }
|
||||
notify-rust = "4.11"
|
||||
|
||||
[dev-dependencies]
|
||||
color-backtrace = "0.6"
|
||||
color-backtrace = "0.7"
|
||||
ctor = "0.2"
|
||||
maplit = "1"
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
if("__TAURI__"in window){var __TAURI_PLUGIN_NOTIFICATION__=function(i){"use strict";function t(i,t,n,e){if("a"===n&&!e)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?i!==t||!e:!t.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?e:"a"===n?e.call(i):e?e.value:t.get(i)}function n(i,t,n,e,o){if("function"==typeof t?i!==t||!o:!t.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(i,n),n}var e,o,a;"function"==typeof SuppressedError&&SuppressedError;const r="__TAURI_TO_IPC_KEY__";class c{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,e.set(this,(()=>{})),o.set(this,0),a.set(this,{}),this.id=function(i,t=!1){return window.__TAURI_INTERNALS__.transformCallback(i,t)}((({message:i,id:r})=>{if(r===t(this,o,"f")){n(this,o,r+1),t(this,e,"f").call(this,i);const c=Object.keys(t(this,a,"f"));if(c.length>0){let i=r+1;for(const n of c.sort()){if(parseInt(n)!==i)break;{const o=t(this,a,"f")[n];delete t(this,a,"f")[n],t(this,e,"f").call(this,o),i+=1}}n(this,o,i)}}else t(this,a,"f")[r.toString()]=i}))}set onmessage(i){n(this,e,i)}get onmessage(){return t(this,e,"f")}[(e=new WeakMap,o=new WeakMap,a=new WeakMap,r)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[r]()}}class s{constructor(i,t,n){this.plugin=i,this.event=t,this.channelId=n}async unregister(){return u(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}}async function l(i,t,n){const e=new c;return e.onmessage=n,u(`plugin:${i}|registerListener`,{event:t,handler:e}).then((()=>new s(i,t,e.id)))}async function u(i,t={},n){return window.__TAURI_INTERNALS__.invoke(i,t,n)}var f,d,w;i.ScheduleEvery=void 0,(f=i.ScheduleEvery||(i.ScheduleEvery={})).Year="year",f.Month="month",f.TwoWeeks="twoWeeks",f.Week="week",f.Day="day",f.Hour="hour",f.Minute="minute",f.Second="second";return i.Importance=void 0,(d=i.Importance||(i.Importance={}))[d.None=0]="None",d[d.Min=1]="Min",d[d.Low=2]="Low",d[d.Default=3]="Default",d[d.High=4]="High",i.Visibility=void 0,(w=i.Visibility||(i.Visibility={}))[w.Secret=-1]="Secret",w[w.Private=0]="Private",w[w.Public=1]="Public",i.Schedule=class{static at(i,t=!1,n=!1){return{at:{date:i,repeating:t,allowWhileIdle:n},interval:void 0,every:void 0}}static interval(i,t=!1){return{at:void 0,interval:{interval:i,allowWhileIdle:t},every:void 0}}static every(i,t,n=!1){return{at:void 0,interval:void 0,every:{interval:i,count:t,allowWhileIdle:n}}}},i.active=async function(){return await u("plugin:notification|get_active")},i.cancel=async function(i){await u("plugin:notification|cancel",{notifications:i})},i.cancelAll=async function(){await u("plugin:notification|cancel")},i.channels=async function(){return await u("plugin:notification|listChannels")},i.createChannel=async function(i){await u("plugin:notification|create_channel",{...i})},i.isPermissionGranted=async function(){return"default"!==window.Notification.permission?await Promise.resolve("granted"===window.Notification.permission):await u("plugin:notification|is_permission_granted")},i.onAction=async function(i){return await l("notification","actionPerformed",i)},i.onNotificationReceived=async function(i){return await l("notification","notification",i)},i.pending=async function(){return await u("plugin:notification|get_pending")},i.registerActionTypes=async function(i){await u("plugin:notification|register_action_types",{types:i})},i.removeActive=async function(i){await u("plugin:notification|remove_active",{notifications:i})},i.removeAllActive=async function(){await u("plugin:notification|remove_active")},i.removeChannel=async function(i){await u("plugin:notification|delete_channel",{id:i})},i.requestPermission=async function(){return await window.Notification.requestPermission()},i.sendNotification=function(i){"string"==typeof i?new window.Notification(i):new window.Notification(i.title,i)},i}({});Object.defineProperty(window.__TAURI__,"notification",{value:__TAURI_PLUGIN_NOTIFICATION__})}
|
||||
if("__TAURI__"in window){var __TAURI_PLUGIN_NOTIFICATION__=function(i){"use strict";function n(i,n,t,e){if("function"==typeof n||!n.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===t?e:"a"===t?e.call(i):e?e.value:n.get(i)}function t(i,n,t,e,o){if("function"==typeof n||!n.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n.set(i,t),t}var e,o,a;"function"==typeof SuppressedError&&SuppressedError;const r="__TAURI_TO_IPC_KEY__";class c{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,e.set(this,(()=>{})),o.set(this,0),a.set(this,[]),this.id=function(i,n=!1){return window.__TAURI_INTERNALS__.transformCallback(i,n)}((({message:i,id:r})=>{if(r==n(this,o,"f"))for(n(this,e,"f").call(this,i),t(this,o,n(this,o,"f")+1);n(this,o,"f")in n(this,a,"f");){const i=n(this,a,"f")[n(this,o,"f")];n(this,e,"f").call(this,i),delete n(this,a,"f")[n(this,o,"f")],t(this,o,n(this,o,"f")+1)}else n(this,a,"f")[r]=i}))}set onmessage(i){t(this,e,i)}get onmessage(){return n(this,e,"f")}[(e=new WeakMap,o=new WeakMap,a=new WeakMap,r)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[r]()}}class s{constructor(i,n,t){this.plugin=i,this.event=n,this.channelId=t}async unregister(){return u(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}}async function l(i,n,t){const e=new c;return e.onmessage=t,u(`plugin:${i}|registerListener`,{event:n,handler:e}).then((()=>new s(i,n,e.id)))}async function u(i,n={},t){return window.__TAURI_INTERNALS__.invoke(i,n,t)}var f,h,d;i.ScheduleEvery=void 0,(f=i.ScheduleEvery||(i.ScheduleEvery={})).Year="year",f.Month="month",f.TwoWeeks="twoWeeks",f.Week="week",f.Day="day",f.Hour="hour",f.Minute="minute",f.Second="second";return i.Importance=void 0,(h=i.Importance||(i.Importance={}))[h.None=0]="None",h[h.Min=1]="Min",h[h.Low=2]="Low",h[h.Default=3]="Default",h[h.High=4]="High",i.Visibility=void 0,(d=i.Visibility||(i.Visibility={}))[d.Secret=-1]="Secret",d[d.Private=0]="Private",d[d.Public=1]="Public",i.Schedule=class{static at(i,n=!1,t=!1){return{at:{date:i,repeating:n,allowWhileIdle:t},interval:void 0,every:void 0}}static interval(i,n=!1){return{at:void 0,interval:{interval:i,allowWhileIdle:n},every:void 0}}static every(i,n,t=!1){return{at:void 0,interval:void 0,every:{interval:i,count:n,allowWhileIdle:t}}}},i.active=async function(){return await u("plugin:notification|get_active")},i.cancel=async function(i){await u("plugin:notification|cancel",{notifications:i})},i.cancelAll=async function(){await u("plugin:notification|cancel")},i.channels=async function(){return await u("plugin:notification|listChannels")},i.createChannel=async function(i){await u("plugin:notification|create_channel",{...i})},i.isPermissionGranted=async function(){return"default"!==window.Notification.permission?await Promise.resolve("granted"===window.Notification.permission):await u("plugin:notification|is_permission_granted")},i.onAction=async function(i){return await l("notification","actionPerformed",i)},i.onNotificationReceived=async function(i){return await l("notification","notification",i)},i.pending=async function(){return await u("plugin:notification|get_pending")},i.registerActionTypes=async function(i){await u("plugin:notification|register_action_types",{types:i})},i.removeActive=async function(i){await u("plugin:notification|remove_active",{notifications:i})},i.removeAllActive=async function(){await u("plugin:notification|remove_active")},i.removeChannel=async function(i){await u("plugin:notification|delete_channel",{id:i})},i.requestPermission=async function(){return await window.Notification.requestPermission()},i.sendNotification=function(i){"string"==typeof i?new window.Notification(i):new window.Notification(i.title,i)},i}({});Object.defineProperty(window.__TAURI__,"notification",{value:__TAURI_PLUGIN_NOTIFICATION__})}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@tauri-apps/plugin-notification",
|
||||
"version": "2.2.0",
|
||||
"version": "2.2.1",
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"authors": [
|
||||
"Tauri Programme within The Commons Conservancy"
|
||||
|
||||
@@ -1,5 +1,25 @@
|
||||
# Changelog
|
||||
|
||||
## \[2.2.5]
|
||||
|
||||
- [`5b821181`](https://github.com/tauri-apps/plugins-workspace/commit/5b8211815825ddae2dcc0c00520e0cfdff002763) ([#2332](https://github.com/tauri-apps/plugins-workspace/pull/2332) by [@betamos](https://github.com/tauri-apps/plugins-workspace/../../betamos)) Fix broken JS commands `opener.openPath` and `opener.openUrl` on mobile.
|
||||
|
||||
## \[2.2.4]
|
||||
|
||||
- [`da5c59e2`](https://github.com/tauri-apps/plugins-workspace/commit/da5c59e2fe879d177e3cfd52fcacce85440423cb) ([#2271](https://github.com/tauri-apps/plugins-workspace/pull/2271) by [@renovate](https://github.com/tauri-apps/plugins-workspace/../../renovate)) Updated `zbus` dependency to version 5. No API changes.
|
||||
|
||||
## \[2.2.3]
|
||||
|
||||
- [`a9ac1e3c`](https://github.com/tauri-apps/plugins-workspace/commit/a9ac1e3c939cec4338a9422ef02323c1d4dde6cd) ([#2253](https://github.com/tauri-apps/plugins-workspace/pull/2253) by [@betamos](https://github.com/tauri-apps/plugins-workspace/../../betamos)) Return an error in `open_path` if the file does not exist when opening with default application.
|
||||
|
||||
## \[2.2.2]
|
||||
|
||||
- [`ee0f65de`](https://github.com/tauri-apps/plugins-workspace/commit/ee0f65de5c645c244c5f0b638e0e0aab687cb9bf) ([#2207](https://github.com/tauri-apps/plugins-workspace/pull/2207) by [@universalappfactory](https://github.com/tauri-apps/plugins-workspace/../../universalappfactory)) Fixed OpenerPlugin packagename for android
|
||||
|
||||
## \[2.2.1]
|
||||
|
||||
- [`18dffc9d`](https://github.com/tauri-apps/plugins-workspace/commit/18dffc9dfecaf0c900e233e041d9ca36c92834b5) ([#2189](https://github.com/tauri-apps/plugins-workspace/pull/2189) by [@lucasfernog](https://github.com/tauri-apps/plugins-workspace/../../lucasfernog)) Fix usage 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-opener"
|
||||
version = "2.2.0"
|
||||
version = "2.2.5"
|
||||
description = "Open files and URLs using their default application."
|
||||
edition = { workspace = true }
|
||||
authors = { workspace = true }
|
||||
@@ -15,7 +15,7 @@ rustdoc-args = ["--cfg", "docsrs"]
|
||||
# Platforms supported by the plugin
|
||||
# Support levels are "full", "partial", "none", "unknown"
|
||||
# Details of the support level are left to plugin maintainer
|
||||
[package.metadata.platforms]
|
||||
[package.metadata.platforms.support]
|
||||
windows = { level = "full", notes = "" }
|
||||
linux = { level = "full", notes = "" }
|
||||
macos = { level = "full", notes = "" }
|
||||
@@ -55,11 +55,13 @@ url = { workspace = true }
|
||||
|
||||
[target."cfg(target_os = \"macos\")".dependencies.objc2-app-kit]
|
||||
version = "0.2"
|
||||
features = ["NSWorkspace"]
|
||||
default-features = false
|
||||
features = ["std", "NSWorkspace"]
|
||||
|
||||
[target."cfg(target_os = \"macos\")".dependencies.objc2-foundation]
|
||||
version = "0.2"
|
||||
features = ["NSURL", "NSArray", "NSString"]
|
||||
default-features = false
|
||||
features = ["std", "NSURL", "NSArray", "NSString"]
|
||||
|
||||
[target.'cfg(target_os = "ios")'.dependencies]
|
||||
tauri = { workspace = true, features = ["wry"] }
|
||||
|
||||
@@ -98,8 +98,18 @@ fn main() {
|
||||
.plugin(tauri_plugin_opener::init())
|
||||
.setup(|app| {
|
||||
let opener = app.opener();
|
||||
|
||||
// Opens the URL in the default browser
|
||||
opener.open_url("https://example.com", None::<&str>)?;
|
||||
// Or with a specific browser/app
|
||||
opener.open_url("https://example.com", Some("firefox"))?;
|
||||
|
||||
// Opens the path with the system's default app
|
||||
opener.open_path("/path/to/file", None::<&str>)?;
|
||||
// Or with a specific app
|
||||
opener.open_path("/path/to/file", Some("firefox"))?;
|
||||
|
||||
// Reveal a path with the system's default explorer
|
||||
opener.reveal_item_in_dir("/path/to/file")?;
|
||||
Ok(())
|
||||
})
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package app.tauri.shell
|
||||
package app.tauri.opener
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
@@ -27,4 +27,4 @@ class OpenerPlugin(private val activity: Activity) : Plugin(activity) {
|
||||
invoke.reject(ex.message)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,13 +9,13 @@ window.addEventListener('click', function (evt) {
|
||||
// return early if
|
||||
if (
|
||||
// event was prevented
|
||||
evt.defaultPrevented ||
|
||||
evt.defaultPrevented
|
||||
// or not a left click
|
||||
evt.button !== 0 ||
|
||||
|| evt.button !== 0
|
||||
// or meta key pressed
|
||||
evt.metaKey ||
|
||||
|| evt.metaKey
|
||||
// or al key pressed
|
||||
evt.altKey
|
||||
|| evt.altKey
|
||||
)
|
||||
return
|
||||
|
||||
@@ -28,16 +28,16 @@ window.addEventListener('click', function (evt) {
|
||||
// return early if
|
||||
if (
|
||||
// not tirggered from <a> element
|
||||
!a ||
|
||||
!a
|
||||
// or doesn't have a href
|
||||
!a.href ||
|
||||
|| !a.href
|
||||
// or not supposed to be open in a new tab
|
||||
!(
|
||||
a.target === '_blank' ||
|
||||
|| !(
|
||||
a.target === '_blank'
|
||||
// or ctrl key pressed
|
||||
evt.ctrlKey ||
|
||||
|| evt.ctrlKey
|
||||
// or shift key pressed
|
||||
evt.shiftKey
|
||||
|| evt.shiftKey
|
||||
)
|
||||
)
|
||||
return
|
||||
@@ -47,9 +47,9 @@ window.addEventListener('click', function (evt) {
|
||||
// return early if
|
||||
if (
|
||||
// same origin (internal navigation)
|
||||
url.origin === window.location.origin ||
|
||||
url.origin === window.location.origin
|
||||
// not default protocols
|
||||
['http:', 'https:', 'mailto:', 'tel:'].every((p) => url.protocol !== p)
|
||||
|| ['http:', 'https:', 'mailto:', 'tel:'].every((p) => url.protocol !== p)
|
||||
)
|
||||
return
|
||||
|
||||
|
||||
@@ -3,32 +3,30 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import Foundation
|
||||
|
||||
import SwiftRs
|
||||
import Tauri
|
||||
import UIKit
|
||||
import WebKit
|
||||
|
||||
class OpenerPlugin: Plugin {
|
||||
|
||||
@objc public func open(_ invoke: Invoke) throws {
|
||||
do {
|
||||
let urlString = try invoke.parseArgs(String.self)
|
||||
if let url = URL(string: urlString) {
|
||||
if #available(iOS 10, *) {
|
||||
UIApplication.shared.open(url, options: [:])
|
||||
} else {
|
||||
UIApplication.shared.openURL(url)
|
||||
}
|
||||
}
|
||||
invoke.resolve()
|
||||
} catch {
|
||||
invoke.reject(error.localizedDescription)
|
||||
@objc public func open(_ invoke: Invoke) throws {
|
||||
do {
|
||||
let urlString = try invoke.parseArgs(String.self)
|
||||
if let url = URL(string: urlString) {
|
||||
if #available(iOS 10, *) {
|
||||
UIApplication.shared.open(url, options: [:])
|
||||
} else {
|
||||
UIApplication.shared.openURL(url)
|
||||
}
|
||||
}
|
||||
invoke.resolve()
|
||||
} catch {
|
||||
invoke.reject(error.localizedDescription)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@_cdecl("init_plugin_shell")
|
||||
@_cdecl("init_plugin_opener")
|
||||
func initPlugin() -> Plugin {
|
||||
return OpenerPlugin()
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@tauri-apps/plugin-opener",
|
||||
"version": "2.2.0",
|
||||
"version": "2.2.5",
|
||||
"description": "Open files and URLs using their default application.",
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"authors": [
|
||||
|
||||
@@ -9,7 +9,7 @@ use tauri::{
|
||||
AppHandle, Runtime,
|
||||
};
|
||||
|
||||
use crate::{scope::Scope, Error};
|
||||
use crate::{scope::Scope, Error, OpenerExt};
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn open_url<R: Runtime>(
|
||||
@@ -34,7 +34,7 @@ pub async fn open_url<R: Runtime>(
|
||||
);
|
||||
|
||||
if scope.is_url_allowed(&url, with.as_deref()) {
|
||||
crate::open_url(url, with)
|
||||
app.opener().open_url(url, with)
|
||||
} else {
|
||||
Err(Error::ForbiddenUrl { url, with })
|
||||
}
|
||||
@@ -63,7 +63,7 @@ pub async fn open_path<R: Runtime>(
|
||||
);
|
||||
|
||||
if scope.is_path_allowed(Path::new(&path), with.as_deref())? {
|
||||
crate::open_path(path, with)
|
||||
app.opener().open_path(path, with)
|
||||
} else {
|
||||
Err(Error::ForbiddenPath { path, with })
|
||||
}
|
||||
|
||||
@@ -38,6 +38,19 @@ pub struct Opener<R: Runtime> {
|
||||
impl<R: Runtime> Opener<R> {
|
||||
/// Open a url with a default or specific program.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```rust,no_run
|
||||
/// use tauri_plugin_opener::OpenerExt;
|
||||
///
|
||||
/// tauri::Builder::default()
|
||||
/// .setup(|app| {
|
||||
/// // open the given URL on the system default browser
|
||||
/// app.opener().open_url("https://github.com/tauri-apps/tauri", None::<&str>)?;
|
||||
/// Ok(())
|
||||
/// });
|
||||
/// ```
|
||||
///
|
||||
/// ## Platform-specific:
|
||||
///
|
||||
/// - **Android / iOS**: Always opens using default program.
|
||||
@@ -48,6 +61,19 @@ impl<R: Runtime> Opener<R> {
|
||||
|
||||
/// Open a url with a default or specific program.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```rust,no_run
|
||||
/// use tauri_plugin_opener::OpenerExt;
|
||||
///
|
||||
/// tauri::Builder::default()
|
||||
/// .setup(|app| {
|
||||
/// // open the given URL on the system default browser
|
||||
/// app.opener().open_url("https://github.com/tauri-apps/tauri", None::<&str>)?;
|
||||
/// Ok(())
|
||||
/// });
|
||||
/// ```
|
||||
///
|
||||
/// ## Platform-specific:
|
||||
///
|
||||
/// - **Android / iOS**: Always opens using default program.
|
||||
@@ -60,6 +86,19 @@ impl<R: Runtime> Opener<R> {
|
||||
|
||||
/// Open a path with a default or specific program.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```rust,no_run
|
||||
/// use tauri_plugin_opener::OpenerExt;
|
||||
///
|
||||
/// tauri::Builder::default()
|
||||
/// .setup(|app| {
|
||||
/// // open the given path on the system default explorer
|
||||
/// app.opener().open_path("/path/to/file", None::<&str>)?;
|
||||
/// Ok(())
|
||||
/// });
|
||||
/// ```
|
||||
///
|
||||
/// ## Platform-specific:
|
||||
///
|
||||
/// - **Android / iOS**: Always opens using default program.
|
||||
@@ -74,6 +113,19 @@ impl<R: Runtime> Opener<R> {
|
||||
|
||||
/// Open a path with a default or specific program.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```rust,no_run
|
||||
/// use tauri_plugin_opener::OpenerExt;
|
||||
///
|
||||
/// tauri::Builder::default()
|
||||
/// .setup(|app| {
|
||||
/// // open the given path on the system default explorer
|
||||
/// app.opener().open_path("/path/to/file", None::<&str>)?;
|
||||
/// Ok(())
|
||||
/// });
|
||||
/// ```
|
||||
///
|
||||
/// ## Platform-specific:
|
||||
///
|
||||
/// - **Android / iOS**: Always opens using default program.
|
||||
@@ -98,7 +150,7 @@ pub trait OpenerExt<R: Runtime> {
|
||||
fn opener(&self) -> &Opener<R>;
|
||||
}
|
||||
|
||||
impl<R: Runtime, T: Manager<R>> crate::OpenerExt<R> for T {
|
||||
impl<R: Runtime, T: Manager<R>> OpenerExt<R> for T {
|
||||
fn opener(&self) -> &Opener<R> {
|
||||
self.state::<Opener<R>>().inner()
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ pub(crate) fn open<P: AsRef<OsStr>, S: AsRef<str>>(path: P, with: Option<S>) ->
|
||||
/// tauri::Builder::default()
|
||||
/// .setup(|app| {
|
||||
/// // open the given URL on the system default browser
|
||||
/// tauri_plugin_opener::open_url("https://github.com/tauri-apps/tauri", None)?;
|
||||
/// tauri_plugin_opener::open_url("https://github.com/tauri-apps/tauri", None::<&str>)?;
|
||||
/// Ok(())
|
||||
/// });
|
||||
/// ```
|
||||
@@ -46,12 +46,16 @@ pub fn open_url<P: AsRef<str>, S: AsRef<str>>(url: P, with: Option<S>) -> crate:
|
||||
/// ```rust,no_run
|
||||
/// tauri::Builder::default()
|
||||
/// .setup(|app| {
|
||||
/// // open the given URL on the system default browser
|
||||
/// tauri_plugin_opener::open_path("/path/to/file", None)?;
|
||||
/// // open the given URL on the system default explorer
|
||||
/// tauri_plugin_opener::open_path("/path/to/file", None::<&str>)?;
|
||||
/// Ok(())
|
||||
/// });
|
||||
/// ```
|
||||
pub fn open_path<P: AsRef<Path>, S: AsRef<str>>(path: P, with: Option<S>) -> crate::Result<()> {
|
||||
let path = path.as_ref();
|
||||
if with.is_none() {
|
||||
// Returns an IO error if not exists, and besides `exists()` is a shorthand for `metadata()`
|
||||
_ = path.metadata()?;
|
||||
}
|
||||
open(path, with)
|
||||
}
|
||||
|
||||
@@ -31,5 +31,5 @@ log = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
os_info = "3"
|
||||
sys-locale = "0.3"
|
||||
gethostname = "0.5"
|
||||
gethostname = "1.0"
|
||||
serialize-to-javascript = "=0.1.1"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
## Default Permission
|
||||
|
||||
This permission set configures which
|
||||
process feeatures are by default exposed.
|
||||
process features are by default exposed.
|
||||
|
||||
#### Granted Permissions
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
[default]
|
||||
description = """
|
||||
This permission set configures which
|
||||
process feeatures are by default exposed.
|
||||
process features are by default exposed.
|
||||
|
||||
#### Granted Permissions
|
||||
|
||||
|
||||
@@ -315,7 +315,7 @@
|
||||
"const": "deny-restart"
|
||||
},
|
||||
{
|
||||
"description": "This permission set configures which\nprocess feeatures are by default exposed.\n\n#### Granted Permissions\n\nThis enables to quit via `allow-exit` and restart via `allow-restart`\nthe application.\n",
|
||||
"description": "This permission set configures which\nprocess features are by default exposed.\n\n#### Granted Permissions\n\nThis enables to quit via `allow-exit` and restart via `allow-restart`\nthe application.\n",
|
||||
"type": "string",
|
||||
"const": "default"
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
if("__TAURI__"in window){var __TAURI_PLUGIN_SHELL__=function(e){"use strict";function t(e,t,s,n){if("a"===s&&!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"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)}function s(e,t,s,n,i){if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,s),s}var n,i,r;"function"==typeof SuppressedError&&SuppressedError;const o="__TAURI_TO_IPC_KEY__";class a{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,n.set(this,(()=>{})),i.set(this,0),r.set(this,{}),this.id=function(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}((({message:e,id:o})=>{if(o===t(this,i,"f")){s(this,i,o+1),t(this,n,"f").call(this,e);const a=Object.keys(t(this,r,"f"));if(a.length>0){let e=o+1;for(const s of a.sort()){if(parseInt(s)!==e)break;{const i=t(this,r,"f")[s];delete t(this,r,"f")[s],t(this,n,"f").call(this,i),e+=1}}s(this,i,e)}}else t(this,r,"f")[o.toString()]=e}))}set onmessage(e){s(this,n,e)}get onmessage(){return t(this,n,"f")}[(n=new WeakMap,i=new WeakMap,r=new WeakMap,o)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[o]()}}async function h(e,t={},s){return window.__TAURI_INTERNALS__.invoke(e,t,s)}class c{constructor(){this.eventListeners=Object.create(null)}addListener(e,t){return this.on(e,t)}removeListener(e,t){return this.off(e,t)}on(e,t){return e in this.eventListeners?this.eventListeners[e].push(t):this.eventListeners[e]=[t],this}once(e,t){const s=n=>{this.removeListener(e,s),t(n)};return this.addListener(e,s)}off(e,t){return e in this.eventListeners&&(this.eventListeners[e]=this.eventListeners[e].filter((e=>e!==t))),this}removeAllListeners(e){return e?delete this.eventListeners[e]:this.eventListeners=Object.create(null),this}emit(e,t){if(e in this.eventListeners){const s=this.eventListeners[e];for(const e of s)e(t);return!0}return!1}listenerCount(e){return e in this.eventListeners?this.eventListeners[e].length:0}prependListener(e,t){return e in this.eventListeners?this.eventListeners[e].unshift(t):this.eventListeners[e]=[t],this}prependOnceListener(e,t){const s=n=>{this.removeListener(e,s),t(n)};return this.prependListener(e,s)}}class l{constructor(e){this.pid=e}async write(e){await h("plugin:shell|stdin_write",{pid:this.pid,buffer:e})}async kill(){await h("plugin:shell|kill",{cmd:"killChild",pid:this.pid})}}class u extends c{constructor(e,t=[],s){super(),this.stdout=new c,this.stderr=new c,this.program=e,this.args="string"==typeof t?[t]:t,this.options=s??{}}static create(e,t=[],s){return new u(e,t,s)}static sidecar(e,t=[],s){const n=new u(e,t,s);return n.options.sidecar=!0,n}async spawn(){const e=this.program,t=this.args,s=this.options;"object"==typeof t&&Object.freeze(t);const n=new a;return n.onmessage=e=>{switch(e.event){case"Error":this.emit("error",e.payload);break;case"Terminated":this.emit("close",e.payload);break;case"Stdout":this.stdout.emit("data",e.payload);break;case"Stderr":this.stderr.emit("data",e.payload)}},await h("plugin:shell|spawn",{program:e,args:t,options:s,onEvent:n}).then((e=>new l(e)))}async execute(){const e=this.program,t=this.args,s=this.options;return"object"==typeof t&&Object.freeze(t),await h("plugin:shell|execute",{program:e,args:t,options:s})}}return e.Child=l,e.Command=u,e.EventEmitter=c,e.open=async function(e,t){await h("plugin:shell|open",{path:e,with:t})},e}({});Object.defineProperty(window.__TAURI__,"shell",{value:__TAURI_PLUGIN_SHELL__})}
|
||||
if("__TAURI__"in window){var __TAURI_PLUGIN_SHELL__=function(e){"use strict";function t(e,t,s,i){if("function"==typeof t||!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?i:"a"===s?i.call(e):i?i.value:t.get(e)}function s(e,t,s,i,n){if("function"==typeof t||!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,s),s}var i,n,r;"function"==typeof SuppressedError&&SuppressedError;const o="__TAURI_TO_IPC_KEY__";class a{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,i.set(this,(()=>{})),n.set(this,0),r.set(this,[]),this.id=function(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}((({message:e,id:o})=>{if(o==t(this,n,"f"))for(t(this,i,"f").call(this,e),s(this,n,t(this,n,"f")+1);t(this,n,"f")in t(this,r,"f");){const e=t(this,r,"f")[t(this,n,"f")];t(this,i,"f").call(this,e),delete t(this,r,"f")[t(this,n,"f")],s(this,n,t(this,n,"f")+1)}else t(this,r,"f")[o]=e}))}set onmessage(e){s(this,i,e)}get onmessage(){return t(this,i,"f")}[(i=new WeakMap,n=new WeakMap,r=new WeakMap,o)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[o]()}}async function h(e,t={},s){return window.__TAURI_INTERNALS__.invoke(e,t,s)}class c{constructor(){this.eventListeners=Object.create(null)}addListener(e,t){return this.on(e,t)}removeListener(e,t){return this.off(e,t)}on(e,t){return e in this.eventListeners?this.eventListeners[e].push(t):this.eventListeners[e]=[t],this}once(e,t){const s=i=>{this.removeListener(e,s),t(i)};return this.addListener(e,s)}off(e,t){return e in this.eventListeners&&(this.eventListeners[e]=this.eventListeners[e].filter((e=>e!==t))),this}removeAllListeners(e){return e?delete this.eventListeners[e]:this.eventListeners=Object.create(null),this}emit(e,t){if(e in this.eventListeners){const s=this.eventListeners[e];for(const e of s)e(t);return!0}return!1}listenerCount(e){return e in this.eventListeners?this.eventListeners[e].length:0}prependListener(e,t){return e in this.eventListeners?this.eventListeners[e].unshift(t):this.eventListeners[e]=[t],this}prependOnceListener(e,t){const s=i=>{this.removeListener(e,s),t(i)};return this.prependListener(e,s)}}class l{constructor(e){this.pid=e}async write(e){await h("plugin:shell|stdin_write",{pid:this.pid,buffer:e})}async kill(){await h("plugin:shell|kill",{cmd:"killChild",pid:this.pid})}}class u extends c{constructor(e,t=[],s){super(),this.stdout=new c,this.stderr=new c,this.program=e,this.args="string"==typeof t?[t]:t,this.options=s??{}}static create(e,t=[],s){return new u(e,t,s)}static sidecar(e,t=[],s){const i=new u(e,t,s);return i.options.sidecar=!0,i}async spawn(){const e=this.program,t=this.args,s=this.options;"object"==typeof t&&Object.freeze(t);const i=new a;return i.onmessage=e=>{switch(e.event){case"Error":this.emit("error",e.payload);break;case"Terminated":this.emit("close",e.payload);break;case"Stdout":this.stdout.emit("data",e.payload);break;case"Stderr":this.stderr.emit("data",e.payload)}},await h("plugin:shell|spawn",{program:e,args:t,options:s,onEvent:i}).then((e=>new l(e)))}async execute(){const e=this.program,t=this.args,s=this.options;return"object"==typeof t&&Object.freeze(t),await h("plugin:shell|execute",{program:e,args:t,options:s})}}return e.Child=l,e.Command=u,e.EventEmitter=c,e.open=async function(e,t){await h("plugin:shell|open",{path:e,with:t})},e}({});Object.defineProperty(window.__TAURI__,"shell",{value:__TAURI_PLUGIN_SHELL__})}
|
||||
|
||||
@@ -12,11 +12,11 @@ function openLinks(): void {
|
||||
if (target.matches('a')) {
|
||||
const t = target as HTMLAnchorElement
|
||||
if (
|
||||
t.href !== '' &&
|
||||
['http://', 'https://', 'mailto:', 'tel:'].some((v) =>
|
||||
t.href !== ''
|
||||
&& ['http://', 'https://', 'mailto:', 'tel:'].some((v) =>
|
||||
t.href.startsWith(v)
|
||||
) &&
|
||||
t.target === '_blank'
|
||||
)
|
||||
&& t.target === '_blank'
|
||||
) {
|
||||
void invoke('plugin:shell|open', {
|
||||
path: t.href
|
||||
@@ -31,8 +31,8 @@ function openLinks(): void {
|
||||
}
|
||||
|
||||
if (
|
||||
document.readyState === 'complete' ||
|
||||
document.readyState === 'interactive'
|
||||
document.readyState === 'complete'
|
||||
|| document.readyState === 'interactive'
|
||||
) {
|
||||
openLinks()
|
||||
} else {
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# Changelog
|
||||
|
||||
## \[2.2.2]
|
||||
|
||||
- [`1ab5f157`](https://github.com/tauri-apps/plugins-workspace/commit/1ab5f1576333174095bc7dad4bef7a8576bb29ab) ([#2452](https://github.com/tauri-apps/plugins-workspace/pull/2452) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Fixed `null pointer dereference` panic on rust nightly on Windows.
|
||||
|
||||
## \[2.2.1]
|
||||
|
||||
- [`da5c59e2`](https://github.com/tauri-apps/plugins-workspace/commit/da5c59e2fe879d177e3cfd52fcacce85440423cb) ([#2271](https://github.com/tauri-apps/plugins-workspace/pull/2271) by [@renovate](https://github.com/tauri-apps/plugins-workspace/../../renovate)) Updated `zbus` dependency to version 5. 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-single-instance"
|
||||
version = "2.2.0"
|
||||
version = "2.2.2"
|
||||
description = "Ensure a single instance of your tauri app is running."
|
||||
authors = { workspace = true }
|
||||
license = { workspace = true }
|
||||
|
||||
@@ -9,6 +9,6 @@
|
||||
"author": "",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@tauri-apps/cli": "2.1.0"
|
||||
"@tauri-apps/cli": "2.2.7"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,5 +3,5 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
fn main() {
|
||||
tauri_build::build()
|
||||
tauri_build::build()
|
||||
}
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
max_width = 100
|
||||
hard_tabs = false
|
||||
tab_spaces = 2
|
||||
newline_style = "Auto"
|
||||
use_small_heuristics = "Default"
|
||||
reorder_imports = true
|
||||
reorder_modules = true
|
||||
remove_nested_parens = true
|
||||
edition = "2021"
|
||||
merge_derives = true
|
||||
use_try_shorthand = false
|
||||
use_field_init_shorthand = false
|
||||
force_explicit_abi = true
|
||||
imports_granularity = "Crate"
|
||||
@@ -3,16 +3,15 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
#![cfg_attr(
|
||||
all(not(debug_assertions), target_os = "windows"),
|
||||
windows_subsystem = "windows"
|
||||
all(not(debug_assertions), target_os = "windows"),
|
||||
windows_subsystem = "windows"
|
||||
)]
|
||||
|
||||
fn main() {
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_cli::init())
|
||||
.plugin(tauri_plugin_single_instance::init(|app, argv, cwd| {
|
||||
println!("{}, {argv:?}, {cwd}", app.package_info().name);
|
||||
}))
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_single_instance::init(|app, argv, cwd| {
|
||||
println!("{}, {argv:?}, {cwd}", app.package_info().name);
|
||||
}))
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
|
||||
@@ -20,18 +20,38 @@ use windows_sys::Win32::{
|
||||
},
|
||||
UI::WindowsAndMessaging::{
|
||||
self as w32wm, CreateWindowExW, DefWindowProcW, DestroyWindow, FindWindowW,
|
||||
RegisterClassExW, SendMessageW, GWL_STYLE, GWL_USERDATA, WINDOW_LONG_PTR_INDEX,
|
||||
WM_COPYDATA, WM_DESTROY, WNDCLASSEXW, WS_EX_LAYERED, WS_EX_NOACTIVATE, WS_EX_TOOLWINDOW,
|
||||
WS_EX_TRANSPARENT, WS_OVERLAPPED, WS_POPUP, WS_VISIBLE,
|
||||
RegisterClassExW, SendMessageW, CREATESTRUCTW, GWLP_USERDATA, GWL_STYLE,
|
||||
WINDOW_LONG_PTR_INDEX, WM_COPYDATA, WM_CREATE, WM_DESTROY, WNDCLASSEXW, WS_EX_LAYERED,
|
||||
WS_EX_NOACTIVATE, WS_EX_TOOLWINDOW, WS_EX_TRANSPARENT, WS_OVERLAPPED, WS_POPUP, WS_VISIBLE,
|
||||
},
|
||||
};
|
||||
|
||||
struct MutexHandle(isize);
|
||||
struct TargetWindowHandle(isize);
|
||||
|
||||
const WMCOPYDATA_SINGLE_INSTANCE_DATA: usize = 1542;
|
||||
|
||||
pub fn init<R: Runtime>(f: Box<SingleInstanceCallback<R>>) -> TauriPlugin<R> {
|
||||
struct MutexHandle(isize);
|
||||
|
||||
struct TargetWindowHandle(isize);
|
||||
|
||||
struct UserData<R: Runtime> {
|
||||
app: AppHandle<R>,
|
||||
callback: Box<SingleInstanceCallback<R>>,
|
||||
}
|
||||
|
||||
impl<R: Runtime> UserData<R> {
|
||||
unsafe fn from_hwnd_raw(hwnd: HWND) -> *mut Self {
|
||||
GetWindowLongPtrW(hwnd, GWLP_USERDATA) as *mut Self
|
||||
}
|
||||
|
||||
unsafe fn from_hwnd<'a>(hwnd: HWND) -> &'a mut Self {
|
||||
&mut *Self::from_hwnd_raw(hwnd)
|
||||
}
|
||||
|
||||
fn run_callback(&mut self, args: Vec<String>, cwd: String) {
|
||||
(self.callback)(&self.app, args, cwd)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn init<R: Runtime>(callback: Box<SingleInstanceCallback<R>>) -> TauriPlugin<R> {
|
||||
plugin::Builder::new("single-instance")
|
||||
.setup(|app, _api| {
|
||||
#[allow(unused_mut)]
|
||||
@@ -54,21 +74,22 @@ pub fn init<R: Runtime>(f: Box<SingleInstanceCallback<R>>) -> TauriPlugin<R> {
|
||||
let hwnd = FindWindowW(class_name.as_ptr(), window_name.as_ptr());
|
||||
|
||||
if !hwnd.is_null() {
|
||||
let data = format!(
|
||||
"{}|{}\0",
|
||||
std::env::current_dir()
|
||||
.unwrap_or_default()
|
||||
.to_str()
|
||||
.unwrap_or_default(),
|
||||
std::env::args().collect::<Vec<String>>().join("|")
|
||||
);
|
||||
let cwd = std::env::current_dir().unwrap_or_default();
|
||||
let cwd = cwd.to_str().unwrap_or_default();
|
||||
|
||||
let args = std::env::args().collect::<Vec<String>>().join("|");
|
||||
|
||||
let data = format!("{cwd}|{args}\0",);
|
||||
|
||||
let bytes = data.as_bytes();
|
||||
let cds = COPYDATASTRUCT {
|
||||
dwData: WMCOPYDATA_SINGLE_INSTANCE_DATA,
|
||||
cbData: bytes.len() as _,
|
||||
lpData: bytes.as_ptr() as _,
|
||||
};
|
||||
|
||||
SendMessageW(hwnd, WM_COPYDATA, 0, &cds as *const _ as _);
|
||||
|
||||
app.cleanup_before_exit();
|
||||
std::process::exit(0);
|
||||
}
|
||||
@@ -76,15 +97,12 @@ pub fn init<R: Runtime>(f: Box<SingleInstanceCallback<R>>) -> TauriPlugin<R> {
|
||||
} else {
|
||||
app.manage(MutexHandle(hmutex as _));
|
||||
|
||||
let hwnd = create_event_target_window::<R>(&class_name, &window_name);
|
||||
unsafe {
|
||||
SetWindowLongPtrW(
|
||||
hwnd,
|
||||
GWL_USERDATA,
|
||||
Box::into_raw(Box::new((app.clone(), f))) as _,
|
||||
)
|
||||
let userdata = UserData {
|
||||
app: app.clone(),
|
||||
callback,
|
||||
};
|
||||
|
||||
let userdata = Box::into_raw(Box::new(userdata));
|
||||
let hwnd = create_event_target_window::<R>(&class_name, &window_name, userdata);
|
||||
app.manage(TargetWindowHandle(hwnd as _));
|
||||
}
|
||||
|
||||
@@ -116,32 +134,43 @@ unsafe extern "system" fn single_instance_window_proc<R: Runtime>(
|
||||
wparam: WPARAM,
|
||||
lparam: LPARAM,
|
||||
) -> LRESULT {
|
||||
let data_ptr = GetWindowLongPtrW(hwnd, GWL_USERDATA)
|
||||
as *mut (AppHandle<R>, Box<SingleInstanceCallback<R>>);
|
||||
let (app_handle, callback) = &mut *data_ptr;
|
||||
|
||||
match msg {
|
||||
WM_CREATE => {
|
||||
let create_struct = &*(lparam as *const CREATESTRUCTW);
|
||||
let userdata = create_struct.lpCreateParams as *const UserData<R>;
|
||||
SetWindowLongPtrW(hwnd, GWLP_USERDATA, userdata as _);
|
||||
0
|
||||
}
|
||||
|
||||
WM_COPYDATA => {
|
||||
let cds_ptr = lparam as *const COPYDATASTRUCT;
|
||||
if (*cds_ptr).dwData == WMCOPYDATA_SINGLE_INSTANCE_DATA {
|
||||
let userdata = UserData::<R>::from_hwnd(hwnd);
|
||||
|
||||
let data = CStr::from_ptr((*cds_ptr).lpData as _).to_string_lossy();
|
||||
let mut s = data.split('|');
|
||||
let cwd = s.next().unwrap();
|
||||
let args = s.map(|s| s.to_string()).collect();
|
||||
callback(app_handle, args, cwd.to_string());
|
||||
|
||||
userdata.run_callback(args, cwd.to_string());
|
||||
}
|
||||
1
|
||||
}
|
||||
|
||||
WM_DESTROY => {
|
||||
let _ = Box::from_raw(data_ptr);
|
||||
let userdata = UserData::<R>::from_hwnd_raw(hwnd);
|
||||
drop(Box::from_raw(userdata));
|
||||
0
|
||||
}
|
||||
_ => DefWindowProcW(hwnd, msg, wparam, lparam),
|
||||
}
|
||||
}
|
||||
|
||||
fn create_event_target_window<R: Runtime>(class_name: &[u16], window_name: &[u16]) -> HWND {
|
||||
fn create_event_target_window<R: Runtime>(
|
||||
class_name: &[u16],
|
||||
window_name: &[u16],
|
||||
userdata: *const UserData<R>,
|
||||
) -> HWND {
|
||||
unsafe {
|
||||
let class = WNDCLASSEXW {
|
||||
cbSize: std::mem::size_of::<WNDCLASSEXW>() as u32,
|
||||
@@ -182,7 +211,7 @@ fn create_event_target_window<R: Runtime>(class_name: &[u16], window_name: &[u16
|
||||
std::ptr::null_mut(),
|
||||
std::ptr::null_mut(),
|
||||
GetModuleHandleW(std::ptr::null()),
|
||||
std::ptr::null(),
|
||||
userdata as _,
|
||||
);
|
||||
SetWindowLongPtrW(
|
||||
hwnd,
|
||||
|
||||
@@ -19,7 +19,7 @@ windows = { level = "full", notes = "" }
|
||||
linux = { level = "full", notes = "" }
|
||||
macos = { level = "full", notes = "" }
|
||||
android = { level = "full", notes = "" }
|
||||
ios = { level = "none", notes = "" }
|
||||
ios = { level = "full", notes = "" }
|
||||
|
||||
[build-dependencies]
|
||||
tauri-plugin = { workspace = true, features = ["build"] }
|
||||
|
||||
@@ -1 +1 @@
|
||||
if("__TAURI__"in window){var __TAURI_PLUGIN_STORE__=function(t){"use strict";var e,a;function r(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}async function s(t,e={},a){return window.__TAURI_INTERNALS__.invoke(t,e,a)}"function"==typeof SuppressedError&&SuppressedError;class i{get rid(){return function(t,e,a,r){if("a"===a&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===a?r:"a"===a?r.call(t):r?r.value:e.get(t)}(this,e,"f")}constructor(t){e.set(this,void 0),function(t,e,a,r,s){if("function"==typeof e?t!==e||!s:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");e.set(t,a)}(this,e,t)}async close(){return s("plugin:resources|close",{rid:this.rid})}}async function n(t,e,a){const i={kind:"Any"};return s("plugin:event|listen",{event:t,target:i,handler:r(e)}).then((e=>async()=>async function(t,e){await s("plugin:event|unlisten",{event:t,eventId:e})}(t,e)))}async function o(t,e){return await u.load(t,e)}e=new WeakMap,function(t){t.WINDOW_RESIZED="tauri://resize",t.WINDOW_MOVED="tauri://move",t.WINDOW_CLOSE_REQUESTED="tauri://close-requested",t.WINDOW_DESTROYED="tauri://destroyed",t.WINDOW_FOCUS="tauri://focus",t.WINDOW_BLUR="tauri://blur",t.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",t.WINDOW_THEME_CHANGED="tauri://theme-changed",t.WINDOW_CREATED="tauri://window-created",t.WEBVIEW_CREATED="tauri://webview-created",t.DRAG_ENTER="tauri://drag-enter",t.DRAG_OVER="tauri://drag-over",t.DRAG_DROP="tauri://drag-drop",t.DRAG_LEAVE="tauri://drag-leave"}(a||(a={}));class u extends i{constructor(t){super(t)}static async load(t,e){const a=await s("plugin:store|load",{path:t,...e});return new u(a)}static async get(t){return await s("plugin:store|get_store",{path:t}).then((t=>t?new u(t):null))}async set(t,e){await s("plugin:store|set",{rid:this.rid,key:t,value:e})}async get(t){const[e,a]=await s("plugin:store|get",{rid:this.rid,key:t});return a?e:void 0}async has(t){return await s("plugin:store|has",{rid:this.rid,key:t})}async delete(t){return await s("plugin:store|delete",{rid:this.rid,key:t})}async clear(){await s("plugin:store|clear",{rid:this.rid})}async reset(){await s("plugin:store|reset",{rid:this.rid})}async keys(){return await s("plugin:store|keys",{rid:this.rid})}async values(){return await s("plugin:store|values",{rid:this.rid})}async entries(){return await s("plugin:store|entries",{rid:this.rid})}async length(){return await s("plugin:store|length",{rid:this.rid})}async reload(){await s("plugin:store|reload",{rid:this.rid})}async save(){await s("plugin:store|save",{rid:this.rid})}async onKeyChange(t,e){return await n("store://change",(a=>{a.payload.resourceId===this.rid&&a.payload.key===t&&e(a.payload.exists?a.payload.value:void 0)}))}async onChange(t){return await n("store://change",(e=>{e.payload.resourceId===this.rid&&t(e.payload.key,e.payload.exists?e.payload.value:void 0)}))}}return t.LazyStore=class{get store(){return this._store||(this._store=o(this.path,this.options)),this._store}constructor(t,e){this.path=t,this.options=e}async init(){await this.store}async set(t,e){return(await this.store).set(t,e)}async get(t){return(await this.store).get(t)}async has(t){return(await this.store).has(t)}async delete(t){return(await this.store).delete(t)}async clear(){await(await this.store).clear()}async reset(){await(await this.store).reset()}async keys(){return(await this.store).keys()}async values(){return(await this.store).values()}async entries(){return(await this.store).entries()}async length(){return(await this.store).length()}async reload(){await(await this.store).reload()}async save(){await(await this.store).save()}async onKeyChange(t,e){return(await this.store).onKeyChange(t,e)}async onChange(t){return(await this.store).onChange(t)}async close(){this._store&&await(await this._store).close()}},t.Store=u,t.getStore=async function(t){return await u.get(t)},t.load=o,t}({});Object.defineProperty(window.__TAURI__,"store",{value:__TAURI_PLUGIN_STORE__})}
|
||||
if("__TAURI__"in window){var __TAURI_PLUGIN_STORE__=function(t){"use strict";var e,a;function r(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}async function s(t,e={},a){return window.__TAURI_INTERNALS__.invoke(t,e,a)}"function"==typeof SuppressedError&&SuppressedError;class i{get rid(){return function(t,e,a,r){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"===a?r:"a"===a?r.call(t):r?r.value:e.get(t)}(this,e,"f")}constructor(t){e.set(this,void 0),function(t,e,a){if("function"==typeof e||!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");e.set(t,a)}(this,e,t)}async close(){return s("plugin:resources|close",{rid:this.rid})}}async function n(t,e,a){const i={kind:"Any"};return s("plugin:event|listen",{event:t,target:i,handler:r(e)}).then((e=>async()=>async function(t,e){await s("plugin:event|unlisten",{event:t,eventId:e})}(t,e)))}async function o(t,e){return await u.load(t,e)}e=new WeakMap,function(t){t.WINDOW_RESIZED="tauri://resize",t.WINDOW_MOVED="tauri://move",t.WINDOW_CLOSE_REQUESTED="tauri://close-requested",t.WINDOW_DESTROYED="tauri://destroyed",t.WINDOW_FOCUS="tauri://focus",t.WINDOW_BLUR="tauri://blur",t.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",t.WINDOW_THEME_CHANGED="tauri://theme-changed",t.WINDOW_CREATED="tauri://window-created",t.WEBVIEW_CREATED="tauri://webview-created",t.DRAG_ENTER="tauri://drag-enter",t.DRAG_OVER="tauri://drag-over",t.DRAG_DROP="tauri://drag-drop",t.DRAG_LEAVE="tauri://drag-leave"}(a||(a={}));class u extends i{constructor(t){super(t)}static async load(t,e){const a=await s("plugin:store|load",{path:t,...e});return new u(a)}static async get(t){return await s("plugin:store|get_store",{path:t}).then((t=>t?new u(t):null))}async set(t,e){await s("plugin:store|set",{rid:this.rid,key:t,value:e})}async get(t){const[e,a]=await s("plugin:store|get",{rid:this.rid,key:t});return a?e:void 0}async has(t){return await s("plugin:store|has",{rid:this.rid,key:t})}async delete(t){return await s("plugin:store|delete",{rid:this.rid,key:t})}async clear(){await s("plugin:store|clear",{rid:this.rid})}async reset(){await s("plugin:store|reset",{rid:this.rid})}async keys(){return await s("plugin:store|keys",{rid:this.rid})}async values(){return await s("plugin:store|values",{rid:this.rid})}async entries(){return await s("plugin:store|entries",{rid:this.rid})}async length(){return await s("plugin:store|length",{rid:this.rid})}async reload(){await s("plugin:store|reload",{rid:this.rid})}async save(){await s("plugin:store|save",{rid:this.rid})}async onKeyChange(t,e){return await n("store://change",(a=>{a.payload.resourceId===this.rid&&a.payload.key===t&&e(a.payload.exists?a.payload.value:void 0)}))}async onChange(t){return await n("store://change",(e=>{e.payload.resourceId===this.rid&&t(e.payload.key,e.payload.exists?e.payload.value:void 0)}))}}return t.LazyStore=class{get store(){return this._store||(this._store=o(this.path,this.options)),this._store}constructor(t,e){this.path=t,this.options=e}async init(){await this.store}async set(t,e){return(await this.store).set(t,e)}async get(t){return(await this.store).get(t)}async has(t){return(await this.store).has(t)}async delete(t){return(await this.store).delete(t)}async clear(){await(await this.store).clear()}async reset(){await(await this.store).reset()}async keys(){return(await this.store).keys()}async values(){return(await this.store).values()}async entries(){return(await this.store).entries()}async length(){return(await this.store).length()}async reload(){await(await this.store).reload()}async save(){await(await this.store).save()}async onKeyChange(t,e){return(await this.store).onKeyChange(t,e)}async onChange(t){return(await this.store).onChange(t)}async close(){this._store&&await(await this._store).close()}},t.Store=u,t.getStore=async function(t){return await u.get(t)},t.load=o,t}({});Object.defineProperty(window.__TAURI__,"store",{value:__TAURI_PLUGIN_STORE__})}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"tauri": "tauri"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tauri-apps/cli": "2.1.0",
|
||||
"@tauri-apps/cli": "2.2.7",
|
||||
"vite": "^6.0.0",
|
||||
"typescript": "^5.4.7"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,26 @@
|
||||
# Changelog
|
||||
|
||||
## \[2.5.1]
|
||||
|
||||
- [`6f881293`](https://github.com/tauri-apps/plugins-workspace/commit/6f881293fcd67838f6f3f8063f536292431dd1f7) ([#2439](https://github.com/tauri-apps/plugins-workspace/pull/2439) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) Fixed an issue that caused the plugin to emit a `ReleaseNotFound` error instead of a `Reqwest` error when the http request in `check()` failed.
|
||||
|
||||
## \[2.5.0]
|
||||
|
||||
- [`5369898d`](https://github.com/tauri-apps/plugins-workspace/commit/5369898db7a6098e3e2f43436100ea556d405628) ([#2067](https://github.com/tauri-apps/plugins-workspace/pull/2067) by [@jLynx](https://github.com/tauri-apps/plugins-workspace/../../jLynx)) Fix update installation on macOS when using an user without admin privileges.
|
||||
- [`5369898d`](https://github.com/tauri-apps/plugins-workspace/commit/5369898db7a6098e3e2f43436100ea556d405628) ([#2067](https://github.com/tauri-apps/plugins-workspace/pull/2067) by [@jLynx](https://github.com/tauri-apps/plugins-workspace/../../jLynx)) Remove the `UpdaterBuilder::new` function, use `UpdaterExt::updater_builder` instead.
|
||||
|
||||
## \[2.4.0]
|
||||
|
||||
- [`0afc9b6b`](https://github.com/tauri-apps/plugins-workspace/commit/0afc9b6be07bee1077f05a86285d977e57810ed9) ([#2325](https://github.com/tauri-apps/plugins-workspace/pull/2325) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) The `Update` struct/object will now contain a `raw_json`/`rawJson` property to be able to read parts of server's json response that are not handled by the plugin.
|
||||
|
||||
## \[2.3.1]
|
||||
|
||||
- [`57efb47c`](https://github.com/tauri-apps/plugins-workspace/commit/57efb47c116f880477f72f02a8e4239e88007d44) ([#2235](https://github.com/tauri-apps/plugins-workspace/pull/2235) by [@amrbashir](https://github.com/tauri-apps/plugins-workspace/../../amrbashir)) Add `Builder::header` and `Builder::headers` method to configure default headers for updater.
|
||||
|
||||
## \[2.3.0]
|
||||
|
||||
- [`829b6326`](https://github.com/tauri-apps/plugins-workspace/commit/829b63265030bc9c61d1738c4eaca0ffb3178677) ([#1919](https://github.com/tauri-apps/plugins-workspace/pull/1919) by [@n1ght-hunter](https://github.com/tauri-apps/plugins-workspace/../../n1ght-hunter)) Add `tauri_plugin_updater::Builder::default_version_comparator` method to set the default version comparator for the updater.
|
||||
|
||||
## \[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-updater"
|
||||
version = "2.2.0"
|
||||
version = "2.5.1"
|
||||
description = "In-app updates for Tauri applications."
|
||||
edition = { workspace = true }
|
||||
authors = { workspace = true }
|
||||
@@ -43,7 +43,7 @@ base64 = "0.22"
|
||||
semver = { version = "1", features = ["serde"] }
|
||||
futures-util = "0.3"
|
||||
tempfile = "3"
|
||||
infer = "0.16"
|
||||
infer = "0.19"
|
||||
percent-encoding = "2.3"
|
||||
|
||||
[target."cfg(target_os = \"windows\")".dependencies]
|
||||
@@ -55,13 +55,14 @@ windows-sys = { version = "0.59.0", features = [
|
||||
] }
|
||||
|
||||
[target."cfg(target_os = \"linux\")".dependencies]
|
||||
dirs = "5"
|
||||
dirs = "6"
|
||||
tar = { version = "0.4", optional = true }
|
||||
flate2 = { version = "1", optional = true }
|
||||
|
||||
[target."cfg(target_os = \"macos\")".dependencies]
|
||||
tar = "0.4"
|
||||
flate2 = "1"
|
||||
osakit = { version = "0.3", features = ["full"] }
|
||||
|
||||
[features]
|
||||
default = ["rustls-tls", "zip"]
|
||||
|
||||
@@ -1 +1 @@
|
||||
if("__TAURI__"in window){var __TAURI_PLUGIN_UPDATER__=function(e){"use strict";function t(e,t,s,n){if("a"===s&&!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"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)}function s(e,t,s,n,i){if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,s),s}var n,i,r,a;"function"==typeof SuppressedError&&SuppressedError;const o="__TAURI_TO_IPC_KEY__";class d{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,n.set(this,(()=>{})),i.set(this,0),r.set(this,{}),this.id=function(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}((({message:e,id:a})=>{if(a===t(this,i,"f")){s(this,i,a+1),t(this,n,"f").call(this,e);const o=Object.keys(t(this,r,"f"));if(o.length>0){let e=a+1;for(const s of o.sort()){if(parseInt(s)!==e)break;{const i=t(this,r,"f")[s];delete t(this,r,"f")[s],t(this,n,"f").call(this,i),e+=1}}s(this,i,e)}}else t(this,r,"f")[a.toString()]=e}))}set onmessage(e){s(this,n,e)}get onmessage(){return t(this,n,"f")}[(n=new WeakMap,i=new WeakMap,r=new WeakMap,o)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[o]()}}async function l(e,t={},s){return window.__TAURI_INTERNALS__.invoke(e,t,s)}class c{get rid(){return t(this,a,"f")}constructor(e){a.set(this,void 0),s(this,a,e)}async close(){return l("plugin:resources|close",{rid:this.rid})}}a=new WeakMap;class h extends c{constructor(e){super(e.rid),this.available=e.available,this.currentVersion=e.currentVersion,this.version=e.version,this.date=e.date,this.body=e.body}async download(e,t){const s=new d;e&&(s.onmessage=e);const n=await l("plugin:updater|download",{onEvent:s,rid:this.rid,...t});this.downloadedBytes=new c(n)}async install(){if(!this.downloadedBytes)throw new Error("Update.install called before Update.download");await l("plugin:updater|install",{updateRid:this.rid,bytesRid:this.downloadedBytes.rid}),this.downloadedBytes=void 0}async downloadAndInstall(e,t){const s=new d;e&&(s.onmessage=e),await l("plugin:updater|download_and_install",{onEvent:s,rid:this.rid,...t})}async close(){await(this.downloadedBytes?.close()),await super.close()}}return e.Update=h,e.check=async function(e){return e?.headers&&(e.headers=Array.from(new Headers(e.headers).entries())),await l("plugin:updater|check",{...e}).then((e=>e.available?new h(e):null))},e}({});Object.defineProperty(window.__TAURI__,"updater",{value:__TAURI_PLUGIN_UPDATER__})}
|
||||
if("__TAURI__"in window){var __TAURI_PLUGIN_UPDATER__=function(e){"use strict";function t(e,t,s,n){if("function"==typeof t||!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(e):n?n.value:t.get(e)}function s(e,t,s,n,i){if("function"==typeof t||!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,s),s}var n,i,a,r;"function"==typeof SuppressedError&&SuppressedError;const o="__TAURI_TO_IPC_KEY__";class d{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,n.set(this,(()=>{})),i.set(this,0),a.set(this,[]),this.id=function(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}((({message:e,id:r})=>{if(r==t(this,i,"f"))for(t(this,n,"f").call(this,e),s(this,i,t(this,i,"f")+1);t(this,i,"f")in t(this,a,"f");){const e=t(this,a,"f")[t(this,i,"f")];t(this,n,"f").call(this,e),delete t(this,a,"f")[t(this,i,"f")],s(this,i,t(this,i,"f")+1)}else t(this,a,"f")[r]=e}))}set onmessage(e){s(this,n,e)}get onmessage(){return t(this,n,"f")}[(n=new WeakMap,i=new WeakMap,a=new WeakMap,o)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[o]()}}async function l(e,t={},s){return window.__TAURI_INTERNALS__.invoke(e,t,s)}class h{get rid(){return t(this,r,"f")}constructor(e){r.set(this,void 0),s(this,r,e)}async close(){return l("plugin:resources|close",{rid:this.rid})}}r=new WeakMap;class c extends h{constructor(e){super(e.rid),this.available=e.available,this.currentVersion=e.currentVersion,this.version=e.version,this.date=e.date,this.body=e.body,this.rawJson=e.rawJson}async download(e,t){const s=new d;e&&(s.onmessage=e);const n=await l("plugin:updater|download",{onEvent:s,rid:this.rid,...t});this.downloadedBytes=new h(n)}async install(){if(!this.downloadedBytes)throw new Error("Update.install called before Update.download");await l("plugin:updater|install",{updateRid:this.rid,bytesRid:this.downloadedBytes.rid}),this.downloadedBytes=void 0}async downloadAndInstall(e,t){const s=new d;e&&(s.onmessage=e),await l("plugin:updater|download_and_install",{onEvent:s,rid:this.rid,...t})}async close(){await(this.downloadedBytes?.close()),await super.close()}}return e.Update=c,e.check=async function(e){return e?.headers&&(e.headers=Array.from(new Headers(e.headers).entries())),await l("plugin:updater|check",{...e}).then((e=>e.available?new c(e):null))},e}({});Object.defineProperty(window.__TAURI__,"updater",{value:__TAURI_PLUGIN_UPDATER__})}
|
||||
|
||||
@@ -43,6 +43,7 @@ interface UpdateMetadata {
|
||||
version: string
|
||||
date?: string
|
||||
body?: string
|
||||
rawJson: Record<string, unknown>
|
||||
}
|
||||
|
||||
/** Updater download event */
|
||||
@@ -57,6 +58,7 @@ class Update extends Resource {
|
||||
version: string
|
||||
date?: string
|
||||
body?: string
|
||||
rawJson: Record<string, unknown>
|
||||
private downloadedBytes?: Resource
|
||||
|
||||
constructor(metadata: UpdateMetadata) {
|
||||
@@ -66,6 +68,7 @@ class Update extends Resource {
|
||||
this.version = metadata.version
|
||||
this.date = metadata.date
|
||||
this.body = metadata.body
|
||||
this.rawJson = metadata.rawJson
|
||||
}
|
||||
|
||||
/** Download the updater package */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@tauri-apps/plugin-updater",
|
||||
"version": "2.2.0",
|
||||
"version": "2.5.1",
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"authors": [
|
||||
"Tauri Programme within The Commons Conservancy"
|
||||
|
||||
@@ -34,6 +34,7 @@ pub(crate) struct Metadata {
|
||||
version: String,
|
||||
date: Option<String>,
|
||||
body: Option<String>,
|
||||
raw_json: serde_json::Value,
|
||||
}
|
||||
|
||||
struct DownloadedBytes(pub Vec<u8>);
|
||||
@@ -73,6 +74,7 @@ pub(crate) async fn check<R: Runtime>(
|
||||
metadata.version.clone_from(&update.version);
|
||||
metadata.date = update.date.map(|d| d.to_string());
|
||||
metadata.body.clone_from(&update.body);
|
||||
metadata.raw_json.clone_from(&update.raw_json);
|
||||
metadata.rid = Some(webview.resources_table().add(update));
|
||||
}
|
||||
|
||||
|
||||
@@ -11,8 +11,10 @@
|
||||
html_favicon_url = "https://github.com/tauri-apps/tauri/raw/dev/app-icon.png"
|
||||
)]
|
||||
|
||||
use std::ffi::OsString;
|
||||
use std::{ffi::OsString, sync::Arc};
|
||||
|
||||
use http::{HeaderMap, HeaderName, HeaderValue};
|
||||
use semver::Version;
|
||||
use tauri::{
|
||||
plugin::{Builder as PluginBuilder, TauriPlugin},
|
||||
Manager, Runtime,
|
||||
@@ -68,14 +70,14 @@ pub trait UpdaterExt<R: Runtime> {
|
||||
impl<R: Runtime, T: Manager<R>> UpdaterExt<R> for T {
|
||||
fn updater_builder(&self) -> UpdaterBuilder {
|
||||
let app = self.app_handle();
|
||||
let package_info = app.package_info();
|
||||
let UpdaterState { config, target } = self.state::<UpdaterState>().inner();
|
||||
let UpdaterState {
|
||||
config,
|
||||
target,
|
||||
version_comparator,
|
||||
headers,
|
||||
} = self.state::<UpdaterState>().inner();
|
||||
|
||||
let mut builder = UpdaterBuilder::new(
|
||||
package_info.name.clone(),
|
||||
package_info.version.clone(),
|
||||
config.clone(),
|
||||
);
|
||||
let mut builder = UpdaterBuilder::new(app, config.clone()).headers(headers.clone());
|
||||
|
||||
if let Some(target) = target {
|
||||
builder = builder.target(target);
|
||||
@@ -86,6 +88,8 @@ impl<R: Runtime, T: Manager<R>> UpdaterExt<R> for T {
|
||||
builder = builder.current_exe_args(args);
|
||||
}
|
||||
|
||||
builder.version_comparator = version_comparator.clone();
|
||||
|
||||
#[cfg(any(
|
||||
target_os = "linux",
|
||||
target_os = "dragonfly",
|
||||
@@ -116,6 +120,8 @@ impl<R: Runtime, T: Manager<R>> UpdaterExt<R> for T {
|
||||
struct UpdaterState {
|
||||
target: Option<String>,
|
||||
config: Config,
|
||||
version_comparator: Option<VersionComparator>,
|
||||
headers: HeaderMap,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
@@ -123,6 +129,8 @@ pub struct Builder {
|
||||
target: Option<String>,
|
||||
pubkey: Option<String>,
|
||||
installer_args: Vec<OsString>,
|
||||
headers: HeaderMap,
|
||||
default_version_comparator: Option<VersionComparator>,
|
||||
}
|
||||
|
||||
impl Builder {
|
||||
@@ -163,10 +171,42 @@ impl Builder {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn header<K, V>(mut self, key: K, value: V) -> Result<Self>
|
||||
where
|
||||
HeaderName: TryFrom<K>,
|
||||
<HeaderName as TryFrom<K>>::Error: Into<http::Error>,
|
||||
HeaderValue: TryFrom<V>,
|
||||
<HeaderValue as TryFrom<V>>::Error: Into<http::Error>,
|
||||
{
|
||||
let key: std::result::Result<HeaderName, http::Error> = key.try_into().map_err(Into::into);
|
||||
let value: std::result::Result<HeaderValue, http::Error> =
|
||||
value.try_into().map_err(Into::into);
|
||||
self.headers.insert(key?, value?);
|
||||
|
||||
Ok(self)
|
||||
}
|
||||
|
||||
pub fn headers(mut self, headers: HeaderMap) -> Self {
|
||||
self.headers = headers;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn default_version_comparator<
|
||||
F: Fn(Version, RemoteRelease) -> bool + Send + Sync + 'static,
|
||||
>(
|
||||
mut self,
|
||||
f: F,
|
||||
) -> Self {
|
||||
self.default_version_comparator.replace(Arc::new(f));
|
||||
self
|
||||
}
|
||||
|
||||
pub fn build<R: Runtime>(self) -> TauriPlugin<R, Config> {
|
||||
let pubkey = self.pubkey;
|
||||
let target = self.target;
|
||||
let version_comparator = self.default_version_comparator;
|
||||
let installer_args = self.installer_args;
|
||||
let headers = self.headers;
|
||||
PluginBuilder::<R, Config>::new("updater")
|
||||
.setup(move |app, api| {
|
||||
let mut config = api.config().clone();
|
||||
@@ -176,7 +216,12 @@ impl Builder {
|
||||
if let Some(windows) = &mut config.windows {
|
||||
windows.installer_args.extend_from_slice(&installer_args);
|
||||
}
|
||||
app.manage(UpdaterState { target, config });
|
||||
app.manage(UpdaterState {
|
||||
target,
|
||||
config,
|
||||
version_comparator,
|
||||
headers,
|
||||
});
|
||||
Ok(())
|
||||
})
|
||||
.invoke_handler(tauri::generate_handler![
|
||||
|
||||
+122
-47
@@ -23,7 +23,7 @@ use reqwest::{
|
||||
};
|
||||
use semver::Version;
|
||||
use serde::{de::Error as DeError, Deserialize, Deserializer, Serialize};
|
||||
use tauri::{utils::platform::current_exe, Resource};
|
||||
use tauri::{utils::platform::current_exe, AppHandle, Resource, Runtime};
|
||||
use time::OffsetDateTime;
|
||||
use url::Url;
|
||||
|
||||
@@ -93,12 +93,18 @@ impl RemoteRelease {
|
||||
}
|
||||
|
||||
pub type OnBeforeExit = Arc<dyn Fn() + Send + Sync + 'static>;
|
||||
pub type VersionComparator = Arc<dyn Fn(Version, RemoteRelease) -> bool + Send + Sync>;
|
||||
type MainThreadClosure = Box<dyn FnOnce() + Send + Sync + 'static>;
|
||||
type RunOnMainThread =
|
||||
Box<dyn Fn(MainThreadClosure) -> std::result::Result<(), tauri::Error> + Send + Sync + 'static>;
|
||||
|
||||
pub struct UpdaterBuilder {
|
||||
#[allow(dead_code)]
|
||||
run_on_main_thread: RunOnMainThread,
|
||||
app_name: String,
|
||||
current_version: Version,
|
||||
config: Config,
|
||||
version_comparator: Option<Box<dyn Fn(Version, RemoteRelease) -> bool + Send + Sync>>,
|
||||
pub(crate) version_comparator: Option<VersionComparator>,
|
||||
executable_path: Option<PathBuf>,
|
||||
target: Option<String>,
|
||||
endpoints: Option<Vec<Url>>,
|
||||
@@ -111,18 +117,20 @@ pub struct UpdaterBuilder {
|
||||
}
|
||||
|
||||
impl UpdaterBuilder {
|
||||
/// It's prefered to use [`crate::UpdaterExt::updater_builder`] instead of
|
||||
/// constructing a [`UpdaterBuilder`] with this function yourself
|
||||
pub fn new(app_name: String, current_version: Version, config: crate::Config) -> Self {
|
||||
pub(crate) fn new<R: Runtime>(app: &AppHandle<R>, config: crate::Config) -> Self {
|
||||
let app_ = app.clone();
|
||||
let run_on_main_thread =
|
||||
move |f: Box<dyn FnOnce() + Send + Sync + 'static>| app_.run_on_main_thread(f);
|
||||
Self {
|
||||
run_on_main_thread: Box::new(run_on_main_thread),
|
||||
installer_args: config
|
||||
.windows
|
||||
.as_ref()
|
||||
.map(|w| w.installer_args.clone())
|
||||
.unwrap_or_default(),
|
||||
current_exe_args: Vec::new(),
|
||||
app_name,
|
||||
current_version,
|
||||
app_name: app.package_info().name.clone(),
|
||||
current_version: app.package_info().version.clone(),
|
||||
config,
|
||||
version_comparator: None,
|
||||
executable_path: None,
|
||||
@@ -139,7 +147,7 @@ impl UpdaterBuilder {
|
||||
mut self,
|
||||
f: F,
|
||||
) -> Self {
|
||||
self.version_comparator = Some(Box::new(f));
|
||||
self.version_comparator = Some(Arc::new(f));
|
||||
self
|
||||
}
|
||||
|
||||
@@ -178,6 +186,16 @@ impl UpdaterBuilder {
|
||||
Ok(self)
|
||||
}
|
||||
|
||||
pub fn headers(mut self, headers: HeaderMap) -> Self {
|
||||
self.headers = headers;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn clear_headers(mut self) -> Self {
|
||||
self.headers.clear();
|
||||
self
|
||||
}
|
||||
|
||||
pub fn timeout(mut self, timeout: Duration) -> Self {
|
||||
self.timeout = Some(timeout);
|
||||
self
|
||||
@@ -248,6 +266,7 @@ impl UpdaterBuilder {
|
||||
};
|
||||
|
||||
Ok(Updater {
|
||||
run_on_main_thread: Arc::new(self.run_on_main_thread),
|
||||
config: self.config,
|
||||
app_name: self.app_name,
|
||||
current_version: self.current_version,
|
||||
@@ -280,10 +299,12 @@ impl UpdaterBuilder {
|
||||
}
|
||||
|
||||
pub struct Updater {
|
||||
#[allow(dead_code)]
|
||||
run_on_main_thread: Arc<RunOnMainThread>,
|
||||
config: Config,
|
||||
app_name: String,
|
||||
current_version: Version,
|
||||
version_comparator: Option<Box<dyn Fn(Version, RemoteRelease) -> bool + Send + Sync>>,
|
||||
version_comparator: Option<VersionComparator>,
|
||||
timeout: Option<Duration>,
|
||||
proxy: Option<Url>,
|
||||
endpoints: Vec<Url>,
|
||||
@@ -319,6 +340,7 @@ impl Updater {
|
||||
}
|
||||
|
||||
let mut remote_release: Option<RemoteRelease> = None;
|
||||
let mut raw_json: Option<serde_json::Value> = None;
|
||||
let mut last_error: Option<Error> = None;
|
||||
for url in &self.endpoints {
|
||||
// replace {{current_version}}, {{target}} and {{arch}} in the provided URL
|
||||
@@ -361,25 +383,29 @@ impl Updater {
|
||||
.send()
|
||||
.await;
|
||||
|
||||
if let Ok(res) = response {
|
||||
if res.status().is_success() {
|
||||
// no updates found!
|
||||
if StatusCode::NO_CONTENT == res.status() {
|
||||
return Ok(None);
|
||||
};
|
||||
match response {
|
||||
Ok(res) => {
|
||||
if res.status().is_success() {
|
||||
// no updates found!
|
||||
if StatusCode::NO_CONTENT == res.status() {
|
||||
return Ok(None);
|
||||
};
|
||||
|
||||
match serde_json::from_value::<RemoteRelease>(res.json().await?)
|
||||
.map_err(Into::into)
|
||||
{
|
||||
Ok(release) => {
|
||||
last_error = None;
|
||||
remote_release = Some(release);
|
||||
// we found a relase, break the loop
|
||||
break;
|
||||
raw_json = Some(res.json().await?);
|
||||
match serde_json::from_value::<RemoteRelease>(raw_json.clone().unwrap())
|
||||
.map_err(Into::into)
|
||||
{
|
||||
Ok(release) => {
|
||||
last_error = None;
|
||||
remote_release = Some(release);
|
||||
// we found a relase, break the loop
|
||||
break;
|
||||
}
|
||||
Err(err) => last_error = Some(err),
|
||||
}
|
||||
Err(err) => last_error = Some(err),
|
||||
}
|
||||
}
|
||||
Err(err) => last_error = Some(err.into()),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -399,6 +425,7 @@ impl Updater {
|
||||
|
||||
let update = if should_update {
|
||||
Some(Update {
|
||||
run_on_main_thread: self.run_on_main_thread.clone(),
|
||||
config: self.config.clone(),
|
||||
on_before_exit: self.on_before_exit.clone(),
|
||||
app_name: self.app_name.clone(),
|
||||
@@ -410,6 +437,7 @@ impl Updater {
|
||||
download_url: release.download_url(&self.json_target)?.to_owned(),
|
||||
body: release.notes.clone(),
|
||||
signature: release.signature(&self.json_target)?.to_owned(),
|
||||
raw_json: raw_json.unwrap(),
|
||||
timeout: self.timeout,
|
||||
proxy: self.proxy.clone(),
|
||||
headers: self.headers.clone(),
|
||||
@@ -426,6 +454,8 @@ impl Updater {
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Update {
|
||||
#[allow(dead_code)]
|
||||
run_on_main_thread: Arc<RunOnMainThread>,
|
||||
config: Config,
|
||||
#[allow(unused)]
|
||||
on_before_exit: Option<OnBeforeExit>,
|
||||
@@ -443,6 +473,8 @@ pub struct Update {
|
||||
pub download_url: Url,
|
||||
/// Signature announced
|
||||
pub signature: String,
|
||||
/// The raw version of server's JSON response. Useful if the response contains additional fields that the updater doesn't handle.
|
||||
pub raw_json: serde_json::Value,
|
||||
/// Request timeout
|
||||
pub timeout: Option<Duration>,
|
||||
/// Request proxy
|
||||
@@ -1015,42 +1047,85 @@ impl Update {
|
||||
let cursor = Cursor::new(bytes);
|
||||
let mut extracted_files: Vec<PathBuf> = Vec::new();
|
||||
|
||||
// the first file in the tar.gz will always be
|
||||
// <app_name>/Contents
|
||||
let tmp_dir = tempfile::Builder::new()
|
||||
// Create temp directories for backup and extraction
|
||||
let tmp_backup_dir = tempfile::Builder::new()
|
||||
.prefix("tauri_current_app")
|
||||
.tempdir()?;
|
||||
|
||||
// create backup of our current app
|
||||
std::fs::rename(&self.extract_path, tmp_dir.path())?;
|
||||
let tmp_extract_dir = tempfile::Builder::new()
|
||||
.prefix("tauri_updated_app")
|
||||
.tempdir()?;
|
||||
|
||||
let decoder = GzDecoder::new(cursor);
|
||||
let mut archive = tar::Archive::new(decoder);
|
||||
|
||||
std::fs::create_dir(&self.extract_path)?;
|
||||
|
||||
// Extract files to temporary directory
|
||||
for entry in archive.entries()? {
|
||||
let mut entry = entry?;
|
||||
|
||||
// skip the first folder (should be the app name)
|
||||
let collected_path: PathBuf = entry.path()?.iter().skip(1).collect();
|
||||
let extraction_path = &self.extract_path.join(collected_path);
|
||||
let extraction_path = tmp_extract_dir.path().join(&collected_path);
|
||||
|
||||
// if something went wrong during the extraction, we should restore previous app
|
||||
if let Err(err) = entry.unpack(extraction_path) {
|
||||
for file in extracted_files.iter().rev() {
|
||||
// delete all the files we extracted
|
||||
if file.is_dir() {
|
||||
std::fs::remove_dir(file)?;
|
||||
} else {
|
||||
std::fs::remove_file(file)?;
|
||||
}
|
||||
}
|
||||
std::fs::rename(tmp_dir.path(), &self.extract_path)?;
|
||||
return Err(err.into());
|
||||
// Ensure parent directories exist
|
||||
if let Some(parent) = extraction_path.parent() {
|
||||
std::fs::create_dir_all(parent)?;
|
||||
}
|
||||
|
||||
extracted_files.push(extraction_path.to_path_buf());
|
||||
if let Err(err) = entry.unpack(&extraction_path) {
|
||||
// Cleanup on error
|
||||
std::fs::remove_dir_all(tmp_extract_dir.path()).ok();
|
||||
return Err(err.into());
|
||||
}
|
||||
extracted_files.push(extraction_path);
|
||||
}
|
||||
|
||||
// Try to move the current app to backup
|
||||
let move_result = std::fs::rename(
|
||||
&self.extract_path,
|
||||
tmp_backup_dir.path().join("current_app"),
|
||||
);
|
||||
let need_authorization = if let Err(err) = move_result {
|
||||
if err.kind() == std::io::ErrorKind::PermissionDenied {
|
||||
true
|
||||
} else {
|
||||
std::fs::remove_dir_all(tmp_extract_dir.path()).ok();
|
||||
return Err(err.into());
|
||||
}
|
||||
} else {
|
||||
false
|
||||
};
|
||||
|
||||
if need_authorization {
|
||||
// Use AppleScript to perform moves with admin privileges
|
||||
let apple_script = format!(
|
||||
"do shell script \"rm -rf '{src}' && mv -f '{new}' '{src}'\" with administrator privileges",
|
||||
src = self.extract_path.display(),
|
||||
new = tmp_extract_dir.path().display()
|
||||
);
|
||||
|
||||
let (tx, rx) = std::sync::mpsc::channel();
|
||||
let res = (self.run_on_main_thread)(Box::new(move || {
|
||||
let mut script =
|
||||
osakit::Script::new_from_source(osakit::Language::AppleScript, &apple_script);
|
||||
script.compile().expect("invalid AppleScript");
|
||||
let r = script.execute();
|
||||
tx.send(r).unwrap();
|
||||
}));
|
||||
let result = rx.recv().unwrap();
|
||||
|
||||
if res.is_err() || result.is_err() {
|
||||
std::fs::remove_dir_all(tmp_extract_dir.path()).ok();
|
||||
return Err(Error::Io(std::io::Error::new(
|
||||
std::io::ErrorKind::PermissionDenied,
|
||||
"Failed to move the new app into place",
|
||||
)));
|
||||
}
|
||||
} else {
|
||||
// Remove existing directory if it exists
|
||||
if self.extract_path.exists() {
|
||||
std::fs::remove_dir_all(&self.extract_path)?;
|
||||
}
|
||||
// Move the new app to the target path
|
||||
std::fs::rename(tmp_extract_dir.path(), &self.extract_path)?;
|
||||
}
|
||||
|
||||
let _ = std::process::Command::new("touch")
|
||||
|
||||
+4
-4
@@ -1822,9 +1822,9 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
|
||||
|
||||
[[package]]
|
||||
name = "openssl"
|
||||
version = "0.10.66"
|
||||
version = "0.10.70"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1"
|
||||
checksum = "61cfb4e166a8bb8c9b55c500bc2308550148ece889be90f609377e58140f42c6"
|
||||
dependencies = [
|
||||
"bitflags 2.6.0",
|
||||
"cfg-if",
|
||||
@@ -1854,9 +1854,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
|
||||
|
||||
[[package]]
|
||||
name = "openssl-sys"
|
||||
version = "0.9.103"
|
||||
version = "0.9.105"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6"
|
||||
checksum = "8b22d5b84be05a8d6947c7cb71f7c849aa0f112acd4bf51c2a7c1c988ac0a9dc"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
## \[2.2.1]
|
||||
|
||||
- [`ca7395a5`](https://github.com/tauri-apps/plugins-workspace/commit/ca7395a5ce971cbac25fb54285056edf3dd84e1f) ([#2378](https://github.com/tauri-apps/plugins-workspace/pull/2378) by [@FabianLars](https://github.com/tauri-apps/plugins-workspace/../../FabianLars)) the `rustls-tls` feature is now enabled by default
|
||||
|
||||
## \[2.2.1]
|
||||
|
||||
- [`05c62d73`](https://github.com/tauri-apps/plugins-workspace/commit/05c62d731fa48fd06b8cb3694a962d8cb0db8619) ([#1523](https://github.com/tauri-apps/plugins-workspace/pull/1523) by [@enri90](https://github.com/tauri-apps/plugins-workspace/../../enri90)) Added post request on download function
|
||||
|
||||
## \[2.2.0]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "tauri-plugin-upload"
|
||||
version = "2.2.0"
|
||||
version = "2.2.1"
|
||||
description = "Upload files from disk to a remote server over HTTP."
|
||||
authors = { workspace = true }
|
||||
license = { workspace = true }
|
||||
@@ -32,6 +32,7 @@ thiserror = { workspace = true }
|
||||
tokio = { version = "1", features = ["fs"] }
|
||||
tokio-util = { version = "0.7", features = ["codec"] }
|
||||
reqwest = { version = "0.12", default-features = false, features = [
|
||||
"macos-system-configuration",
|
||||
"json",
|
||||
"stream",
|
||||
] }
|
||||
@@ -39,6 +40,7 @@ futures-util = "0.3"
|
||||
read-progress-stream = "1.0.0"
|
||||
|
||||
[features]
|
||||
default = ["rustls-tls"]
|
||||
native-tls = ["reqwest/native-tls"]
|
||||
native-tls-vendored = ["reqwest/native-tls-vendored"]
|
||||
rustls-tls = ["reqwest/rustls-tls"]
|
||||
|
||||
@@ -1 +1 @@
|
||||
if("__TAURI__"in window){var __TAURI_PLUGIN_UPLOAD__=function(t){"use strict";function e(t,e,n,o){if("a"===n&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?o:"a"===n?o.call(t):o?o.value:e.get(t)}function n(t,e,n,o,s){if("function"==typeof e?t!==e||!s:!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 o,s,r;"function"==typeof SuppressedError&&SuppressedError;const i="__TAURI_TO_IPC_KEY__";class a{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,o.set(this,(()=>{})),s.set(this,0),r.set(this,{}),this.id=function(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}((({message:t,id:i})=>{if(i===e(this,s,"f")){n(this,s,i+1),e(this,o,"f").call(this,t);const a=Object.keys(e(this,r,"f"));if(a.length>0){let t=i+1;for(const n of a.sort()){if(parseInt(n)!==t)break;{const s=e(this,r,"f")[n];delete e(this,r,"f")[n],e(this,o,"f").call(this,s),t+=1}}n(this,s,t)}}else e(this,r,"f")[i.toString()]=t}))}set onmessage(t){n(this,o,t)}get onmessage(){return e(this,o,"f")}[(o=new WeakMap,s=new WeakMap,r=new WeakMap,i)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[i]()}}async function _(t,e={},n){return window.__TAURI_INTERNALS__.invoke(t,e,n)}return t.download=async function(t,e,n,o,s){const r=new Uint32Array(1);window.crypto.getRandomValues(r);const i=r[0],c=new a;n&&(c.onmessage=n),await _("plugin:upload|download",{id:i,url:t,filePath:e,headers:o??{},onProgress:c,body:s})},t.upload=async function(t,e,n,o){const s=new Uint32Array(1);window.crypto.getRandomValues(s);const r=s[0],i=new a;return n&&(i.onmessage=n),await _("plugin:upload|upload",{id:r,url:t,filePath:e,headers:o??{},onProgress:i})},t}({});Object.defineProperty(window.__TAURI__,"upload",{value:__TAURI_PLUGIN_UPLOAD__})}
|
||||
if("__TAURI__"in window){var __TAURI_PLUGIN_UPLOAD__=function(t){"use strict";function e(t,e,n,s){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"===n?s:"a"===n?s.call(t):s?s.value:e.get(t)}function n(t,e,n,s,i){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,n),n}var s,i,o;"function"==typeof SuppressedError&&SuppressedError;const r="__TAURI_TO_IPC_KEY__";class a{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,s.set(this,(()=>{})),i.set(this,0),o.set(this,[]),this.id=function(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}((({message:t,id:r})=>{if(r==e(this,i,"f"))for(e(this,s,"f").call(this,t),n(this,i,e(this,i,"f")+1);e(this,i,"f")in e(this,o,"f");){const t=e(this,o,"f")[e(this,i,"f")];e(this,s,"f").call(this,t),delete e(this,o,"f")[e(this,i,"f")],n(this,i,e(this,i,"f")+1)}else e(this,o,"f")[r]=t}))}set onmessage(t){n(this,s,t)}get onmessage(){return e(this,s,"f")}[(s=new WeakMap,i=new WeakMap,o=new WeakMap,r)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[r]()}}async function _(t,e={},n){return window.__TAURI_INTERNALS__.invoke(t,e,n)}return t.download=async function(t,e,n,s,i){const o=new Uint32Array(1);window.crypto.getRandomValues(o);const r=o[0],c=new a;n&&(c.onmessage=n),await _("plugin:upload|download",{id:r,url:t,filePath:e,headers:s??{},onProgress:c,body:i})},t.upload=async function(t,e,n,s){const i=new Uint32Array(1);window.crypto.getRandomValues(i);const o=i[0],r=new a;return n&&(r.onmessage=n),await _("plugin:upload|upload",{id:o,url:t,filePath:e,headers:s??{},onProgress:r})},t}({});Object.defineProperty(window.__TAURI__,"upload",{value:__TAURI_PLUGIN_UPLOAD__})}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@tauri-apps/plugin-upload",
|
||||
"version": "2.2.0",
|
||||
"version": "2.2.1",
|
||||
"description": "Upload files from disk to a remote server over HTTP.",
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"authors": [
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user