mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-06-22 14:59:56 +02:00
Compare commits
29 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ff86de7ce2 | |||
| c34afb7187 | |||
| 6940f74acd | |||
| 9263186458 | |||
| 45e6f8097a | |||
| f511f64c11 | |||
| 66949e2490 | |||
| a2c43553ad | |||
| c4539e9571 | |||
| 80a5dd478e | |||
| eb79eea9b7 | |||
| db900f6650 | |||
| 490aee9634 | |||
| 8f689bcc11 | |||
| 6a12952688 | |||
| b2ae7204b0 | |||
| adda363798 | |||
| 0782a6eb48 | |||
| b5e33203f9 | |||
| b7257e1f13 | |||
| 082fc62205 | |||
| 1d81316841 | |||
| fc1c7830c1 | |||
| f4669a79fa | |||
| e1f38cdecd | |||
| c6b587629c | |||
| 648bccb7da | |||
| f5bc5ce4cd | |||
| 2f3dde35b3 |
@@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
"log-plugin": patch
|
|
||||||
---
|
|
||||||
|
|
||||||
Update to tauri@2.0.0-alpha.16.
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
---
|
|
||||||
"authenticator": patch
|
|
||||||
"autostart": patch
|
|
||||||
"barcode-scanner": patch
|
|
||||||
"cli": patch
|
|
||||||
"clipboard-manager": patch
|
|
||||||
"deep-link": patch
|
|
||||||
"dialog": patch
|
|
||||||
"fs": patch
|
|
||||||
"global-shortcut": patch
|
|
||||||
"http": patch
|
|
||||||
"localhost": patch
|
|
||||||
"log-plugin": patch
|
|
||||||
"notification": patch
|
|
||||||
"os": patch
|
|
||||||
"persisted-scope": patch
|
|
||||||
"positioner": patch
|
|
||||||
"process": patch
|
|
||||||
"shell": patch
|
|
||||||
"single-instance": patch
|
|
||||||
"sql": patch
|
|
||||||
"store": patch
|
|
||||||
"stronghold": patch
|
|
||||||
"updater": patch
|
|
||||||
"upload": patch
|
|
||||||
"websocket": patch
|
|
||||||
"window-state": patch
|
|
||||||
---
|
|
||||||
|
|
||||||
Update to tauri@alpha.17.
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
---
|
|
||||||
"authenticator-js": patch
|
|
||||||
"autostart-js": patch
|
|
||||||
"barcode-scanner-js": patch
|
|
||||||
"cli-js": patch
|
|
||||||
"clipboard-manager-js": patch
|
|
||||||
"deep-link-js": patch
|
|
||||||
"dialog-js": patch
|
|
||||||
"fs-js": patch
|
|
||||||
"global-shortcut-js": patch
|
|
||||||
"http-js": patch
|
|
||||||
"log-js": patch
|
|
||||||
"notification-js": patch
|
|
||||||
"os-js": patch
|
|
||||||
"positioner-js": patch
|
|
||||||
"process-js": patch
|
|
||||||
"shell-js": patch
|
|
||||||
"sql-js": patch
|
|
||||||
"store-js": patch
|
|
||||||
"stronghold-js": patch
|
|
||||||
"updater-js": patch
|
|
||||||
"upload-js": patch
|
|
||||||
"websocket-js": patch
|
|
||||||
"window-state-js": patch
|
|
||||||
---
|
|
||||||
|
|
||||||
Update to @tauri-apps/api v2.0.0-alpha.11.
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
---
|
|
||||||
"authenticator-js": patch
|
|
||||||
"autostart-js": patch
|
|
||||||
"barcode-scanner-js": patch
|
|
||||||
"cli-js": patch
|
|
||||||
"clipboard-manager-js": patch
|
|
||||||
"deep-link-js": patch
|
|
||||||
"dialog-js": patch
|
|
||||||
"fs-js": patch
|
|
||||||
"global-shortcut-js": patch
|
|
||||||
"http-js": patch
|
|
||||||
"log-js": patch
|
|
||||||
"notification-js": patch
|
|
||||||
"os-js": patch
|
|
||||||
"positioner-js": patch
|
|
||||||
"process-js": patch
|
|
||||||
"shell-js": patch
|
|
||||||
"sql-js": patch
|
|
||||||
"store-js": patch
|
|
||||||
"stronghold-js": patch
|
|
||||||
"updater-js": patch
|
|
||||||
"upload-js": patch
|
|
||||||
"websocket-js": patch
|
|
||||||
"window-state-js": patch
|
|
||||||
---
|
|
||||||
|
|
||||||
Update to @tauri-apps/api v2.0.0-alpha.9.
|
|
||||||
+24
-2
@@ -38,6 +38,7 @@
|
|||||||
"manager": "rust",
|
"manager": "rust",
|
||||||
"publish": false,
|
"publish": false,
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
|
"app",
|
||||||
"barcode-scanner",
|
"barcode-scanner",
|
||||||
"log-plugin",
|
"log-plugin",
|
||||||
"cli",
|
"cli",
|
||||||
@@ -50,7 +51,8 @@
|
|||||||
"os",
|
"os",
|
||||||
"process",
|
"process",
|
||||||
"shell",
|
"shell",
|
||||||
"updater"
|
"updater",
|
||||||
|
"window"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"api-example-js": {
|
"api-example-js": {
|
||||||
@@ -58,6 +60,7 @@
|
|||||||
"manager": "javascript",
|
"manager": "javascript",
|
||||||
"publish": false,
|
"publish": false,
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
|
"app-js",
|
||||||
"barcode-scanner-js",
|
"barcode-scanner-js",
|
||||||
"log-js",
|
"log-js",
|
||||||
"cli-js",
|
"cli-js",
|
||||||
@@ -70,7 +73,8 @@
|
|||||||
"os-js",
|
"os-js",
|
||||||
"process-js",
|
"process-js",
|
||||||
"shell-js",
|
"shell-js",
|
||||||
"updater-js"
|
"updater-js",
|
||||||
|
"window-js"
|
||||||
],
|
],
|
||||||
"postversion": "pnpm install --no-frozen-lockfile"
|
"postversion": "pnpm install --no-frozen-lockfile"
|
||||||
},
|
},
|
||||||
@@ -83,6 +87,15 @@
|
|||||||
"postversion": "pnpm install --no-frozen-lockfile"
|
"postversion": "pnpm install --no-frozen-lockfile"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"app": {
|
||||||
|
"path": "./plugins/app",
|
||||||
|
"manager": "rust"
|
||||||
|
},
|
||||||
|
"app-js": {
|
||||||
|
"path": "./plugins/app",
|
||||||
|
"manager": "javascript"
|
||||||
|
},
|
||||||
|
|
||||||
"authenticator": {
|
"authenticator": {
|
||||||
"path": "./plugins/authenticator",
|
"path": "./plugins/authenticator",
|
||||||
"manager": "rust"
|
"manager": "rust"
|
||||||
@@ -320,6 +333,15 @@
|
|||||||
"manager": "javascript"
|
"manager": "javascript"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"window": {
|
||||||
|
"path": "./plugins/window",
|
||||||
|
"manager": "rust"
|
||||||
|
},
|
||||||
|
"window-js": {
|
||||||
|
"path": "./plugins/window",
|
||||||
|
"manager": "javascript"
|
||||||
|
},
|
||||||
|
|
||||||
"window-state": {
|
"window-state": {
|
||||||
"path": "./plugins/window-state",
|
"path": "./plugins/window-state",
|
||||||
"manager": "rust"
|
"manager": "rust"
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"window-js": "minor:feat"
|
||||||
|
---
|
||||||
|
|
||||||
|
Added the `maximizable`, `minimizable` and `closable` fields on `WindowOptions`.
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
"window": "minor:feat"
|
||||||
|
"window-js": "minor:feat"
|
||||||
|
---
|
||||||
|
|
||||||
|
Added the `setMaximizable`, `setMinimizable`, `setClosable`, `isMaximizable`, `isMinimizable` and `isClosable` methods.
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
---
|
---
|
||||||
|
"app": patch
|
||||||
"authenticator": patch
|
"authenticator": patch
|
||||||
"autostart": patch
|
"autostart": patch
|
||||||
"cli": patch
|
"cli": patch
|
||||||
@@ -22,6 +23,7 @@
|
|||||||
"updater": patch
|
"updater": patch
|
||||||
"upload": patch
|
"upload": patch
|
||||||
"websocket": patch
|
"websocket": patch
|
||||||
|
"window": patch
|
||||||
"window-state": patch
|
"window-state": patch
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
---
|
|
||||||
"log-plugin": patch
|
|
||||||
"deep-link": patch
|
|
||||||
"store": patch
|
|
||||||
---
|
|
||||||
|
|
||||||
Update to breaking changes from tauri@alpha.17.
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
---
|
|
||||||
"shell": patch
|
|
||||||
"dialog": patch
|
|
||||||
---
|
|
||||||
|
|
||||||
Fix invoke usage.
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
"notification": patch
|
|
||||||
---
|
|
||||||
|
|
||||||
Fix permission prompt.
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
"updater": patch
|
|
||||||
---
|
|
||||||
|
|
||||||
Fixes update on macOS.
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
"window-state-js": patch
|
|
||||||
---
|
|
||||||
|
|
||||||
Fix usage of no longer available `__TAURI_METADATA__` API.
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
"global-shortcut": "patch"
|
|
||||||
---
|
|
||||||
|
|
||||||
**Breaking Change**: Changed `Builder::with_handler` closure to take `&AppHandle` as the first argument and the shortcut as the second argument.
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
---
|
|
||||||
"authenticator": patch
|
|
||||||
"autostart": patch
|
|
||||||
"barcode-scanner": patch
|
|
||||||
"cli": patch
|
|
||||||
"clipboard-manager": patch
|
|
||||||
"deep-link": patch
|
|
||||||
"dialog": patch
|
|
||||||
"fs": patch
|
|
||||||
"global-shortcut": patch
|
|
||||||
"http": patch
|
|
||||||
"localhost": patch
|
|
||||||
"log-plugin": patch
|
|
||||||
"notification": patch
|
|
||||||
"os": patch
|
|
||||||
"persisted-scope": patch
|
|
||||||
"positioner": patch
|
|
||||||
"process": patch
|
|
||||||
"shell": patch
|
|
||||||
"single-instance": patch
|
|
||||||
"sql": patch
|
|
||||||
"store": patch
|
|
||||||
"stronghold": patch
|
|
||||||
"updater": patch
|
|
||||||
"upload": patch
|
|
||||||
"websocket": patch
|
|
||||||
"window-state": patch
|
|
||||||
---
|
|
||||||
|
|
||||||
Update MSRV to 1.70.
|
|
||||||
+8
-15
@@ -1,25 +1,16 @@
|
|||||||
{
|
{
|
||||||
"tag": "alpha",
|
"tag": "alpha",
|
||||||
"changes": [
|
"changes": [
|
||||||
".changes/alpha.16.md",
|
|
||||||
".changes/alpha.17.md",
|
|
||||||
".changes/api-alpha.11.md",
|
|
||||||
".changes/api-alpha.9.md",
|
|
||||||
".changes/deep-link-initial-release.md",
|
".changes/deep-link-initial-release.md",
|
||||||
".changes/dialog-async-message-dialog.md",
|
".changes/dialog-async-message-dialog.md",
|
||||||
|
".changes/disable-window-controls-api-options.md",
|
||||||
|
".changes/disable-window-controls-api.md",
|
||||||
".changes/fix-docs-build.md",
|
".changes/fix-docs-build.md",
|
||||||
".changes/fix-emit-all-usage.md",
|
|
||||||
".changes/fix-invoke-usage.md",
|
|
||||||
".changes/fix-permission-notification.md",
|
|
||||||
".changes/fix-updater-macos.md",
|
|
||||||
".changes/fix-window-state-api.md",
|
|
||||||
".changes/fs-wiret-binary-file.md",
|
".changes/fs-wiret-binary-file.md",
|
||||||
".changes/global-shortcut-app-handle.md",
|
|
||||||
".changes/http-multipart-refactor.md",
|
".changes/http-multipart-refactor.md",
|
||||||
".changes/http-plugin-refactor.md",
|
".changes/http-plugin-refactor.md",
|
||||||
".changes/http-remove-cmd-property.md",
|
".changes/http-remove-cmd-property.md",
|
||||||
".changes/http-response.md",
|
".changes/http-response.md",
|
||||||
".changes/msrv-1.70.md",
|
|
||||||
".changes/notification-init-script.md",
|
".changes/notification-init-script.md",
|
||||||
".changes/notification-revert-sound.md",
|
".changes/notification-revert-sound.md",
|
||||||
".changes/notification-sound.md",
|
".changes/notification-sound.md",
|
||||||
@@ -33,16 +24,18 @@
|
|||||||
".changes/shell-detached.md",
|
".changes/shell-detached.md",
|
||||||
".changes/stronghold-arg-name.md",
|
".changes/stronghold-arg-name.md",
|
||||||
".changes/stronghold-constructor.md",
|
".changes/stronghold-constructor.md",
|
||||||
".changes/tauri-alpha-15.md",
|
|
||||||
".changes/tauri-alpha.11.md",
|
".changes/tauri-alpha.11.md",
|
||||||
".changes/tauri-alpha.12.md",
|
".changes/tauri-alpha.12.md",
|
||||||
".changes/updater-nsis-admin.md",
|
".changes/updater-nsis-admin.md",
|
||||||
".changes/updater-nsis.md",
|
".changes/updater-nsis.md",
|
||||||
".changes/updater-plugin-refactor.md",
|
".changes/updater-plugin-refactor.md",
|
||||||
".changes/updater-string-replace.md",
|
|
||||||
".changes/v2-alpha.md",
|
".changes/v2-alpha.md",
|
||||||
".changes/websocket-fix-arg-name.md",
|
".changes/window-incognito.md",
|
||||||
|
".changes/window-is-focused.md",
|
||||||
|
".changes/window-plugin-refactor.md",
|
||||||
|
".changes/window-set-effects.md",
|
||||||
".changes/window-state-decorated.md",
|
".changes/window-state-decorated.md",
|
||||||
".changes/window-state-promise.md"
|
".changes/window-state-promise.md",
|
||||||
|
".changes/window-tap-drag-region-detection.md"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
---
|
|
||||||
"window-state": patch
|
|
||||||
"persisted-scope": patch
|
|
||||||
---
|
|
||||||
|
|
||||||
Update to tauri@alpha.15.
|
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
---
|
---
|
||||||
|
"app": patch
|
||||||
|
"app-js": patch
|
||||||
"authenticator": patch
|
"authenticator": patch
|
||||||
"authenticator-js": patch
|
"authenticator-js": patch
|
||||||
"autostart": patch
|
"autostart": patch
|
||||||
@@ -42,6 +44,8 @@
|
|||||||
"upload-js": patch
|
"upload-js": patch
|
||||||
"websocket": patch
|
"websocket": patch
|
||||||
"websocket-js": patch
|
"websocket-js": patch
|
||||||
|
"window": patch
|
||||||
|
"window-js": patch
|
||||||
"window-state": patch
|
"window-state": patch
|
||||||
"window-state-js": patch
|
"window-state-js": patch
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
---
|
---
|
||||||
|
"app": patch
|
||||||
"authenticator": patch
|
"authenticator": patch
|
||||||
"autostart": patch
|
"autostart": patch
|
||||||
"cli": patch
|
"cli": patch
|
||||||
@@ -22,6 +23,7 @@
|
|||||||
"updater": patch
|
"updater": patch
|
||||||
"upload": patch
|
"upload": patch
|
||||||
"websocket": patch
|
"websocket": patch
|
||||||
|
"window": patch
|
||||||
"window-state": patch
|
"window-state": patch
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
"updater": "patch"
|
|
||||||
---
|
|
||||||
|
|
||||||
The plugin now correctly replaces `arch`, `current_version` and `target` again.
|
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
---
|
---
|
||||||
|
"app": major
|
||||||
|
"app-js": major
|
||||||
"authenticator": major
|
"authenticator": major
|
||||||
"authenticator-js": major
|
"authenticator-js": major
|
||||||
"autostart": major
|
"autostart": major
|
||||||
@@ -42,6 +44,8 @@
|
|||||||
"upload-js": major
|
"upload-js": major
|
||||||
"websocket": major
|
"websocket": major
|
||||||
"websocket-js": major
|
"websocket-js": major
|
||||||
|
"window": major
|
||||||
|
"window-js": major
|
||||||
"window-state": major
|
"window-state": major
|
||||||
"window-state-js": major
|
"window-state-js": major
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
"websocket": patch
|
|
||||||
---
|
|
||||||
|
|
||||||
Fix argument name mismatch that caused issues when options where provided.
|
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"window-js": "minor"
|
||||||
|
---
|
||||||
|
|
||||||
|
Add `incognito` window configuration option
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
"window": "minor:feat"
|
||||||
|
"window-js": "minor:feat"
|
||||||
|
---
|
||||||
|
|
||||||
|
Add `WebviewWindow.is_focused` and `WebviewWindow.getFocusedWindow` getters.
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
"window": "patch"
|
||||||
|
"window-js": "patch"
|
||||||
|
---
|
||||||
|
|
||||||
|
The window plugin is recieving a few changes to improve consistency and add new features:
|
||||||
|
|
||||||
|
- Removed `appWindow` variable from JS module, use `getCurrent` or `Window.getCurrent`.
|
||||||
|
- Removed `WindowManager`, `WebviewWindow` and `WebviewHandle` types and merged them into one `Window` type that matches the name of the rust window type.
|
||||||
|
- Added `Window.getCurrent` and `Window.getAll` which is a convenient method for `getCurrent` and `getAll` functions.
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
"window": "patch"
|
||||||
|
"window-js": "patch"
|
||||||
|
---
|
||||||
|
|
||||||
|
Added the `setEffects` and `clearEffects` API.
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"window": "patch"
|
||||||
|
---
|
||||||
|
|
||||||
|
On macOS, fixed tapping on custom title bar doesn't maximize the window.
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
target
|
target
|
||||||
node_modules
|
node_modules
|
||||||
dist
|
dist
|
||||||
build/
|
|
||||||
dist-js
|
dist-js
|
||||||
api-iife.js
|
api-iife.js
|
||||||
init-iife.js
|
|
||||||
init.js
|
init.js
|
||||||
@@ -25,6 +25,10 @@ jobs:
|
|||||||
id: filter
|
id: filter
|
||||||
with:
|
with:
|
||||||
filters: |
|
filters: |
|
||||||
|
app:
|
||||||
|
- .github/workflows/check-generated-files.yml
|
||||||
|
- plugins/app/guest-js/**
|
||||||
|
- plugins/app/src/api-iife.js
|
||||||
authenticator:
|
authenticator:
|
||||||
- .github/workflows/check-generated-files.yml
|
- .github/workflows/check-generated-files.yml
|
||||||
- plugins/authenticator/guest-js/**
|
- plugins/authenticator/guest-js/**
|
||||||
@@ -105,6 +109,10 @@ jobs:
|
|||||||
- .github/workflows/check-generated-files.yml
|
- .github/workflows/check-generated-files.yml
|
||||||
- plugins/websocket/guest-js/**
|
- plugins/websocket/guest-js/**
|
||||||
- plugins/websocket/src/api-iife.js
|
- plugins/websocket/src/api-iife.js
|
||||||
|
window:
|
||||||
|
- .github/workflows/check-generated-files.yml
|
||||||
|
- plugins/window/guest-js/**
|
||||||
|
- plugins/window/src/api-iife.js
|
||||||
window-state:
|
window-state:
|
||||||
- .github/workflows/check-generated-files.yml
|
- .github/workflows/check-generated-files.yml
|
||||||
- plugins/window-state/guest-js/**
|
- plugins/window-state/guest-js/**
|
||||||
|
|||||||
@@ -41,6 +41,9 @@ jobs:
|
|||||||
id: filter
|
id: filter
|
||||||
with:
|
with:
|
||||||
filters: |
|
filters: |
|
||||||
|
tauri-plugin-app:
|
||||||
|
- .github/workflows/lint-rust.yml
|
||||||
|
- plugins/app/**
|
||||||
tauri-plugin-authenticator:
|
tauri-plugin-authenticator:
|
||||||
- .github/workflows/lint-rust.yml
|
- .github/workflows/lint-rust.yml
|
||||||
- plugins/authenticator/**
|
- plugins/authenticator/**
|
||||||
@@ -113,6 +116,9 @@ jobs:
|
|||||||
tauri-plugin-websocket:
|
tauri-plugin-websocket:
|
||||||
- .github/workflows/lint-rust.yml
|
- .github/workflows/lint-rust.yml
|
||||||
- plugins/websocket/**
|
- plugins/websocket/**
|
||||||
|
tauri-plugin-window:
|
||||||
|
- .github/workflows/lint-rust.yml
|
||||||
|
- plugins/window/**
|
||||||
tauri-plugin-window-state:
|
tauri-plugin-window-state:
|
||||||
- .github/workflows/lint-rust.yml
|
- .github/workflows/lint-rust.yml
|
||||||
- plugins/window-state/**
|
- plugins/window-state/**
|
||||||
@@ -149,6 +155,10 @@ jobs:
|
|||||||
if: matrix.package != 'tauri-plugin-sql'
|
if: matrix.package != 'tauri-plugin-sql'
|
||||||
run: cargo clippy --package ${{ matrix.package }} --all-targets -- -D warnings
|
run: cargo clippy --package ${{ matrix.package }} --all-targets -- -D warnings
|
||||||
|
|
||||||
|
- name: clippy ${{ matrix.package }} --all-features
|
||||||
|
if: ${{ !contains(fromJSON('["tauri-plugin-http", "tauri-plugin-upload", "tauri-plugin-updater", "tauri-plugin-websocket", "tauri-plugin-sql"]'), matrix.package) }}
|
||||||
|
run: cargo clippy --package ${{ matrix.package }} --all-targets --all-features -- -D warnings
|
||||||
|
|
||||||
- name: clippy ${{ matrix.package }} mysql
|
- name: clippy ${{ matrix.package }} mysql
|
||||||
if: matrix.package == 'tauri-plugin-sql'
|
if: matrix.package == 'tauri-plugin-sql'
|
||||||
run: cargo clippy --package ${{ matrix.package }} --all-targets --no-default-features --features mysql -- -D warnings
|
run: cargo clippy --package ${{ matrix.package }} --all-targets --no-default-features --features mysql -- -D warnings
|
||||||
@@ -159,6 +169,8 @@ jobs:
|
|||||||
|
|
||||||
fmt:
|
fmt:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|||||||
@@ -43,6 +43,9 @@ jobs:
|
|||||||
id: filter
|
id: filter
|
||||||
with:
|
with:
|
||||||
filters: |
|
filters: |
|
||||||
|
tauri-plugin-app:
|
||||||
|
- .github/workflows/test-rust.yml
|
||||||
|
- plugins/app/**
|
||||||
tauri-plugin-authenticator:
|
tauri-plugin-authenticator:
|
||||||
- .github/workflows/test-rust.yml
|
- .github/workflows/test-rust.yml
|
||||||
- plugins/authenticator/**
|
- plugins/authenticator/**
|
||||||
@@ -115,6 +118,9 @@ jobs:
|
|||||||
tauri-plugin-websocket:
|
tauri-plugin-websocket:
|
||||||
- .github/workflows/test-rust.yml
|
- .github/workflows/test-rust.yml
|
||||||
- plugins/websocket/**
|
- plugins/websocket/**
|
||||||
|
tauri-plugin-window:
|
||||||
|
- .github/workflows/test-rust.yml
|
||||||
|
- plugins/window/**
|
||||||
tauri-plugin-window-state:
|
tauri-plugin-window-state:
|
||||||
- .github/workflows/test-rust.yml
|
- .github/workflows/test-rust.yml
|
||||||
- plugins/window-state/**
|
- plugins/window-state/**
|
||||||
@@ -130,31 +136,31 @@ jobs:
|
|||||||
- {
|
- {
|
||||||
target: x86_64-pc-windows-msvc,
|
target: x86_64-pc-windows-msvc,
|
||||||
os: windows-latest,
|
os: windows-latest,
|
||||||
runner: 'cargo',
|
cross: false,
|
||||||
command: "test",
|
command: "test",
|
||||||
}
|
}
|
||||||
- {
|
- {
|
||||||
target: x86_64-unknown-linux-gnu,
|
target: x86_64-unknown-linux-gnu,
|
||||||
os: ubuntu-latest,
|
os: ubuntu-latest,
|
||||||
runner: 'cargo',
|
cross: false,
|
||||||
command: "test",
|
command: "test",
|
||||||
}
|
}
|
||||||
- {
|
- {
|
||||||
target: x86_64-apple-darwin,
|
target: x86_64-apple-darwin,
|
||||||
os: macos-latest,
|
os: macos-latest,
|
||||||
runner: 'cargo',
|
cross: false,
|
||||||
command: "test",
|
command: "test",
|
||||||
}
|
}
|
||||||
- {
|
- {
|
||||||
target: aarch64-apple-ios,
|
target: aarch64-apple-ios,
|
||||||
os: macos-latest,
|
os: macos-latest,
|
||||||
runner: 'cargo',
|
cross: false,
|
||||||
command: "build",
|
command: "build",
|
||||||
}
|
}
|
||||||
- {
|
- {
|
||||||
target: aarch64-linux-android,
|
target: aarch64-linux-android,
|
||||||
os: ubuntu-latest,
|
os: ubuntu-latest,
|
||||||
runner: 'cross',
|
cross: true,
|
||||||
command: "build",
|
command: "build",
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,30 +181,51 @@ jobs:
|
|||||||
echo "VCPKG_ROOT=$env:VCPKG_INSTALLATION_ROOT" | Out-File -FilePath $env:GITHUB_ENV -Append
|
echo "VCPKG_ROOT=$env:VCPKG_INSTALLATION_ROOT" | Out-File -FilePath $env:GITHUB_ENV -Append
|
||||||
vcpkg install openssl:x64-windows-static-md
|
vcpkg install openssl:x64-windows-static-md
|
||||||
|
|
||||||
- uses: dtolnay/rust-toolchain@1.70.0
|
- uses: dtolnay/rust-toolchain@1.65.0
|
||||||
with:
|
with:
|
||||||
targets: ${{ matrix.platform.target }}
|
targets: ${{ matrix.platform.target }}
|
||||||
|
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
with:
|
with:
|
||||||
key: cache-${{ matrix.package }}-${{ matrix.platform.target }}
|
key: ${{ matrix.package }}
|
||||||
|
|
||||||
- name: create dummy dist
|
- name: create dummy dist
|
||||||
working-directory: examples/api
|
working-directory: examples/api
|
||||||
run: mkdir dist
|
run: mkdir dist
|
||||||
|
|
||||||
- name: install cross
|
- name: Downgrade crates with MSRV conflict
|
||||||
if: ${{ matrix.platform.runner == 'cross' }}
|
# The --precise flag can only be used once per invocation.
|
||||||
run: cargo install cross --git https://github.com/cross-rs/cross
|
run: |
|
||||||
|
cargo update -p time@0.3.24 --precise 0.3.23
|
||||||
|
|
||||||
- name: test ${{ matrix.package }}
|
- name: test ${{ matrix.package }}
|
||||||
if: matrix.package != 'tauri-plugin-sql'
|
if: matrix.package != 'tauri-plugin-sql'
|
||||||
run: ${{ matrix.platform.runner }} ${{ matrix.platform.command }} --package ${{ matrix.package }} --target ${{ matrix.platform.target }} --all-targets
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
use-cross: ${{ matrix.platform.cross }}
|
||||||
|
command: ${{ matrix.platform.command }}
|
||||||
|
args: --package ${{ matrix.package }} --target ${{ matrix.platform.target }} --all-targets
|
||||||
|
|
||||||
|
- name: test ${{ matrix.package }} --all-features
|
||||||
|
if: ${{ !contains(fromJSON('["tauri-plugin-http", "tauri-plugin-upload", "tauri-plugin-updater", "tauri-plugin-websocket", "tauri-plugin-sql"]'), matrix.package) }}
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
use-cross: ${{ matrix.platform.cross }}
|
||||||
|
command: ${{ matrix.platform.command }}
|
||||||
|
args: --package ${{ matrix.package }} --target ${{ matrix.platform.target }} --all-targets --all-features
|
||||||
|
|
||||||
- name: test ${{ matrix.package }} mysql
|
- name: test ${{ matrix.package }} mysql
|
||||||
if: matrix.package == 'tauri-plugin-sql'
|
if: matrix.package == 'tauri-plugin-sql'
|
||||||
run: ${{ matrix.platform.runner }} ${{ matrix.platform.command }} --package ${{ matrix.package }} --target ${{ matrix.platform.target }} --all-targets --features mysql
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
use-cross: ${{ matrix.platform.cross }}
|
||||||
|
command: ${{ matrix.platform.command }}
|
||||||
|
args: --package ${{ matrix.package }} --target ${{ matrix.platform.target }} --all-targets --features mysql
|
||||||
|
|
||||||
- name: test ${{ matrix.package }} postgres
|
- name: test ${{ matrix.package }} postgres
|
||||||
if: matrix.package == 'tauri-plugin-sql'
|
if: matrix.package == 'tauri-plugin-sql'
|
||||||
run: ${{ matrix.platform.runner }} ${{ matrix.platform.command }} --package ${{ matrix.package }} --target ${{ matrix.platform.target }} --all-targets --features postgres
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
use-cross: ${{ matrix.platform.cross }}
|
||||||
|
command: ${{ matrix.platform.command }}
|
||||||
|
args: --package ${{ matrix.package }} --target ${{ matrix.platform.target }} --all-targets --features postgres
|
||||||
|
|||||||
@@ -7,5 +7,4 @@ Cargo.lock
|
|||||||
.build
|
.build
|
||||||
build
|
build
|
||||||
api-iife.js
|
api-iife.js
|
||||||
init-iife.js
|
|
||||||
intermediates/
|
intermediates/
|
||||||
@@ -21,14 +21,13 @@ const ignore = [
|
|||||||
"dist-js",
|
"dist-js",
|
||||||
".svelte-kit",
|
".svelte-kit",
|
||||||
"api-iife.js",
|
"api-iife.js",
|
||||||
"init-iife.js",
|
|
||||||
".build",
|
".build",
|
||||||
];
|
];
|
||||||
|
|
||||||
async function checkFile(file) {
|
async function checkFile(file) {
|
||||||
if (
|
if (
|
||||||
extensions.some((e) => file.endsWith(e)) &&
|
extensions.some((e) => file.endsWith(e)) &&
|
||||||
!ignore.some((i) => file.endsWith(i))
|
!ignore.some((i) => file.includes(i))
|
||||||
) {
|
) {
|
||||||
const fileStream = fs.createReadStream(file);
|
const fileStream = fs.createReadStream(file);
|
||||||
const rl = readline.createInterface({
|
const rl = readline.createInterface({
|
||||||
|
|||||||
Generated
+369
-449
File diff suppressed because it is too large
Load Diff
+3
-3
@@ -5,8 +5,8 @@ resolver = "2"
|
|||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
serde = { version = "1", features = ["derive"] }
|
serde = { version = "1", features = ["derive"] }
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
tauri = "2.0.0-alpha.17"
|
tauri = "2.0.0-alpha.12"
|
||||||
tauri-build = "2.0.0-alpha.11"
|
tauri-build = "2.0.0-alpha.8"
|
||||||
serde_json = "1"
|
serde_json = "1"
|
||||||
thiserror = "1"
|
thiserror = "1"
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ thiserror = "1"
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = [ "Tauri Programme within The Commons Conservancy" ]
|
authors = [ "Tauri Programme within The Commons Conservancy" ]
|
||||||
license = "Apache-2.0 OR MIT"
|
license = "Apache-2.0 OR MIT"
|
||||||
rust-version = "1.70"
|
rust-version = "1.65"
|
||||||
|
|
||||||
# default to small, optimized release binaries
|
# default to small, optimized release binaries
|
||||||
[profile.release]
|
[profile.release]
|
||||||
|
|||||||
@@ -16,4 +16,4 @@
|
|||||||
| [websocket](plugins/websocket) | Open a WebSocket connection using a Rust client in JS. | ✅ | ✅ | ✅ | ? | ? |
|
| [websocket](plugins/websocket) | Open a WebSocket connection using a Rust client in JS. | ✅ | ✅ | ✅ | ? | ? |
|
||||||
| [window-state](plugins/window-state) | Persist window sizes and positions. | ✅ | ✅ | ✅ | ? | ? |
|
| [window-state](plugins/window-state) | Persist window sizes and positions. | ✅ | ✅ | ✅ | ? | ? |
|
||||||
|
|
||||||
_This repo and all plugins require a Rust version of at least **1.70**_
|
_This repo and all plugins require a Rust version of at least **1.65**_
|
||||||
|
|||||||
@@ -1,41 +1,5 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
## \[2.0.0-alpha.5]
|
|
||||||
|
|
||||||
### Dependencies
|
|
||||||
|
|
||||||
- Upgraded to `barcode-scanner-js@2.0.0-alpha.2`
|
|
||||||
- Upgraded to `cli-js@2.0.0-alpha.3`
|
|
||||||
- Upgraded to `clipboard-manager-js@2.0.0-alpha.3`
|
|
||||||
- Upgraded to `dialog-js@2.0.0-alpha.3`
|
|
||||||
- Upgraded to `fs-js@2.0.0-alpha.3`
|
|
||||||
- Upgraded to `global-shortcut-js@2.0.0-alpha.3`
|
|
||||||
- Upgraded to `http-js@2.0.0-alpha.3`
|
|
||||||
- Upgraded to `log-js@2.0.0-alpha.3`
|
|
||||||
- Upgraded to `notification-js@2.0.0-alpha.3`
|
|
||||||
- Upgraded to `os-js@2.0.0-alpha.4`
|
|
||||||
- Upgraded to `process-js@2.0.0-alpha.3`
|
|
||||||
- Upgraded to `shell-js@2.0.0-alpha.3`
|
|
||||||
- Upgraded to `updater-js@2.0.0-alpha.3`
|
|
||||||
|
|
||||||
## \[2.0.0-alpha.4]
|
|
||||||
|
|
||||||
### Dependencies
|
|
||||||
|
|
||||||
- Upgraded to `barcode-scanner-js@2.0.0-alpha.1`
|
|
||||||
- Upgraded to `cli-js@2.0.0-alpha.2`
|
|
||||||
- Upgraded to `clipboard-manager-js@2.0.0-alpha.2`
|
|
||||||
- Upgraded to `dialog-js@2.0.0-alpha.2`
|
|
||||||
- Upgraded to `fs-js@2.0.0-alpha.2`
|
|
||||||
- Upgraded to `global-shortcut-js@2.0.0-alpha.2`
|
|
||||||
- Upgraded to `http-js@2.0.0-alpha.2`
|
|
||||||
- Upgraded to `log-js@2.0.0-alpha.2`
|
|
||||||
- Upgraded to `notification-js@2.0.0-alpha.2`
|
|
||||||
- Upgraded to `os-js@2.0.0-alpha.3`
|
|
||||||
- Upgraded to `process-js@2.0.0-alpha.2`
|
|
||||||
- Upgraded to `shell-js@2.0.0-alpha.2`
|
|
||||||
- Upgraded to `updater-js@2.0.0-alpha.2`
|
|
||||||
|
|
||||||
## \[2.0.0-alpha.3]
|
## \[2.0.0-alpha.3]
|
||||||
|
|
||||||
### Dependencies
|
### Dependencies
|
||||||
|
|||||||
+26
-23
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "svelte-app",
|
"name": "svelte-app",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "2.0.0-alpha.5",
|
"version": "2.0.0-alpha.3",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite --clearScreen false",
|
"dev": "vite --clearScreen false",
|
||||||
@@ -9,30 +9,33 @@
|
|||||||
"serve": "vite preview"
|
"serve": "vite preview"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tauri-apps/api": "2.0.0-alpha.11",
|
"@tauri-apps/api": "2.0.0-alpha.8",
|
||||||
"@tauri-apps/plugin-barcode-scanner": "2.0.0-alpha.2",
|
"@tauri-apps/plugin-app": "2.0.0-alpha.1",
|
||||||
"@tauri-apps/plugin-cli": "2.0.0-alpha.3",
|
"@tauri-apps/plugin-barcode-scanner": "2.0.0-alpha.0",
|
||||||
"@tauri-apps/plugin-clipboard-manager": "2.0.0-alpha.3",
|
"@tauri-apps/plugin-camera": "1.0.0",
|
||||||
"@tauri-apps/plugin-dialog": "2.0.0-alpha.3",
|
"@tauri-apps/plugin-cli": "2.0.0-alpha.1",
|
||||||
"@tauri-apps/plugin-fs": "2.0.0-alpha.3",
|
"@tauri-apps/plugin-clipboard-manager": "2.0.0-alpha.1",
|
||||||
"@tauri-apps/plugin-global-shortcut": "2.0.0-alpha.3",
|
"@tauri-apps/plugin-dialog": "2.0.0-alpha.1",
|
||||||
"@tauri-apps/plugin-http": "2.0.0-alpha.3",
|
"@tauri-apps/plugin-fs": "2.0.0-alpha.1",
|
||||||
"@tauri-apps/plugin-notification": "2.0.0-alpha.3",
|
"@tauri-apps/plugin-global-shortcut": "2.0.0-alpha.1",
|
||||||
"@tauri-apps/plugin-os": "2.0.0-alpha.4",
|
"@tauri-apps/plugin-http": "2.0.0-alpha.1",
|
||||||
"@tauri-apps/plugin-process": "2.0.0-alpha.3",
|
"@tauri-apps/plugin-notification": "2.0.0-alpha.1",
|
||||||
"@tauri-apps/plugin-shell": "2.0.0-alpha.3",
|
"@tauri-apps/plugin-os": "2.0.0-alpha.2",
|
||||||
"@tauri-apps/plugin-updater": "2.0.0-alpha.3",
|
"@tauri-apps/plugin-process": "2.0.0-alpha.1",
|
||||||
"@zerodevx/svelte-json-view": "1.0.7"
|
"@tauri-apps/plugin-shell": "2.0.0-alpha.1",
|
||||||
|
"@tauri-apps/plugin-updater": "2.0.0-alpha.1",
|
||||||
|
"@tauri-apps/plugin-window": "2.0.0-alpha.1",
|
||||||
|
"@zerodevx/svelte-json-view": "1.0.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@iconify-json/codicon": "^1.1.31",
|
"@iconify-json/codicon": "^1.1.26",
|
||||||
"@iconify-json/ph": "^1.1.6",
|
"@iconify-json/ph": "^1.1.5",
|
||||||
"@sveltejs/vite-plugin-svelte": "^2.4.6",
|
"@sveltejs/vite-plugin-svelte": "^2.4.1",
|
||||||
"@tauri-apps/cli": "2.0.0-alpha.17",
|
"@tauri-apps/cli": "2.0.0-alpha.14",
|
||||||
"@unocss/extractor-svelte": "^0.56.5",
|
"@unocss/extractor-svelte": "^0.53.1",
|
||||||
"internal-ip": "^8.0.0",
|
"internal-ip": "^8.0.0",
|
||||||
"svelte": "^4.2.2",
|
"svelte": "^3.59.1",
|
||||||
"unocss": "^0.56.5",
|
"unocss": "^0.53.1",
|
||||||
"vite": "^4.5.0"
|
"vite": "^4.3.9"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,41 +1,5 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
## \[2.0.0-alpha.7]
|
|
||||||
|
|
||||||
### Dependencies
|
|
||||||
|
|
||||||
- Upgraded to `barcode-scanner@2.0.0-alpha.2`
|
|
||||||
- Upgraded to `cli@2.0.0-alpha.4`
|
|
||||||
- Upgraded to `clipboard-manager@2.0.0-alpha.4`
|
|
||||||
- Upgraded to `dialog@2.0.0-alpha.4`
|
|
||||||
- Upgraded to `fs@2.0.0-alpha.4`
|
|
||||||
- Upgraded to `global-shortcut@2.0.0-alpha.4`
|
|
||||||
- Upgraded to `http@2.0.0-alpha.5`
|
|
||||||
- Upgraded to `log-plugin@2.0.0-alpha.4`
|
|
||||||
- Upgraded to `notification@2.0.0-alpha.5`
|
|
||||||
- Upgraded to `os@2.0.0-alpha.4`
|
|
||||||
- Upgraded to `process@2.0.0-alpha.4`
|
|
||||||
- Upgraded to `shell@2.0.0-alpha.4`
|
|
||||||
- Upgraded to `updater@2.0.0-alpha.4`
|
|
||||||
|
|
||||||
## \[2.0.0-alpha.6]
|
|
||||||
|
|
||||||
### Dependencies
|
|
||||||
|
|
||||||
- Upgraded to `log-plugin@2.0.0-alpha.3`
|
|
||||||
- Upgraded to `shell@2.0.0-alpha.3`
|
|
||||||
- Upgraded to `dialog@2.0.0-alpha.3`
|
|
||||||
- Upgraded to `notification@2.0.0-alpha.4`
|
|
||||||
- Upgraded to `updater@2.0.0-alpha.3`
|
|
||||||
- Upgraded to `global-shortcut@2.0.0-alpha.3`
|
|
||||||
- Upgraded to `barcode-scanner@2.0.0-alpha.1`
|
|
||||||
- Upgraded to `cli@2.0.0-alpha.3`
|
|
||||||
- Upgraded to `clipboard-manager@2.0.0-alpha.3`
|
|
||||||
- Upgraded to `fs@2.0.0-alpha.3`
|
|
||||||
- Upgraded to `http@2.0.0-alpha.4`
|
|
||||||
- Upgraded to `os@2.0.0-alpha.3`
|
|
||||||
- Upgraded to `process@2.0.0-alpha.3`
|
|
||||||
|
|
||||||
## \[2.0.0-alpha.5]
|
## \[2.0.0-alpha.5]
|
||||||
|
|
||||||
### Dependencies
|
### Dependencies
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "api"
|
name = "api"
|
||||||
publish = false
|
publish = false
|
||||||
version = "2.0.0-alpha.7"
|
version = "2.0.0-alpha.5"
|
||||||
description = "An example Tauri Application showcasing the api"
|
description = "An example Tauri Application showcasing the api"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
rust-version = { workspace = true }
|
rust-version = { workspace = true }
|
||||||
@@ -18,15 +18,17 @@ serde_json = { workspace = true }
|
|||||||
serde = { workspace = true }
|
serde = { workspace = true }
|
||||||
tiny_http = "0.11"
|
tiny_http = "0.11"
|
||||||
log = { workspace = true }
|
log = { workspace = true }
|
||||||
tauri-plugin-log = { path = "../../../plugins/log", version = "2.0.0-alpha.4" }
|
tauri-plugin-app = { path = "../../../plugins/app", version = "2.0.0-alpha.2" }
|
||||||
tauri-plugin-fs = { path = "../../../plugins/fs", version = "2.0.0-alpha.4" }
|
tauri-plugin-log = { path = "../../../plugins/log", version = "2.0.0-alpha.2" }
|
||||||
tauri-plugin-clipboard-manager = { path = "../../../plugins/clipboard-manager", version = "2.0.0-alpha.4" }
|
tauri-plugin-fs = { path = "../../../plugins/fs", version = "2.0.0-alpha.2" }
|
||||||
tauri-plugin-dialog = { path = "../../../plugins/dialog", version = "2.0.0-alpha.4" }
|
tauri-plugin-clipboard-manager = { path = "../../../plugins/clipboard-manager", version = "2.0.0-alpha.2" }
|
||||||
tauri-plugin-http = { path = "../../../plugins/http", features = [ "multipart" ], version = "2.0.0-alpha.5" }
|
tauri-plugin-dialog = { path = "../../../plugins/dialog", version = "2.0.0-alpha.2" }
|
||||||
tauri-plugin-notification = { path = "../../../plugins/notification", version = "2.0.0-alpha.5", features = [ "windows7-compat" ] }
|
tauri-plugin-http = { path = "../../../plugins/http", features = [ "multipart" ], version = "2.0.0-alpha.3" }
|
||||||
tauri-plugin-os = { path = "../../../plugins/os", version = "2.0.0-alpha.4" }
|
tauri-plugin-notification = { path = "../../../plugins/notification", version = "2.0.0-alpha.3", features = [ "windows7-compat" ] }
|
||||||
tauri-plugin-process = { path = "../../../plugins/process", version = "2.0.0-alpha.4" }
|
tauri-plugin-os = { path = "../../../plugins/os", version = "2.0.0-alpha.2" }
|
||||||
tauri-plugin-shell = { path = "../../../plugins/shell", version = "2.0.0-alpha.4" }
|
tauri-plugin-process = { path = "../../../plugins/process", version = "2.0.0-alpha.2" }
|
||||||
|
tauri-plugin-shell = { path = "../../../plugins/shell", version = "2.0.0-alpha.2" }
|
||||||
|
tauri-plugin-window = { path = "../../../plugins/window", version = "2.0.0-alpha.2", features = [ "devtools", "icon-ico", "icon-png" ] }
|
||||||
|
|
||||||
[dependencies.tauri]
|
[dependencies.tauri]
|
||||||
workspace = true
|
workspace = true
|
||||||
@@ -40,12 +42,13 @@ tauri-plugin-shell = { path = "../../../plugins/shell", version = "2.0.0-alpha.4
|
|||||||
]
|
]
|
||||||
|
|
||||||
[target."cfg(any(target_os = \"macos\", windows, target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies]
|
[target."cfg(any(target_os = \"macos\", windows, target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies]
|
||||||
tauri-plugin-cli = { path = "../../../plugins/cli", version = "2.0.0-alpha.4" }
|
tauri-plugin-cli = { path = "../../../plugins/cli", version = "2.0.0-alpha.2" }
|
||||||
tauri-plugin-global-shortcut = { path = "../../../plugins/global-shortcut", version = "2.0.0-alpha.4" }
|
tauri-plugin-global-shortcut = { path = "../../../plugins/global-shortcut", version = "2.0.0-alpha.2" }
|
||||||
tauri-plugin-updater = { path = "../../../plugins/updater", version = "2.0.0-alpha.4" }
|
tauri-plugin-updater = { path = "../../../plugins/updater", version = "2.0.0-alpha.2" }
|
||||||
|
|
||||||
[target."cfg(any(target_os = \"android\", target_os = \"ios\"))".dependencies]
|
[target."cfg(any(target_os = \"android\", target_os = \"ios\"))".dependencies]
|
||||||
tauri-plugin-barcode-scanner = { path = "../../../plugins/barcode-scanner/", version = "2.0.0-alpha.2" }
|
tauri-plugin-barcode-scanner = { path = "../../../plugins/barcode-scanner/", version = "2.0.0-alpha.0" }
|
||||||
|
tauri-plugin-camera = { path = "../../../plugins/camera/", version = "1.0.0" }
|
||||||
|
|
||||||
[target."cfg(target_os = \"windows\")".dependencies]
|
[target."cfg(target_os = \"windows\")".dependencies]
|
||||||
window-shadows = "0.2"
|
window-shadows = "0.2"
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
|
||||||
<application
|
<application
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
|
|||||||
+1
-1
@@ -32,7 +32,7 @@ open class BuildTask : DefaultTask() {
|
|||||||
val rootDirRel = rootDirRel ?: throw GradleException("rootDirRel cannot be null")
|
val rootDirRel = rootDirRel ?: throw GradleException("rootDirRel cannot be null")
|
||||||
val target = target ?: throw GradleException("target cannot be null")
|
val target = target ?: throw GradleException("target cannot be null")
|
||||||
val release = release ?: throw GradleException("release cannot be null")
|
val release = release ?: throw GradleException("release cannot be null")
|
||||||
val args = listOf("../node_modules/.bin/../@tauri-apps/cli/tauri.js", "android", "android-studio-script");
|
val args = listOf("/Users/lucas/projects/tauri/plugins-workspace/examples/api/./node_modules/.bin/../../../../node_modules/.pnpm/@tauri-apps+cli@2.0.0-alpha.14/node_modules/@tauri-apps/cli/tauri.js", "android", "android-studio-script");
|
||||||
|
|
||||||
project.exec {
|
project.exec {
|
||||||
workingDir(File(project.projectDir, rootDirRel))
|
workingDir(File(project.projectDir, rootDirRel))
|
||||||
|
|||||||
@@ -234,7 +234,7 @@
|
|||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
shellPath = /bin/sh;
|
shellPath = /bin/sh;
|
||||||
shellScript = "node ../../../node_modules/.bin/../@tauri-apps/cli/tauri.js ios xcode-script -v --platform ${PLATFORM_DISPLAY_NAME:?} --sdk-root ${SDKROOT:?} --framework-search-paths \"${FRAMEWORK_SEARCH_PATHS:?}\" --header-search-paths \"${HEADER_SEARCH_PATHS:?}\" --gcc-preprocessor-definitions \"${GCC_PREPROCESSOR_DEFINITIONS:-}\" --configuration ${CONFIGURATION:?} ${FORCE_COLOR} ${ARCHS:?}";
|
shellScript = "node /Users/lucas/projects/tauri/plugins-workspace/examples/api/./node_modules/.bin/../../../../node_modules/.pnpm/@tauri-apps+cli@2.0.0-alpha.14/node_modules/@tauri-apps/cli/tauri.js ios xcode-script -v --platform ${PLATFORM_DISPLAY_NAME:?} --sdk-root ${SDKROOT:?} --framework-search-paths \"${FRAMEWORK_SEARCH_PATHS:?}\" --header-search-paths \"${HEADER_SEARCH_PATHS:?}\" --gcc-preprocessor-definitions \"${GCC_PREPROCESSOR_DEFINITIONS:-}\" --configuration ${CONFIGURATION:?} ${FORCE_COLOR} ${ARCHS:?}";
|
||||||
};
|
};
|
||||||
/* End PBXShellScriptBuildPhase section */
|
/* End PBXShellScriptBuildPhase section */
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,6 @@
|
|||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>NSCameraUsageDescription</key>
|
|
||||||
<string>Request camera access for barcode scanner</string>
|
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||||
<key>CFBundleExecutable</key>
|
<key>CFBundleExecutable</key>
|
||||||
@@ -42,5 +40,7 @@
|
|||||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||||
</array>
|
</array>
|
||||||
|
<key>NSCameraUsageDescription</key>
|
||||||
|
<string>To be able to scan barcodes</string>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
name: api
|
name: api
|
||||||
options:
|
options:
|
||||||
bundleIdPrefix: com.tauri
|
bundleIdPrefix: com.tauri
|
||||||
@@ -80,7 +84,7 @@ targets:
|
|||||||
- sdk: UIKit.framework
|
- sdk: UIKit.framework
|
||||||
- sdk: WebKit.framework
|
- sdk: WebKit.framework
|
||||||
preBuildScripts:
|
preBuildScripts:
|
||||||
- script: node ../../../node_modules/.bin/../@tauri-apps/cli/tauri.js ios xcode-script -v --platform ${PLATFORM_DISPLAY_NAME:?} --sdk-root ${SDKROOT:?} --framework-search-paths "${FRAMEWORK_SEARCH_PATHS:?}" --header-search-paths "${HEADER_SEARCH_PATHS:?}" --gcc-preprocessor-definitions "${GCC_PREPROCESSOR_DEFINITIONS:-}" --configuration ${CONFIGURATION:?} ${FORCE_COLOR} ${ARCHS:?}
|
- script: node /Users/lucas/projects/tauri/plugins-workspace/examples/api/./node_modules/.bin/../../../../node_modules/.pnpm/@tauri-apps+cli@2.0.0-alpha.14/node_modules/@tauri-apps/cli/tauri.js ios xcode-script -v --platform ${PLATFORM_DISPLAY_NAME:?} --sdk-root ${SDKROOT:?} --framework-search-paths "${FRAMEWORK_SEARCH_PATHS:?}" --header-search-paths "${HEADER_SEARCH_PATHS:?}" --gcc-preprocessor-definitions "${GCC_PREPROCESSOR_DEFINITIONS:-}" --configuration ${CONFIGURATION:?} ${FORCE_COLOR} ${ARCHS:?}
|
||||||
name: Build Rust Code
|
name: Build Rust Code
|
||||||
basedOnDependencyAnalysis: false
|
basedOnDependencyAnalysis: false
|
||||||
outputFiles:
|
outputFiles:
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ mod cmd;
|
|||||||
mod tray;
|
mod tray;
|
||||||
|
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use tauri::{window::WindowBuilder, App, AppHandle, Manager, RunEvent, WindowUrl};
|
use tauri::{window::WindowBuilder, App, AppHandle, RunEvent, WindowUrl};
|
||||||
|
|
||||||
#[derive(Clone, Serialize)]
|
#[derive(Clone, Serialize)]
|
||||||
struct Reply {
|
struct Reply {
|
||||||
@@ -31,6 +31,7 @@ pub fn run() {
|
|||||||
.level(log::LevelFilter::Info)
|
.level(log::LevelFilter::Info)
|
||||||
.build(),
|
.build(),
|
||||||
)
|
)
|
||||||
|
.plugin(tauri_plugin_app::init())
|
||||||
.plugin(tauri_plugin_fs::init())
|
.plugin(tauri_plugin_fs::init())
|
||||||
.plugin(tauri_plugin_clipboard_manager::init())
|
.plugin(tauri_plugin_clipboard_manager::init())
|
||||||
.plugin(tauri_plugin_dialog::init())
|
.plugin(tauri_plugin_dialog::init())
|
||||||
@@ -39,6 +40,7 @@ pub fn run() {
|
|||||||
.plugin(tauri_plugin_os::init())
|
.plugin(tauri_plugin_os::init())
|
||||||
.plugin(tauri_plugin_process::init())
|
.plugin(tauri_plugin_process::init())
|
||||||
.plugin(tauri_plugin_shell::init())
|
.plugin(tauri_plugin_shell::init())
|
||||||
|
.plugin(tauri_plugin_window::init())
|
||||||
.setup(move |app| {
|
.setup(move |app| {
|
||||||
#[cfg(desktop)]
|
#[cfg(desktop)]
|
||||||
{
|
{
|
||||||
@@ -54,6 +56,11 @@ pub fn run() {
|
|||||||
app.handle().plugin(tauri_plugin_barcode_scanner::init())?;
|
app.handle().plugin(tauri_plugin_barcode_scanner::init())?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(mobile)]
|
||||||
|
{
|
||||||
|
app.handle().plugin(tauri_plugin_camera::init())?;
|
||||||
|
}
|
||||||
|
|
||||||
let mut window_builder = WindowBuilder::new(app, "main", WindowUrl::default());
|
let mut window_builder = WindowBuilder::new(app, "main", WindowUrl::default());
|
||||||
#[cfg(desktop)]
|
#[cfg(desktop)]
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ pub fn create_tray<R: Runtime>(app: &tauri::AppHandle<R>) -> tauri::Result<()> {
|
|||||||
|
|
||||||
_ => {}
|
_ => {}
|
||||||
})
|
})
|
||||||
.on_tray_icon_event(|tray, event| {
|
.on_tray_event(|tray, event| {
|
||||||
if event.click_type == ClickType::Left {
|
if event.click_type == ClickType::Left {
|
||||||
let app = tray.app_handle();
|
let app = tray.app_handle();
|
||||||
if let Some(window) = app.get_window("main") {
|
if let Some(window) = app.get_window("main") {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import { writable } from "svelte/store";
|
import { writable } from "svelte/store";
|
||||||
import { open } from "@tauri-apps/plugin-shell";
|
import { open } from "@tauri-apps/plugin-shell";
|
||||||
import { getCurrent } from "@tauri-apps/api/window";
|
import { getCurrent } from "@tauri-apps/plugin-window";
|
||||||
import * as os from "@tauri-apps/plugin-os";
|
import * as os from "@tauri-apps/plugin-os";
|
||||||
|
|
||||||
import Welcome from "./views/Welcome.svelte";
|
import Welcome from "./views/Welcome.svelte";
|
||||||
@@ -11,12 +11,15 @@
|
|||||||
import FileSystem from "./views/FileSystem.svelte";
|
import FileSystem from "./views/FileSystem.svelte";
|
||||||
import Http from "./views/Http.svelte";
|
import Http from "./views/Http.svelte";
|
||||||
import Notifications from "./views/Notifications.svelte";
|
import Notifications from "./views/Notifications.svelte";
|
||||||
|
import Window from "./views/Window.svelte";
|
||||||
import Shortcuts from "./views/Shortcuts.svelte";
|
import Shortcuts from "./views/Shortcuts.svelte";
|
||||||
import Shell from "./views/Shell.svelte";
|
import Shell from "./views/Shell.svelte";
|
||||||
import Updater from "./views/Updater.svelte";
|
import Updater from "./views/Updater.svelte";
|
||||||
import Clipboard from "./views/Clipboard.svelte";
|
import Clipboard from "./views/Clipboard.svelte";
|
||||||
import WebRTC from "./views/WebRTC.svelte";
|
import WebRTC from "./views/WebRTC.svelte";
|
||||||
import Scanner from "./views/Scanner.svelte";
|
import Scanner from "./views/Scanner.svelte";
|
||||||
|
import Camera from "./views/Camera.svelte";
|
||||||
|
import App from "./views/App.svelte";
|
||||||
|
|
||||||
import { onMount } from "svelte";
|
import { onMount } from "svelte";
|
||||||
import { ask } from "@tauri-apps/plugin-dialog";
|
import { ask } from "@tauri-apps/plugin-dialog";
|
||||||
@@ -72,11 +75,21 @@
|
|||||||
component: Http,
|
component: Http,
|
||||||
icon: "i-ph-globe-hemisphere-west",
|
icon: "i-ph-globe-hemisphere-west",
|
||||||
},
|
},
|
||||||
{
|
!isMobile && {
|
||||||
label: "Notifications",
|
label: "Notifications",
|
||||||
component: Notifications,
|
component: Notifications,
|
||||||
icon: "i-codicon-bell-dot",
|
icon: "i-codicon-bell-dot",
|
||||||
},
|
},
|
||||||
|
!isMobile && {
|
||||||
|
label: "App",
|
||||||
|
component: App,
|
||||||
|
icon: "i-codicon-hubot",
|
||||||
|
},
|
||||||
|
!isMobile && {
|
||||||
|
label: "Window",
|
||||||
|
component: Window,
|
||||||
|
icon: "i-codicon-window",
|
||||||
|
},
|
||||||
!isMobile && {
|
!isMobile && {
|
||||||
label: "Shortcuts",
|
label: "Shortcuts",
|
||||||
component: Shortcuts,
|
component: Shortcuts,
|
||||||
@@ -92,7 +105,7 @@
|
|||||||
component: Updater,
|
component: Updater,
|
||||||
icon: "i-codicon-cloud-download",
|
icon: "i-codicon-cloud-download",
|
||||||
},
|
},
|
||||||
{
|
!isMobile && {
|
||||||
label: "Clipboard",
|
label: "Clipboard",
|
||||||
component: Clipboard,
|
component: Clipboard,
|
||||||
icon: "i-codicon-clippy",
|
icon: "i-codicon-clippy",
|
||||||
@@ -107,7 +120,12 @@
|
|||||||
component: Scanner,
|
component: Scanner,
|
||||||
icon: "i-ph-scan",
|
icon: "i-ph-scan",
|
||||||
},
|
},
|
||||||
];
|
isMobile && {
|
||||||
|
label: 'Camera',
|
||||||
|
component: Camera,
|
||||||
|
icon: 'i-codicon-clippy'
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
let selected = views[0];
|
let selected = views[0];
|
||||||
function select(view) {
|
function select(view) {
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
<script>
|
||||||
|
import { show, hide } from "@tauri-apps/plugin-app";
|
||||||
|
|
||||||
|
export let onMessage;
|
||||||
|
|
||||||
|
function showApp() {
|
||||||
|
hideApp()
|
||||||
|
.then(() => {
|
||||||
|
setTimeout(() => {
|
||||||
|
show()
|
||||||
|
.then(() => onMessage("Shown app"))
|
||||||
|
.catch(onMessage);
|
||||||
|
}, 2000);
|
||||||
|
})
|
||||||
|
.catch(onMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
function hideApp() {
|
||||||
|
return hide()
|
||||||
|
.then(() => onMessage("Hide app"))
|
||||||
|
.catch(onMessage);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<button
|
||||||
|
class="btn"
|
||||||
|
id="show"
|
||||||
|
title="Hides and shows the app after 2 seconds"
|
||||||
|
on:click={showApp}>Show</button
|
||||||
|
>
|
||||||
|
<button class="btn" id="hide" on:click={hideApp}>Hide</button>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
<script>
|
||||||
|
import { getPhoto, ResultType, Source } from "@tauri-apps/plugin-camera";
|
||||||
|
|
||||||
|
let source = Source.Camera;
|
||||||
|
let imageSrc = "";
|
||||||
|
|
||||||
|
const sources = [
|
||||||
|
{
|
||||||
|
value: Source.Camera,
|
||||||
|
label: "Camera",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: Source.Photos,
|
||||||
|
label: "Photo",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: Source.Prompt,
|
||||||
|
label: "Prompt",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
async function get() {
|
||||||
|
try {
|
||||||
|
const image = await getPhoto({
|
||||||
|
resultType: ResultType.Base64,
|
||||||
|
source,
|
||||||
|
});
|
||||||
|
imageSrc = `data:image/png;base64, ${image.data}`;
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
{#if imageSrc}
|
||||||
|
<img src={imageSrc} alt="Selected" />
|
||||||
|
{/if}
|
||||||
|
<div class="flex">
|
||||||
|
<select class="input" id="dir" bind:value={source}>
|
||||||
|
{#each sources as source}
|
||||||
|
<option value={source.value}>{source.label}</option>
|
||||||
|
{/each}
|
||||||
|
</select>
|
||||||
|
<button class="btn" on:click={get}> Get photo </button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
img {
|
||||||
|
max-width: 100vw;
|
||||||
|
max-height: 80vh;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<script>
|
<script>
|
||||||
import { getCurrent } from "@tauri-apps/api/window";
|
import { getCurrent } from "@tauri-apps/plugin-window";
|
||||||
import { invoke } from "@tauri-apps/api/primitives";
|
import { invoke } from "@tauri-apps/api/tauri";
|
||||||
import { onMount, onDestroy } from "svelte";
|
import { onMount, onDestroy } from "svelte";
|
||||||
|
|
||||||
const appWindow = getCurrent();
|
const appWindow = getCurrent();
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
readDir,
|
readDir,
|
||||||
Dir,
|
Dir,
|
||||||
} from "@tauri-apps/plugin-fs";
|
} from "@tauri-apps/plugin-fs";
|
||||||
import { convertFileSrc } from "@tauri-apps/api/primitives";
|
import { convertFileSrc } from "@tauri-apps/api/tauri";
|
||||||
|
|
||||||
export let onMessage;
|
export let onMessage;
|
||||||
export let insecureRenderHtml;
|
export let insecureRenderHtml;
|
||||||
|
|||||||
@@ -29,6 +29,6 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<button class="btn" id="notification" on:click={sendNotification}>
|
<button class="btn" id="notification" on:click={_sendNotification}>
|
||||||
Send test notification
|
Send test notification
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script>
|
<script>
|
||||||
import { getName, getVersion, getTauriVersion } from "@tauri-apps/api/app";
|
import { getName, getVersion, getTauriVersion } from "@tauri-apps/plugin-app";
|
||||||
import { relaunch, exit } from "@tauri-apps/plugin-process";
|
import { relaunch, exit } from "@tauri-apps/plugin-process";
|
||||||
|
|
||||||
let version = "1.0.0";
|
let version = "1.0.0";
|
||||||
|
|||||||
@@ -0,0 +1,615 @@
|
|||||||
|
<script>
|
||||||
|
import {
|
||||||
|
getCurrent,
|
||||||
|
LogicalSize,
|
||||||
|
UserAttentionType,
|
||||||
|
PhysicalSize,
|
||||||
|
PhysicalPosition,
|
||||||
|
Effect,
|
||||||
|
EffectState,
|
||||||
|
Window
|
||||||
|
} from "@tauri-apps/plugin-window";
|
||||||
|
import { open as openDialog } from "@tauri-apps/plugin-dialog";
|
||||||
|
import { open } from "@tauri-apps/plugin-shell";
|
||||||
|
|
||||||
|
const appWindow = getCurrent();
|
||||||
|
|
||||||
|
let selectedWindow = appWindow.label;
|
||||||
|
const windowMap = {
|
||||||
|
[appWindow.label]: appWindow,
|
||||||
|
};
|
||||||
|
|
||||||
|
const cursorIconOptions = [
|
||||||
|
"default",
|
||||||
|
"crosshair",
|
||||||
|
"hand",
|
||||||
|
"arrow",
|
||||||
|
"move",
|
||||||
|
"text",
|
||||||
|
"wait",
|
||||||
|
"help",
|
||||||
|
"progress",
|
||||||
|
// something cannot be done
|
||||||
|
"notAllowed",
|
||||||
|
"contextMenu",
|
||||||
|
"cell",
|
||||||
|
"verticalText",
|
||||||
|
"alias",
|
||||||
|
"copy",
|
||||||
|
"noDrop",
|
||||||
|
// something can be grabbed
|
||||||
|
"grab",
|
||||||
|
/// something is grabbed
|
||||||
|
"grabbing",
|
||||||
|
"allScroll",
|
||||||
|
"zoomIn",
|
||||||
|
"zoomOut",
|
||||||
|
// edge is to be moved
|
||||||
|
"eResize",
|
||||||
|
"nResize",
|
||||||
|
"neResize",
|
||||||
|
"nwResize",
|
||||||
|
"sResize",
|
||||||
|
"seResize",
|
||||||
|
"swResize",
|
||||||
|
"wResize",
|
||||||
|
"ewResize",
|
||||||
|
"nsResize",
|
||||||
|
"neswResize",
|
||||||
|
"nwseResize",
|
||||||
|
"colResize",
|
||||||
|
"rowResize",
|
||||||
|
];
|
||||||
|
|
||||||
|
const windowsEffects = ["mica", "blur", "acrylic"];
|
||||||
|
const isWindows = navigator.appVersion.includes("windows");
|
||||||
|
const isMacOS = navigator.appVersion.includes("macos");
|
||||||
|
let effectOptions = isWindows
|
||||||
|
? windowsEffects
|
||||||
|
: Object.keys(Effect)
|
||||||
|
.map((effect) => Effect[effect])
|
||||||
|
.filter((e) => !windowsEffects.includes(e));
|
||||||
|
const effectStateOptions = Object.keys(EffectState).map(
|
||||||
|
(state) => EffectState[state]
|
||||||
|
);
|
||||||
|
|
||||||
|
export let onMessage;
|
||||||
|
const mainEl = document.querySelector("main");
|
||||||
|
|
||||||
|
let newWindowLabel;
|
||||||
|
|
||||||
|
let urlValue = "https://tauri.app";
|
||||||
|
let resizable = true;
|
||||||
|
let maximizable = true;
|
||||||
|
let minimizable = true;
|
||||||
|
let closable = true;
|
||||||
|
let maximized = false;
|
||||||
|
let decorations = true;
|
||||||
|
let alwaysOnTop = false;
|
||||||
|
let contentProtected = true;
|
||||||
|
let fullscreen = false;
|
||||||
|
let width = null;
|
||||||
|
let height = null;
|
||||||
|
let minWidth = null;
|
||||||
|
let minHeight = null;
|
||||||
|
let maxWidth = null;
|
||||||
|
let maxHeight = null;
|
||||||
|
let x = null;
|
||||||
|
let y = null;
|
||||||
|
let scaleFactor = 1;
|
||||||
|
let innerPosition = new PhysicalPosition(x, y);
|
||||||
|
let outerPosition = new PhysicalPosition(x, y);
|
||||||
|
let innerSize = new PhysicalSize(width, height);
|
||||||
|
let outerSize = new PhysicalSize(width, height);
|
||||||
|
let resizeEventUnlisten;
|
||||||
|
let moveEventUnlisten;
|
||||||
|
let cursorGrab = false;
|
||||||
|
let cursorVisible = true;
|
||||||
|
let cursorX = null;
|
||||||
|
let cursorY = null;
|
||||||
|
let cursorIcon = "default";
|
||||||
|
let cursorIgnoreEvents = false;
|
||||||
|
let windowTitle = "Awesome Tauri Example!";
|
||||||
|
|
||||||
|
let effects = [];
|
||||||
|
let selectedEffect;
|
||||||
|
let effectState;
|
||||||
|
let effectRadius;
|
||||||
|
let effectR, effectG, effectB, effectA;
|
||||||
|
|
||||||
|
function openUrl() {
|
||||||
|
open(urlValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
function setTitle_() {
|
||||||
|
windowMap[selectedWindow].setTitle(windowTitle);
|
||||||
|
}
|
||||||
|
|
||||||
|
function hide_() {
|
||||||
|
windowMap[selectedWindow].hide();
|
||||||
|
setTimeout(windowMap[selectedWindow].show, 2000);
|
||||||
|
}
|
||||||
|
|
||||||
|
function minimize_() {
|
||||||
|
windowMap[selectedWindow].minimize();
|
||||||
|
setTimeout(windowMap[selectedWindow].unminimize, 2000);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getIcon() {
|
||||||
|
openDialog({
|
||||||
|
multiple: false,
|
||||||
|
}).then((path) => {
|
||||||
|
if (typeof path === "string") {
|
||||||
|
windowMap[selectedWindow].setIcon(path);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function createWindow() {
|
||||||
|
if (!newWindowLabel) return;
|
||||||
|
|
||||||
|
const webview = new Window(newWindowLabel);
|
||||||
|
windowMap[newWindowLabel] = webview;
|
||||||
|
webview.once("tauri://error", function () {
|
||||||
|
onMessage("Error creating new webview");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadWindowSize() {
|
||||||
|
windowMap[selectedWindow].innerSize().then((response) => {
|
||||||
|
innerSize = response;
|
||||||
|
width = innerSize.width;
|
||||||
|
height = innerSize.height;
|
||||||
|
});
|
||||||
|
windowMap[selectedWindow].outerSize().then((response) => {
|
||||||
|
outerSize = response;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadWindowPosition() {
|
||||||
|
windowMap[selectedWindow].innerPosition().then((response) => {
|
||||||
|
innerPosition = response;
|
||||||
|
});
|
||||||
|
windowMap[selectedWindow].outerPosition().then((response) => {
|
||||||
|
outerPosition = response;
|
||||||
|
x = outerPosition.x;
|
||||||
|
y = outerPosition.y;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function addWindowEventListeners(window) {
|
||||||
|
if (!window) return;
|
||||||
|
if (resizeEventUnlisten) {
|
||||||
|
resizeEventUnlisten();
|
||||||
|
}
|
||||||
|
if (moveEventUnlisten) {
|
||||||
|
moveEventUnlisten();
|
||||||
|
}
|
||||||
|
moveEventUnlisten = await window.listen("tauri://move", loadWindowPosition);
|
||||||
|
resizeEventUnlisten = await window.listen("tauri://resize", loadWindowSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function requestUserAttention_() {
|
||||||
|
await windowMap[selectedWindow].minimize();
|
||||||
|
await windowMap[selectedWindow].requestUserAttention(
|
||||||
|
UserAttentionType.Critical
|
||||||
|
);
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 3000));
|
||||||
|
await windowMap[selectedWindow].requestUserAttention(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function addEffect() {
|
||||||
|
if (!effects.includes(selectedEffect)) {
|
||||||
|
effects = [...effects, selectedEffect];
|
||||||
|
}
|
||||||
|
|
||||||
|
const payload = {
|
||||||
|
effects,
|
||||||
|
state: effectState,
|
||||||
|
radius: effectRadius,
|
||||||
|
};
|
||||||
|
if (
|
||||||
|
Number.isInteger(effectR) &&
|
||||||
|
Number.isInteger(effectG) &&
|
||||||
|
Number.isInteger(effectB) &&
|
||||||
|
Number.isInteger(effectA)
|
||||||
|
) {
|
||||||
|
payload.color = [effectR, effectG, effectB, effectA];
|
||||||
|
}
|
||||||
|
|
||||||
|
mainEl.classList.remove("bg-primary");
|
||||||
|
mainEl.classList.remove("dark:bg-darkPrimary");
|
||||||
|
await windowMap[selectedWindow].clearEffects();
|
||||||
|
await windowMap[selectedWindow].setEffects(payload);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function clearEffects() {
|
||||||
|
effects = [];
|
||||||
|
await windowMap[selectedWindow].clearEffects();
|
||||||
|
mainEl.classList.add("bg-primary");
|
||||||
|
mainEl.classList.add("dark:bg-darkPrimary");
|
||||||
|
}
|
||||||
|
|
||||||
|
$: {
|
||||||
|
windowMap[selectedWindow];
|
||||||
|
loadWindowPosition();
|
||||||
|
loadWindowSize();
|
||||||
|
}
|
||||||
|
$: windowMap[selectedWindow]?.setResizable(resizable);
|
||||||
|
$: windowMap[selectedWindow]?.setMaximizable(maximizable);
|
||||||
|
$: windowMap[selectedWindow]?.setMinimizable(minimizable);
|
||||||
|
$: windowMap[selectedWindow]?.setClosable(closable);
|
||||||
|
$: maximized
|
||||||
|
? windowMap[selectedWindow]?.maximize()
|
||||||
|
: windowMap[selectedWindow]?.unmaximize();
|
||||||
|
$: windowMap[selectedWindow]?.setDecorations(decorations);
|
||||||
|
$: windowMap[selectedWindow]?.setAlwaysOnTop(alwaysOnTop);
|
||||||
|
$: windowMap[selectedWindow]?.setContentProtected(contentProtected);
|
||||||
|
$: windowMap[selectedWindow]?.setFullscreen(fullscreen);
|
||||||
|
|
||||||
|
$: width &&
|
||||||
|
height &&
|
||||||
|
windowMap[selectedWindow]?.setSize(new PhysicalSize(width, height));
|
||||||
|
$: minWidth && minHeight
|
||||||
|
? windowMap[selectedWindow]?.setMinSize(
|
||||||
|
new LogicalSize(minWidth, minHeight)
|
||||||
|
)
|
||||||
|
: windowMap[selectedWindow]?.setMinSize(null);
|
||||||
|
$: maxWidth > 800 && maxHeight > 400
|
||||||
|
? windowMap[selectedWindow]?.setMaxSize(
|
||||||
|
new LogicalSize(maxWidth, maxHeight)
|
||||||
|
)
|
||||||
|
: windowMap[selectedWindow]?.setMaxSize(null);
|
||||||
|
$: x !== null &&
|
||||||
|
y !== null &&
|
||||||
|
windowMap[selectedWindow]?.setPosition(new PhysicalPosition(x, y));
|
||||||
|
$: windowMap[selectedWindow]
|
||||||
|
?.scaleFactor()
|
||||||
|
.then((factor) => (scaleFactor = factor));
|
||||||
|
$: addWindowEventListeners(windowMap[selectedWindow]);
|
||||||
|
|
||||||
|
$: windowMap[selectedWindow]?.setCursorGrab(cursorGrab);
|
||||||
|
$: windowMap[selectedWindow]?.setCursorVisible(cursorVisible);
|
||||||
|
$: windowMap[selectedWindow]?.setCursorIcon(cursorIcon);
|
||||||
|
$: cursorX !== null &&
|
||||||
|
cursorY !== null &&
|
||||||
|
windowMap[selectedWindow]?.setCursorPosition(
|
||||||
|
new PhysicalPosition(cursorX, cursorY)
|
||||||
|
);
|
||||||
|
$: windowMap[selectedWindow]?.setIgnoreCursorEvents(cursorIgnoreEvents);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="flex flex-col children:grow gap-2">
|
||||||
|
<div class="flex gap-1">
|
||||||
|
<input
|
||||||
|
class="input grow"
|
||||||
|
type="text"
|
||||||
|
placeholder="New Window label.."
|
||||||
|
bind:value={newWindowLabel}
|
||||||
|
/>
|
||||||
|
<button class="btn" on:click={createWindow}>New window</button>
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
{#if Object.keys(windowMap).length >= 1}
|
||||||
|
<span class="font-700 text-sm">Selected window:</span>
|
||||||
|
<select class="input" bind:value={selectedWindow}>
|
||||||
|
<option value="" disabled selected>Choose a window...</option>
|
||||||
|
{#each Object.keys(windowMap) as label}
|
||||||
|
<option value={label}>{label}</option>
|
||||||
|
{/each}
|
||||||
|
</select>
|
||||||
|
{/if}
|
||||||
|
{#if windowMap[selectedWindow]}
|
||||||
|
<br />
|
||||||
|
<div class="flex flex-wrap gap-2">
|
||||||
|
<button
|
||||||
|
class="btn"
|
||||||
|
title="Unminimizes after 2 seconds"
|
||||||
|
on:click={() => windowMap[selectedWindow].center()}
|
||||||
|
>
|
||||||
|
Center
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="btn"
|
||||||
|
title="Unminimizes after 2 seconds"
|
||||||
|
on:click={minimize_}
|
||||||
|
>
|
||||||
|
Minimize
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="btn"
|
||||||
|
title="Visible again after 2 seconds"
|
||||||
|
on:click={hide_}
|
||||||
|
>
|
||||||
|
Hide
|
||||||
|
</button>
|
||||||
|
<button class="btn" on:click={getIcon}> Change icon </button>
|
||||||
|
<button
|
||||||
|
class="btn"
|
||||||
|
on:click={requestUserAttention_}
|
||||||
|
title="Minimizes the window, requests attention for 3s and then resets it"
|
||||||
|
>Request attention</button
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
<div class="flex flex-wrap gap-2">
|
||||||
|
<label>
|
||||||
|
Maximized
|
||||||
|
<input type="checkbox" bind:checked={maximized} />
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
Resizable
|
||||||
|
<input type="checkbox" bind:checked={resizable} />
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
Maximizable
|
||||||
|
<input type="checkbox" bind:checked={maximizable} />
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
Minimizable
|
||||||
|
<input type="checkbox" bind:checked={minimizable} />
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
Closable
|
||||||
|
<input type="checkbox" bind:checked={closable} />
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
Has decorations
|
||||||
|
<input type="checkbox" bind:checked={decorations} />
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
Always on top
|
||||||
|
<input type="checkbox" bind:checked={alwaysOnTop} />
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
Content protected
|
||||||
|
<input type="checkbox" bind:checked={contentProtected} />
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
Fullscreen
|
||||||
|
<input type="checkbox" bind:checked={fullscreen} />
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
<div class="flex flex-row gap-2 flex-wrap">
|
||||||
|
<div class="flex children:grow flex-col">
|
||||||
|
<div>
|
||||||
|
X
|
||||||
|
<input class="input" type="number" bind:value={x} min="0" />
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
Y
|
||||||
|
<input class="input" type="number" bind:value={y} min="0" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex children:grow flex-col">
|
||||||
|
<div>
|
||||||
|
Width
|
||||||
|
<input class="input" type="number" bind:value={width} min="400" />
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
Height
|
||||||
|
<input class="input" type="number" bind:value={height} min="400" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex children:grow flex-col">
|
||||||
|
<div>
|
||||||
|
Min width
|
||||||
|
<input class="input" type="number" bind:value={minWidth} />
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
Min height
|
||||||
|
<input class="input" type="number" bind:value={minHeight} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex children:grow flex-col">
|
||||||
|
<div>
|
||||||
|
Max width
|
||||||
|
<input class="input" type="number" bind:value={maxWidth} min="800" />
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
Max height
|
||||||
|
<input class="input" type="number" bind:value={maxHeight} min="400" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
<div>
|
||||||
|
<div class="flex">
|
||||||
|
<div class="grow">
|
||||||
|
<div class="text-accent dark:text-darkAccent font-700">
|
||||||
|
Inner Size
|
||||||
|
</div>
|
||||||
|
<span>Width: {innerSize.width}</span>
|
||||||
|
<span>Height: {innerSize.height}</span>
|
||||||
|
</div>
|
||||||
|
<div class="grow">
|
||||||
|
<div class="text-accent dark:text-darkAccent font-700">
|
||||||
|
Outer Size
|
||||||
|
</div>
|
||||||
|
<span>Width: {outerSize.width}</span>
|
||||||
|
<span>Height: {outerSize.height}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="flex">
|
||||||
|
<div class="grow">
|
||||||
|
<div class="text-accent dark:text-darkAccent font-700">
|
||||||
|
Inner Logical Size
|
||||||
|
</div>
|
||||||
|
<span>Width: {innerSize.toLogical(scaleFactor).width}</span>
|
||||||
|
<span>Height: {innerSize.toLogical(scaleFactor).height}</span>
|
||||||
|
</div>
|
||||||
|
<div class="grow">
|
||||||
|
<div class="text-accent dark:text-darkAccent font-700">
|
||||||
|
Outer Logical Size
|
||||||
|
</div>
|
||||||
|
<span>Width: {outerSize.toLogical(scaleFactor).width}</span>
|
||||||
|
<span>Height: {outerSize.toLogical(scaleFactor).height}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="flex">
|
||||||
|
<div class="grow">
|
||||||
|
<div class="text-accent dark:text-darkAccent font-700">
|
||||||
|
Inner Position
|
||||||
|
</div>
|
||||||
|
<span>x: {innerPosition.x}</span>
|
||||||
|
<span>y: {innerPosition.y}</span>
|
||||||
|
</div>
|
||||||
|
<div class="grow">
|
||||||
|
<div class="text-accent dark:text-darkAccent font-700">
|
||||||
|
Outer Position
|
||||||
|
</div>
|
||||||
|
<span>x: {outerPosition.x}</span>
|
||||||
|
<span>y: {outerPosition.y}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="flex">
|
||||||
|
<div class="grow">
|
||||||
|
<div class="text-accent dark:text-darkAccent font-700">
|
||||||
|
Inner Logical Position
|
||||||
|
</div>
|
||||||
|
<span>x: {innerPosition.toLogical(scaleFactor).x}</span>
|
||||||
|
<span>y: {innerPosition.toLogical(scaleFactor).y}</span>
|
||||||
|
</div>
|
||||||
|
<div class="grow">
|
||||||
|
<div class="text-accent dark:text-darkAccent font-700">
|
||||||
|
Outer Logical Position
|
||||||
|
</div>
|
||||||
|
<span>x: {outerPosition.toLogical(scaleFactor).x}</span>
|
||||||
|
<span>y: {outerPosition.toLogical(scaleFactor).y}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
<h4 class="mb-2">Cursor</h4>
|
||||||
|
<div class="flex gap-2">
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" bind:checked={cursorGrab} />
|
||||||
|
Grab
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" bind:checked={cursorVisible} />
|
||||||
|
Visible
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" bind:checked={cursorIgnoreEvents} />
|
||||||
|
Ignore events
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="flex gap-2">
|
||||||
|
<label>
|
||||||
|
Icon
|
||||||
|
<select class="input" bind:value={cursorIcon}>
|
||||||
|
{#each cursorIconOptions as kind}
|
||||||
|
<option value={kind}>{kind}</option>
|
||||||
|
{/each}
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
X position
|
||||||
|
<input class="input" type="number" bind:value={cursorX} />
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
Y position
|
||||||
|
<input class="input" type="number" bind:value={cursorY} />
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
<div class="flex flex-col gap-1">
|
||||||
|
<form class="flex gap-1" on:submit|preventDefault={setTitle_}>
|
||||||
|
<input class="input grow" id="title" bind:value={windowTitle} />
|
||||||
|
<button class="btn" type="submit">Set title</button>
|
||||||
|
</form>
|
||||||
|
<form class="flex gap-1" on:submit|preventDefault={openUrl}>
|
||||||
|
<input class="input grow" id="url" bind:value={urlValue} />
|
||||||
|
<button class="btn" id="open-url"> Open URL </button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
|
{#if isWindows || isMacOS}
|
||||||
|
<div class="flex flex-col gap-1">
|
||||||
|
<div class="flex">
|
||||||
|
<label>
|
||||||
|
Effect
|
||||||
|
<select class="input" bind:value={selectedEffect}>
|
||||||
|
{#each effectOptions as effect}
|
||||||
|
<option value={effect}>{effect}</option>
|
||||||
|
{/each}
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<label>
|
||||||
|
State
|
||||||
|
<select class="input" bind:value={effectState}>
|
||||||
|
{#each effectStateOptions as state}
|
||||||
|
<option value={state}>{state}</option>
|
||||||
|
{/each}
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<label>
|
||||||
|
Radius
|
||||||
|
<input class="input" type="number" bind:value={effectRadius} />
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex">
|
||||||
|
<label>
|
||||||
|
Color
|
||||||
|
<div class="flex">
|
||||||
|
<input
|
||||||
|
style="max-width: 120px;"
|
||||||
|
class="input"
|
||||||
|
type="number"
|
||||||
|
placeholder="R"
|
||||||
|
bind:value={effectR}
|
||||||
|
/>
|
||||||
|
<input
|
||||||
|
style="max-width: 120px;"
|
||||||
|
class="input"
|
||||||
|
type="number"
|
||||||
|
placeholder="G"
|
||||||
|
bind:value={effectG}
|
||||||
|
/>
|
||||||
|
<input
|
||||||
|
style="max-width: 120px;"
|
||||||
|
class="input"
|
||||||
|
type="number"
|
||||||
|
placeholder="B"
|
||||||
|
bind:value={effectB}
|
||||||
|
/>
|
||||||
|
<input
|
||||||
|
style="max-width: 120px;"
|
||||||
|
class="input"
|
||||||
|
type="number"
|
||||||
|
placeholder="A"
|
||||||
|
bind:value={effectA}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex">
|
||||||
|
<button class="btn" style="width: 80px;" on:click={addEffect}
|
||||||
|
>Add</button
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex">
|
||||||
|
<div>
|
||||||
|
Applied effects: {effects.length ? effects.join(",") : "None"}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button class="btn" style="width: 80px;" on:click={clearEffects}
|
||||||
|
>Clear</button
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
+16
-16
@@ -6,26 +6,26 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "pnpm run -r --parallel --filter !plugins-workspace --filter !\"./plugins/*/examples/**\" --filter !\"./examples/*\" build",
|
"build": "pnpm run -r --parallel --filter !plugins-workspace --filter !\"./plugins/*/examples/**\" --filter !\"./examples/*\" build",
|
||||||
"lint": "eslint .",
|
"lint": "eslint .",
|
||||||
"format": "prettier --write \"./**/*.{cjs,mjs,js,jsx,mts,ts,tsx,html,css,json}\" --ignore-path .prettierignore",
|
"format": "prettier --write \"./**/*.{cjs,mjs,js,jsx,mts,ts,tsx,html,css,json}\" --ignore-path .prettierignore",
|
||||||
"format-check": "prettier --check \"./**/*.{cjs,mjs,js,jsx,mts,ts,tsx,html,css,json}\" --ignore-path .prettierignore"
|
"format-check": "prettier --check \"./**/*.{cjs,mjs,js,jsx,mts,ts,tsx,html,css,json}\" --ignore-path .prettierignore"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@rollup/plugin-node-resolve": "15.2.3",
|
"@rollup/plugin-node-resolve": "15.1.0",
|
||||||
"@rollup/plugin-terser": "0.4.4",
|
"@rollup/plugin-terser": "0.4.3",
|
||||||
"@rollup/plugin-typescript": "11.1.5",
|
"@rollup/plugin-typescript": "11.1.2",
|
||||||
"@typescript-eslint/eslint-plugin": "6.8.0",
|
"@typescript-eslint/eslint-plugin": "6.1.0",
|
||||||
"@typescript-eslint/parser": "6.8.0",
|
"@typescript-eslint/parser": "6.1.0",
|
||||||
"covector": "^0.10.2",
|
"covector": "^0.10.0",
|
||||||
"eslint": "8.51.0",
|
"eslint": "8.45.0",
|
||||||
"eslint-config-prettier": "9.0.0",
|
"eslint-config-prettier": "8.8.0",
|
||||||
"eslint-config-standard-with-typescript": "39.1.1",
|
"eslint-config-standard-with-typescript": "36.1.0",
|
||||||
"eslint-plugin-import": "2.28.1",
|
"eslint-plugin-import": "2.27.5",
|
||||||
"eslint-plugin-n": "16.2.0",
|
"eslint-plugin-n": "16.0.1",
|
||||||
"eslint-plugin-promise": "6.1.1",
|
"eslint-plugin-promise": "6.1.1",
|
||||||
"eslint-plugin-security": "1.7.1",
|
"eslint-plugin-security": "1.7.1",
|
||||||
"prettier": "3.0.3",
|
"prettier": "3.0.0",
|
||||||
"rollup": "4.1.4",
|
"rollup": "3.26.3",
|
||||||
"typescript": "5.2.2"
|
"typescript": "5.1.6"
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
"semver": ">=7.5.2",
|
"semver": ">=7.5.2",
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
## \[2.0.0-alpha.2]
|
||||||
|
|
||||||
|
- [`4e2cef9`](https://github.com/tauri-apps/plugins-workspace/commit/4e2cef9b702bbbb9cf4ee17de50791cb21f1b2a4)([#593](https://github.com/tauri-apps/plugins-workspace/pull/593)) Update to alpha.12.
|
||||||
|
|
||||||
|
## \[2.0.0-alpha.1]
|
||||||
|
|
||||||
|
- [`d74fc0a`](https://github.com/tauri-apps/plugins-workspace/commit/d74fc0a097996e90a37be8f57d50b7d1f6ca616f)([#555](https://github.com/tauri-apps/plugins-workspace/pull/555)) Update to alpha.11.
|
||||||
|
|
||||||
|
## \[2.0.0-alpha.0]
|
||||||
|
|
||||||
|
- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
|
||||||
|
te to alpha.11.
|
||||||
|
|
||||||
|
## \[2.0.0-alpha.0]
|
||||||
|
|
||||||
|
- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
[package]
|
||||||
|
name = "tauri-plugin-app"
|
||||||
|
version = "2.0.0-alpha.2"
|
||||||
|
description = "APIs to read application metadata and change app visibility on macOS."
|
||||||
|
edition = { workspace = true }
|
||||||
|
authors = { workspace = true }
|
||||||
|
license = { workspace = true }
|
||||||
|
|
||||||
|
[package.metadata.docs.rs]
|
||||||
|
features = [ "tauri/dox" ]
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
tauri = { workspace = true }
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
SPDXVersion: SPDX-2.1
|
||||||
|
DataLicense: CC0-1.0
|
||||||
|
PackageName: tauri
|
||||||
|
DataFormat: SPDXRef-1
|
||||||
|
PackageSupplier: Organization: The Tauri Programme in the Commons Conservancy
|
||||||
|
PackageHomePage: https://tauri.app
|
||||||
|
PackageLicenseDeclared: Apache-2.0
|
||||||
|
PackageLicenseDeclared: MIT
|
||||||
|
PackageCopyrightText: 2019-2022, The Tauri Programme in the Commons Conservancy
|
||||||
|
PackageSummary: <text>Tauri is a rust project that enables developers to make secure
|
||||||
|
and small desktop applications using a web frontend.
|
||||||
|
</text>
|
||||||
|
PackageComment: <text>The package includes the following libraries; see
|
||||||
|
Relationship information.
|
||||||
|
</text>
|
||||||
|
Created: 2019-05-20T09:00:00Z
|
||||||
|
PackageDownloadLocation: git://github.com/tauri-apps/tauri
|
||||||
|
PackageDownloadLocation: git+https://github.com/tauri-apps/tauri.git
|
||||||
|
PackageDownloadLocation: git+ssh://github.com/tauri-apps/tauri.git
|
||||||
|
Creator: Person: Daniel Thompson-Yvetot
|
||||||
@@ -0,0 +1,177 @@
|
|||||||
|
|
||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2017 - Present Tauri Apps Contributors
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|

|
||||||
|
|
||||||
|
This plugin provides APIs to read application metadata and macOS app visibility functions.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
_This plugin requires a Rust version of at least **1.65**_
|
||||||
|
|
||||||
|
There are three general methods of installation that we can recommend.
|
||||||
|
|
||||||
|
1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked)
|
||||||
|
2. Pull sources directly from Github using git tags / revision hashes (most secure)
|
||||||
|
3. Git submodule install this repo in your tauri project and then use file protocol to ingest the source (most secure, but inconvenient to use)
|
||||||
|
|
||||||
|
Install the Core plugin by adding the following to your `Cargo.toml` file:
|
||||||
|
|
||||||
|
`src-tauri/Cargo.toml`
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[dependencies]
|
||||||
|
tauri-plugin-app = "2.0.0-alpha"
|
||||||
|
# alternatively with Git:
|
||||||
|
tauri-plugin-app = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
|
||||||
|
```
|
||||||
|
|
||||||
|
You can install the JavaScript Guest bindings using your preferred JavaScript package manager:
|
||||||
|
|
||||||
|
> Note: Since most JavaScript package managers are unable to install packages from git monorepos we provide read-only mirrors of each plugin. This makes installation option 2 more ergonomic to use.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
pnpm add @tauri-apps/plugin-app
|
||||||
|
# or
|
||||||
|
npm add @tauri-apps/plugin-app
|
||||||
|
# or
|
||||||
|
yarn add @tauri-apps/plugin-app
|
||||||
|
|
||||||
|
# alternatively with Git:
|
||||||
|
pnpm add https://github.com/tauri-apps/tauri-plugin-app#v2
|
||||||
|
# or
|
||||||
|
npm add https://github.com/tauri-apps/tauri-plugin-app#v2
|
||||||
|
# or
|
||||||
|
yarn add https://github.com/tauri-apps/tauri-plugin-app#v2
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
First you need to register the core plugin with Tauri:
|
||||||
|
|
||||||
|
`src-tauri/src/main.rs`
|
||||||
|
|
||||||
|
```rust
|
||||||
|
fn main() {
|
||||||
|
tauri::Builder::default()
|
||||||
|
.plugin(tauri_plugin_app::init())
|
||||||
|
.run(tauri::generate_context!())
|
||||||
|
.expect("error while running tauri application");
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import { getVersion, hide } from "@tauri-apps/plugin-app";
|
||||||
|
const appVersion = await getVersion();
|
||||||
|
await hide();
|
||||||
|
```
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
PRs accepted. Please make sure to read the Contributing Guide before making a pull request.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
Code: (c) 2015 - Present - The Tauri Programme within The Commons Conservancy.
|
||||||
|
|
||||||
|
MIT or MIT/Apache 2.0 where applicable.
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 59 KiB |
@@ -0,0 +1,90 @@
|
|||||||
|
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get application metadata.
|
||||||
|
*
|
||||||
|
* @module
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface Window {
|
||||||
|
__TAURI_INVOKE__: <T>(cmd: string, args?: unknown) => Promise<T>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the application version.
|
||||||
|
* @example
|
||||||
|
* ```typescript
|
||||||
|
* import { getVersion } from '@tauri-apps/plugin-app';
|
||||||
|
* const appVersion = await getVersion();
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @since 2.0.0
|
||||||
|
*/
|
||||||
|
async function getVersion(): Promise<string> {
|
||||||
|
return window.__TAURI_INVOKE__("plugin:app|version");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the application name.
|
||||||
|
* @example
|
||||||
|
* ```typescript
|
||||||
|
* import { getName } from '@tauri-apps/plugin-app';
|
||||||
|
* const appName = await getName();
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @since 2.0.0
|
||||||
|
*/
|
||||||
|
async function getName(): Promise<string> {
|
||||||
|
return window.__TAURI_INVOKE__("plugin:app|name");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the Tauri version.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* ```typescript
|
||||||
|
* import { getTauriVersion } from '@tauri-apps/plugin-app';
|
||||||
|
* const tauriVersion = await getTauriVersion();
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @since 2.0.0
|
||||||
|
*/
|
||||||
|
async function getTauriVersion(): Promise<string> {
|
||||||
|
return window.__TAURI_INVOKE__("plugin:app|tauri_version");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shows the application on macOS. This function does not automatically focus any specific app window.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* ```typescript
|
||||||
|
* import { show } from '@tauri-apps/plugin-app';
|
||||||
|
* await show();
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @since 2.0.0
|
||||||
|
*/
|
||||||
|
async function show(): Promise<void> {
|
||||||
|
return window.__TAURI_INVOKE__("plugin:app|show");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hides the application on macOS.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* ```typescript
|
||||||
|
* import { hide } from '@tauri-apps/plugin-app';
|
||||||
|
* await hide();
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @since 2.0.0
|
||||||
|
*/
|
||||||
|
async function hide(): Promise<void> {
|
||||||
|
return window.__TAURI_INVOKE__("plugin:app|hide");
|
||||||
|
}
|
||||||
|
|
||||||
|
export { getName, getVersion, getTauriVersion, show, hide };
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
{
|
||||||
|
"name": "@tauri-apps/plugin-app",
|
||||||
|
"version": "2.0.0-alpha.1",
|
||||||
|
"license": "MIT or APACHE-2.0",
|
||||||
|
"authors": [
|
||||||
|
"Tauri Programme within The Commons Conservancy"
|
||||||
|
],
|
||||||
|
"type": "module",
|
||||||
|
"browser": "dist-js/index.min.js",
|
||||||
|
"module": "dist-js/index.mjs",
|
||||||
|
"types": "dist-js/index.d.ts",
|
||||||
|
"exports": {
|
||||||
|
"import": "./dist-js/index.mjs",
|
||||||
|
"types": "./dist-js/index.d.ts",
|
||||||
|
"browser": "./dist-js/index.min.js"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"build": "rollup -c"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"dist-js",
|
||||||
|
"!dist-js/**/*.map",
|
||||||
|
"README.md",
|
||||||
|
"LICENSE"
|
||||||
|
],
|
||||||
|
"devDependencies": {
|
||||||
|
"tslib": "^2.5.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@tauri-apps/api": "2.0.0-alpha.8"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
import { readFileSync } from "fs";
|
||||||
|
|
||||||
|
import { createConfig } from "../../shared/rollup.config.mjs";
|
||||||
|
|
||||||
|
export default createConfig({
|
||||||
|
input: "guest-js/index.ts",
|
||||||
|
pkg: JSON.parse(
|
||||||
|
readFileSync(new URL("./package.json", import.meta.url), "utf8"),
|
||||||
|
),
|
||||||
|
external: [/^@tauri-apps\/api/],
|
||||||
|
});
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
if("__TAURI__"in window){var __TAURI_APP__=function(_){"use strict";return _.getName=async function(){return window.__TAURI_INVOKE__("plugin:app|name")},_.getTauriVersion=async function(){return window.__TAURI_INVOKE__("plugin:app|tauri_version")},_.getVersion=async function(){return window.__TAURI_INVOKE__("plugin:app|version")},_.hide=async function(){return window.__TAURI_INVOKE__("plugin:app|hide")},_.show=async function(){return window.__TAURI_INVOKE__("plugin:app|show")},_}({});Object.defineProperty(window.__TAURI__,"app",{value:__TAURI_APP__})}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
use tauri::{AppHandle, Runtime};
|
||||||
|
|
||||||
|
#[tauri::command]
|
||||||
|
pub fn version<R: Runtime>(app: AppHandle<R>) -> String {
|
||||||
|
app.package_info().version.to_string()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tauri::command]
|
||||||
|
pub fn name<R: Runtime>(app: AppHandle<R>) -> String {
|
||||||
|
app.package_info().name.clone()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tauri::command]
|
||||||
|
pub fn tauri_version() -> &'static str {
|
||||||
|
tauri::VERSION
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tauri::command]
|
||||||
|
#[allow(unused_variables)]
|
||||||
|
pub fn show<R: Runtime>(app: AppHandle<R>) -> tauri::Result<()> {
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
|
app.show()?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tauri::command]
|
||||||
|
#[allow(unused_variables)]
|
||||||
|
pub fn hide<R: Runtime>(app: AppHandle<R>) -> tauri::Result<()> {
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
|
app.hide()?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
//! [](https://github.com/tauri-apps/plugins-workspace/tree/v2/plugins/app)
|
||||||
|
//!
|
||||||
|
//! This plugin provides APIs to read application metadata and macOS app visibility functions.
|
||||||
|
|
||||||
|
#![doc(
|
||||||
|
html_logo_url = "https://github.com/tauri-apps/tauri/raw/dev/app-icon.png",
|
||||||
|
html_favicon_url = "https://github.com/tauri-apps/tauri/raw/dev/app-icon.png"
|
||||||
|
)]
|
||||||
|
|
||||||
|
use tauri::{
|
||||||
|
plugin::{Builder, TauriPlugin},
|
||||||
|
Runtime,
|
||||||
|
};
|
||||||
|
|
||||||
|
mod commands;
|
||||||
|
|
||||||
|
pub fn init<R: Runtime>() -> TauriPlugin<R> {
|
||||||
|
Builder::new("app")
|
||||||
|
.js_init_script(include_str!("api-iife.js").to_string())
|
||||||
|
.invoke_handler(tauri::generate_handler![
|
||||||
|
commands::version,
|
||||||
|
commands::name,
|
||||||
|
commands::tauri_version,
|
||||||
|
commands::show,
|
||||||
|
commands::hide
|
||||||
|
])
|
||||||
|
.build()
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"extends": "../../tsconfig.base.json",
|
||||||
|
"include": ["guest-js/*.ts"]
|
||||||
|
}
|
||||||
@@ -1,13 +1,5 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
## \[2.0.0-alpha.3]
|
|
||||||
|
|
||||||
- [`e438e0a`](https://github.com/tauri-apps/plugins-workspace/commit/e438e0a62d4b430a5159f05f13ecd397dd891a0d)([#676](https://github.com/tauri-apps/plugins-workspace/pull/676)) Update to @tauri-apps/api v2.0.0-alpha.11.
|
|
||||||
|
|
||||||
## \[2.0.0-alpha.2]
|
|
||||||
|
|
||||||
- [`5c13736`](https://github.com/tauri-apps/plugins-workspace/commit/5c137365c60790e8d4037d449e8237aa3fffdab0)([#673](https://github.com/tauri-apps/plugins-workspace/pull/673)) Update to @tauri-apps/api v2.0.0-alpha.9.
|
|
||||||
|
|
||||||
## \[2.0.0-alpha.2]
|
## \[2.0.0-alpha.2]
|
||||||
|
|
||||||
- [`4e2cef9`](https://github.com/tauri-apps/plugins-workspace/commit/4e2cef9b702bbbb9cf4ee17de50791cb21f1b2a4)([#593](https://github.com/tauri-apps/plugins-workspace/pull/593)) Update to alpha.12.
|
- [`4e2cef9`](https://github.com/tauri-apps/plugins-workspace/commit/4e2cef9b702bbbb9cf4ee17de50791cb21f1b2a4)([#593](https://github.com/tauri-apps/plugins-workspace/pull/593)) Update to alpha.12.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "tauri-plugin-authenticator"
|
name = "tauri-plugin-authenticator"
|
||||||
version = "2.0.0-alpha.4"
|
version = "2.0.0-alpha.2"
|
||||||
description = "Use hardware security-keys in your Tauri App."
|
description = "Use hardware security-keys in your Tauri App."
|
||||||
authors = { workspace = true }
|
authors = { workspace = true }
|
||||||
license = { workspace = true }
|
license = { workspace = true }
|
||||||
@@ -8,8 +8,7 @@ edition = { workspace = true }
|
|||||||
rust-version = { workspace = true }
|
rust-version = { workspace = true }
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
rustc-args = [ "--cfg", "docsrs" ]
|
features = [ "tauri/dox" ]
|
||||||
rustdoc-args = [ "--cfg", "docsrs" ]
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
serde = { workspace = true }
|
serde = { workspace = true }
|
||||||
@@ -24,7 +23,7 @@ once_cell = "1"
|
|||||||
sha2 = "0.10"
|
sha2 = "0.10"
|
||||||
base64 = "0.21"
|
base64 = "0.21"
|
||||||
u2f = "0.2"
|
u2f = "0.2"
|
||||||
chrono = ">= 0.4.0, <0.4.30"
|
chrono = "0.4"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
rand = "0.8"
|
rand = "0.8"
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ Use hardware security-keys in your Tauri App.
|
|||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
_This plugin requires a Rust version of at least **1.70**_
|
_This plugin requires a Rust version of at least **1.65**_
|
||||||
|
|
||||||
There are three general methods of installation that we can recommend.
|
There are three general methods of installation that we can recommend.
|
||||||
|
|
||||||
|
|||||||
@@ -2,15 +2,19 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
import { invoke } from "@tauri-apps/api/primitives";
|
declare global {
|
||||||
|
interface Window {
|
||||||
|
__TAURI_INVOKE__: <T>(cmd: string, args?: unknown) => Promise<T>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export class Authenticator {
|
export class Authenticator {
|
||||||
async init(): Promise<void> {
|
async init(): Promise<void> {
|
||||||
return await invoke("plugin:authenticator|init_auth");
|
return await window.__TAURI_INVOKE__("plugin:authenticator|init_auth");
|
||||||
}
|
}
|
||||||
|
|
||||||
async register(challenge: string, application: string): Promise<string> {
|
async register(challenge: string, application: string): Promise<string> {
|
||||||
return await invoke("plugin:authenticator|register", {
|
return await window.__TAURI_INVOKE__("plugin:authenticator|register", {
|
||||||
timeout: 10000,
|
timeout: 10000,
|
||||||
challenge,
|
challenge,
|
||||||
application,
|
application,
|
||||||
@@ -23,12 +27,15 @@ export class Authenticator {
|
|||||||
registerData: string,
|
registerData: string,
|
||||||
clientData: string,
|
clientData: string,
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
return await invoke("plugin:authenticator|verify_registration", {
|
return await window.__TAURI_INVOKE__(
|
||||||
challenge,
|
"plugin:authenticator|verify_registration",
|
||||||
application,
|
{
|
||||||
registerData,
|
challenge,
|
||||||
clientData,
|
application,
|
||||||
});
|
registerData,
|
||||||
|
clientData,
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async sign(
|
async sign(
|
||||||
@@ -36,7 +43,7 @@ export class Authenticator {
|
|||||||
application: string,
|
application: string,
|
||||||
keyHandle: string,
|
keyHandle: string,
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
return await invoke("plugin:authenticator|sign", {
|
return await window.__TAURI_INVOKE__("plugin:authenticator|sign", {
|
||||||
timeout: 10000,
|
timeout: 10000,
|
||||||
challenge,
|
challenge,
|
||||||
application,
|
application,
|
||||||
@@ -52,13 +59,16 @@ export class Authenticator {
|
|||||||
keyHandle: string,
|
keyHandle: string,
|
||||||
pubkey: string,
|
pubkey: string,
|
||||||
): Promise<number> {
|
): Promise<number> {
|
||||||
return await invoke("plugin:authenticator|verify_signature", {
|
return await window.__TAURI_INVOKE__(
|
||||||
challenge,
|
"plugin:authenticator|verify_signature",
|
||||||
application,
|
{
|
||||||
signData,
|
challenge,
|
||||||
clientData,
|
application,
|
||||||
keyHandle,
|
signData,
|
||||||
pubkey,
|
clientData,
|
||||||
});
|
keyHandle,
|
||||||
|
pubkey,
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@tauri-apps/plugin-authenticator",
|
"name": "@tauri-apps/plugin-authenticator",
|
||||||
"version": "2.0.0-alpha.3",
|
"version": "2.0.0-alpha.1",
|
||||||
"description": "Use hardware security-keys in your Tauri App.",
|
"description": "Use hardware security-keys in your Tauri App.",
|
||||||
"license": "MIT or APACHE-2.0",
|
"license": "MIT or APACHE-2.0",
|
||||||
"authors": [
|
"authors": [
|
||||||
@@ -28,6 +28,6 @@
|
|||||||
"tslib": "2.6.0"
|
"tslib": "2.6.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tauri-apps/api": "2.0.0-alpha.11"
|
"@tauri-apps/api": "2.0.0-alpha.8"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
if("__TAURI__"in window){var __TAURI_AUTHENTICATOR__=function(t){"use strict";async function i(t,i={},a){return window.__TAURI_INTERNALS__.invoke(t,i,a)}"function"==typeof SuppressedError&&SuppressedError;return t.Authenticator=class{async init(){return await i("plugin:authenticator|init_auth")}async register(t,a){return await i("plugin:authenticator|register",{timeout:1e4,challenge:t,application:a})}async verifyRegistration(t,a,e,n){return await i("plugin:authenticator|verify_registration",{challenge:t,application:a,registerData:e,clientData:n})}async sign(t,a,e){return await i("plugin:authenticator|sign",{timeout:1e4,challenge:t,application:a,keyHandle:e})}async verifySignature(t,a,e,n,r,u){return await i("plugin:authenticator|verify_signature",{challenge:t,application:a,signData:e,clientData:n,keyHandle:r,pubkey:u})}},t}({});Object.defineProperty(window.__TAURI__,"authenticator",{value:__TAURI_AUTHENTICATOR__})}
|
if("__TAURI__"in window){var __TAURI_AUTHENTICATOR__=function(t){"use strict";return t.Authenticator=class{async init(){return await window.__TAURI_INVOKE__("plugin:authenticator|init_auth")}async register(t,i){return await window.__TAURI_INVOKE__("plugin:authenticator|register",{timeout:1e4,challenge:t,application:i})}async verifyRegistration(t,i,a,n){return await window.__TAURI_INVOKE__("plugin:authenticator|verify_registration",{challenge:t,application:i,registerData:a,clientData:n})}async sign(t,i,a){return await window.__TAURI_INVOKE__("plugin:authenticator|sign",{timeout:1e4,challenge:t,application:i,keyHandle:a})}async verifySignature(t,i,a,n,e,_){return await window.__TAURI_INVOKE__("plugin:authenticator|verify_signature",{challenge:t,application:i,signData:a,clientData:n,keyHandle:e,pubkey:_})}},t}({});Object.defineProperty(window.__TAURI__,"authenticator",{value:__TAURI_AUTHENTICATOR__})}
|
||||||
|
|||||||
@@ -1,13 +1,5 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
## \[2.0.0-alpha.3]
|
|
||||||
|
|
||||||
- [`e438e0a`](https://github.com/tauri-apps/plugins-workspace/commit/e438e0a62d4b430a5159f05f13ecd397dd891a0d)([#676](https://github.com/tauri-apps/plugins-workspace/pull/676)) Update to @tauri-apps/api v2.0.0-alpha.11.
|
|
||||||
|
|
||||||
## \[2.0.0-alpha.2]
|
|
||||||
|
|
||||||
- [`5c13736`](https://github.com/tauri-apps/plugins-workspace/commit/5c137365c60790e8d4037d449e8237aa3fffdab0)([#673](https://github.com/tauri-apps/plugins-workspace/pull/673)) Update to @tauri-apps/api v2.0.0-alpha.9.
|
|
||||||
|
|
||||||
## \[2.0.0-alpha.2]
|
## \[2.0.0-alpha.2]
|
||||||
|
|
||||||
- [`4e2cef9`](https://github.com/tauri-apps/plugins-workspace/commit/4e2cef9b702bbbb9cf4ee17de50791cb21f1b2a4)([#593](https://github.com/tauri-apps/plugins-workspace/pull/593)) Update to alpha.12.
|
- [`4e2cef9`](https://github.com/tauri-apps/plugins-workspace/commit/4e2cef9b702bbbb9cf4ee17de50791cb21f1b2a4)([#593](https://github.com/tauri-apps/plugins-workspace/pull/593)) Update to alpha.12.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "tauri-plugin-autostart"
|
name = "tauri-plugin-autostart"
|
||||||
version = "2.0.0-alpha.4"
|
version = "2.0.0-alpha.2"
|
||||||
description = "Automatically launch your application at startup."
|
description = "Automatically launch your application at startup."
|
||||||
authors = { workspace = true }
|
authors = { workspace = true }
|
||||||
license = { workspace = true }
|
license = { workspace = true }
|
||||||
@@ -8,8 +8,7 @@ edition = { workspace = true }
|
|||||||
rust-version = { workspace = true }
|
rust-version = { workspace = true }
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
rustc-args = [ "--cfg", "docsrs" ]
|
features = [ "tauri/dox" ]
|
||||||
rustdoc-args = [ "--cfg", "docsrs" ]
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
serde = { workspace = true }
|
serde = { workspace = true }
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Automatically launch your application at startup. Supports Windows, Mac (via App
|
|||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
_This plugin requires a Rust version of at least **1.70**_
|
_This plugin requires a Rust version of at least **1.65**_
|
||||||
|
|
||||||
There are three general methods of installation that we can recommend.
|
There are three general methods of installation that we can recommend.
|
||||||
|
|
||||||
|
|||||||
@@ -2,16 +2,20 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
import { invoke } from "@tauri-apps/api/primitives";
|
declare global {
|
||||||
|
interface Window {
|
||||||
|
__TAURI_INVOKE__: <T>(cmd: string, args?: unknown) => Promise<T>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export async function isEnabled(): Promise<boolean> {
|
export async function isEnabled(): Promise<boolean> {
|
||||||
return await invoke("plugin:autostart|is_enabled");
|
return await window.__TAURI_INVOKE__("plugin:autostart|is_enabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function enable(): Promise<void> {
|
export async function enable(): Promise<void> {
|
||||||
await invoke("plugin:autostart|enable");
|
await window.__TAURI_INVOKE__("plugin:autostart|enable");
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function disable(): Promise<void> {
|
export async function disable(): Promise<void> {
|
||||||
await invoke("plugin:autostart|disable");
|
await window.__TAURI_INVOKE__("plugin:autostart|disable");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@tauri-apps/plugin-autostart",
|
"name": "@tauri-apps/plugin-autostart",
|
||||||
"version": "2.0.0-alpha.3",
|
"version": "2.0.0-alpha.1",
|
||||||
"license": "MIT or APACHE-2.0",
|
"license": "MIT or APACHE-2.0",
|
||||||
"authors": [
|
"authors": [
|
||||||
"Tauri Programme within The Commons Conservancy"
|
"Tauri Programme within The Commons Conservancy"
|
||||||
@@ -27,6 +27,6 @@
|
|||||||
"tslib": "2.6.0"
|
"tslib": "2.6.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tauri-apps/api": "2.0.0-alpha.11"
|
"@tauri-apps/api": "2.0.0-alpha.8"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
if("__TAURI__"in window){var __TAURI_AUTOSTART__=function(n){"use strict";async function t(n,t={},a){return window.__TAURI_INTERNALS__.invoke(n,t,a)}return"function"==typeof SuppressedError&&SuppressedError,n.disable=async function(){await t("plugin:autostart|disable")},n.enable=async function(){await t("plugin:autostart|enable")},n.isEnabled=async function(){return await t("plugin:autostart|is_enabled")},n}({});Object.defineProperty(window.__TAURI__,"autostart",{value:__TAURI_AUTOSTART__})}
|
if("__TAURI__"in window){var __TAURI_AUTOSTART__=function(_){"use strict";return _.disable=async function(){await window.__TAURI_INVOKE__("plugin:autostart|disable")},_.enable=async function(){await window.__TAURI_INVOKE__("plugin:autostart|enable")},_.isEnabled=async function(){return await window.__TAURI_INVOKE__("plugin:autostart|is_enabled")},_}({});Object.defineProperty(window.__TAURI__,"autostart",{value:__TAURI_AUTOSTART__})}
|
||||||
|
|||||||
@@ -1,13 +1,5 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
## \[2.0.0-alpha.2]
|
|
||||||
|
|
||||||
- [`e438e0a`](https://github.com/tauri-apps/plugins-workspace/commit/e438e0a62d4b430a5159f05f13ecd397dd891a0d)([#676](https://github.com/tauri-apps/plugins-workspace/pull/676)) Update to @tauri-apps/api v2.0.0-alpha.11.
|
|
||||||
|
|
||||||
## \[2.0.0-alpha.1]
|
|
||||||
|
|
||||||
- [`5c13736`](https://github.com/tauri-apps/plugins-workspace/commit/5c137365c60790e8d4037d449e8237aa3fffdab0)([#673](https://github.com/tauri-apps/plugins-workspace/pull/673)) Update to @tauri-apps/api v2.0.0-alpha.9.
|
|
||||||
|
|
||||||
## \[2.0.0-alpha.0]
|
## \[2.0.0-alpha.0]
|
||||||
|
|
||||||
- [`454428c`](https://github.com/tauri-apps/plugins-workspace/commit/454428cd50ce4962f0bad8e355aebc68af8cc61f)([#536](https://github.com/tauri-apps/plugins-workspace/pull/536)) Initial release.
|
- [`454428c`](https://github.com/tauri-apps/plugins-workspace/commit/454428cd50ce4962f0bad8e355aebc68af8cc61f)([#536](https://github.com/tauri-apps/plugins-workspace/pull/536)) Initial release.
|
||||||
|
|||||||
@@ -1,18 +1,12 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "tauri-plugin-barcode-scanner"
|
name = "tauri-plugin-barcode-scanner"
|
||||||
version = "2.0.0-alpha.2"
|
version = "2.0.0-alpha.0"
|
||||||
description = "Scan QR codes, EAN-13 and other kinds of barcodes on Android and iOS"
|
description = "Scan QR codes, EAN-13 and other kinds of barcodes on Android and iOS"
|
||||||
edition = { workspace = true }
|
edition = { workspace = true }
|
||||||
authors = { workspace = true }
|
authors = { workspace = true }
|
||||||
license = { workspace = true }
|
license = { workspace = true }
|
||||||
rust-version = { workspace = true }
|
|
||||||
links = "tauri-plugin-barcode-scanner"
|
links = "tauri-plugin-barcode-scanner"
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
|
||||||
rustc-args = [ "--cfg", "docsrs" ]
|
|
||||||
rustdoc-args = [ "--cfg", "docsrs" ]
|
|
||||||
targets = [ "x86_64-linux-android" ]
|
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
tauri-build = { workspace = true }
|
tauri-build = { workspace = true }
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ import app.tauri.Logger
|
|||||||
import app.tauri.PermissionState
|
import app.tauri.PermissionState
|
||||||
import app.tauri.annotation.ActivityCallback
|
import app.tauri.annotation.ActivityCallback
|
||||||
import app.tauri.annotation.Command
|
import app.tauri.annotation.Command
|
||||||
import app.tauri.annotation.InvokeArg
|
|
||||||
import app.tauri.annotation.Permission
|
import app.tauri.annotation.Permission
|
||||||
import app.tauri.annotation.PermissionCallback
|
import app.tauri.annotation.PermissionCallback
|
||||||
import app.tauri.annotation.TauriPlugin
|
import app.tauri.annotation.TauriPlugin
|
||||||
@@ -58,13 +57,6 @@ private const val PERMISSION_ALIAS_CAMERA = "camera"
|
|||||||
private const val PERMISSION_NAME = Manifest.permission.CAMERA
|
private const val PERMISSION_NAME = Manifest.permission.CAMERA
|
||||||
private const val PREFS_PERMISSION_FIRST_TIME_ASKING = "PREFS_PERMISSION_FIRST_TIME_ASKING"
|
private const val PREFS_PERMISSION_FIRST_TIME_ASKING = "PREFS_PERMISSION_FIRST_TIME_ASKING"
|
||||||
|
|
||||||
@InvokeArg
|
|
||||||
class ScanOptions {
|
|
||||||
var formats: Array<String>? = null
|
|
||||||
var windowed: Boolean = false
|
|
||||||
var cameraDirection: String? = null
|
|
||||||
}
|
|
||||||
|
|
||||||
@TauriPlugin(
|
@TauriPlugin(
|
||||||
permissions = [
|
permissions = [
|
||||||
Permission(strings = [Manifest.permission.CAMERA], alias = "camera")
|
Permission(strings = [Manifest.permission.CAMERA], alias = "camera")
|
||||||
@@ -214,12 +206,19 @@ class BarcodeScannerPlugin(private val activity: Activity) : Plugin(activity),
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getFormats(args: ScanOptions): List<Int> {
|
private fun getFormats(invoke: Invoke): List<Int> {
|
||||||
|
val jsFormats = invoke.getArray("formats", JSArray())
|
||||||
val formats = ArrayList<Int>()
|
val formats = ArrayList<Int>()
|
||||||
for (format in args.formats ?: arrayOf()) {
|
for (i in 0 until jsFormats.length()) {
|
||||||
val targetedBarcodeFormat = supportedFormats[format]
|
try {
|
||||||
if (targetedBarcodeFormat != null) {
|
val targetedFormat: String = jsFormats.getString(i)
|
||||||
formats.add(targetedBarcodeFormat)
|
val targetedBarcodeFormat =
|
||||||
|
supportedFormats[targetedFormat]
|
||||||
|
if (targetedBarcodeFormat != null) {
|
||||||
|
formats.add(targetedBarcodeFormat)
|
||||||
|
}
|
||||||
|
} catch (e: JSONException) {
|
||||||
|
e.printStackTrace()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return formats
|
return formats
|
||||||
@@ -342,16 +341,14 @@ class BarcodeScannerPlugin(private val activity: Activity) : Plugin(activity),
|
|||||||
|
|
||||||
@Command
|
@Command
|
||||||
fun scan(invoke: Invoke) {
|
fun scan(invoke: Invoke) {
|
||||||
val args = invoke.parseArgs(ScanOptions::class.java)
|
|
||||||
|
|
||||||
savedInvoke = invoke
|
savedInvoke = invoke
|
||||||
if (hasCamera()) {
|
if (hasCamera()) {
|
||||||
if (getPermissionState("camera") != PermissionState.GRANTED) {
|
if (getPermissionState("camera") != PermissionState.GRANTED) {
|
||||||
throw Exception("No permission to use camera. Did you request it yet?")
|
throw Exception("No permission to use camera. Did you request it yet?")
|
||||||
} else {
|
} else {
|
||||||
webViewBackground = null
|
webViewBackground = null
|
||||||
prepare(args.cameraDirection ?: "back", args.windowed)
|
prepare(invoke.getString("cameraDirection", "back"), invoke.getBoolean("windowed", false))
|
||||||
configureCamera(getFormats(args))
|
configureCamera(getFormats(invoke))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
use std::process::exit;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
if let Err(error) = tauri_build::mobile::PluginBuilder::new()
|
if let Err(error) = tauri_build::mobile::PluginBuilder::new()
|
||||||
.android_path("android")
|
.android_path("android")
|
||||||
@@ -9,9 +11,6 @@ fn main() {
|
|||||||
.run()
|
.run()
|
||||||
{
|
{
|
||||||
println!("{error:#}");
|
println!("{error:#}");
|
||||||
// when building documentation for Android the plugin build result is irrelevant to the crate itself
|
exit(1);
|
||||||
if !(cfg!(docsrs) && std::env::var("TARGET").unwrap().contains("android")) {
|
|
||||||
std::process::exit(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
import { invoke } from "@tauri-apps/api/primitives";
|
import { invoke } from "@tauri-apps/api/tauri";
|
||||||
|
|
||||||
export type PermissionState = "granted" | "denied" | "prompt";
|
export type PermissionState = "granted" | "denied" | "prompt";
|
||||||
|
|
||||||
|
|||||||
@@ -7,13 +7,7 @@ import Tauri
|
|||||||
import UIKit
|
import UIKit
|
||||||
import WebKit
|
import WebKit
|
||||||
|
|
||||||
struct ScanOptions: Decodable {
|
enum SupportedFormat: String, CaseIterable {
|
||||||
var formats: [SupportedFormat] = []
|
|
||||||
let windowed: Bool?
|
|
||||||
let cameraDirection: String?
|
|
||||||
}
|
|
||||||
|
|
||||||
enum SupportedFormat: String, CaseIterable, Decodable {
|
|
||||||
// UPC_A not supported
|
// UPC_A not supported
|
||||||
case UPC_E
|
case UPC_E
|
||||||
case EAN_8
|
case EAN_8
|
||||||
@@ -238,11 +232,19 @@ class BarcodeScannerPlugin: Plugin, AVCaptureMetadataOutputObjectsDelegate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private func runScanner(_ invoke: Invoke, args: ScanOptions) {
|
private func runScanner(_ invoke: Invoke) {
|
||||||
scanFormats = [AVMetadataObject.ObjectType]()
|
scanFormats = [AVMetadataObject.ObjectType]()
|
||||||
|
|
||||||
args.formats.forEach { format in
|
if (invoke.data["formats"]) != nil {
|
||||||
scanFormats.append(format.value)
|
let _scanFormats = invoke.getArray("formats", String.self)
|
||||||
|
|
||||||
|
if _scanFormats != nil && _scanFormats?.count ?? 0 > 0 {
|
||||||
|
_scanFormats?.forEach { targetedFormat in
|
||||||
|
if let value = SupportedFormat(rawValue: targetedFormat)?.value {
|
||||||
|
scanFormats.append(value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if scanFormats.count == 0 {
|
if scanFormats.count == 0 {
|
||||||
@@ -257,9 +259,7 @@ class BarcodeScannerPlugin: Plugin, AVCaptureMetadataOutputObjectsDelegate {
|
|||||||
self.isScanning = true
|
self.isScanning = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc private func scan(_ invoke: Invoke) throws {
|
@objc private func scan(_ invoke: Invoke) {
|
||||||
let args = try invoke.parseArgs(ScanOptions.self)
|
|
||||||
|
|
||||||
self.invoke = invoke
|
self.invoke = invoke
|
||||||
|
|
||||||
var iOS14min: Bool = false
|
var iOS14min: Bool = false
|
||||||
@@ -279,10 +279,10 @@ class BarcodeScannerPlugin: Plugin, AVCaptureMetadataOutputObjectsDelegate {
|
|||||||
self.loadCamera()
|
self.loadCamera()
|
||||||
self.dismantleCamera()
|
self.dismantleCamera()
|
||||||
self.setupCamera(
|
self.setupCamera(
|
||||||
direction: args.cameraDirection ?? "back",
|
direction: invoke.getString("cameraDirection") ?? "back",
|
||||||
windowed: args.windowed ?? false
|
windowed: invoke.getBool("windowed") ?? false
|
||||||
)
|
)
|
||||||
self.runScanner(invoke, args: args)
|
self.runScanner(invoke)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@tauri-apps/plugin-barcode-scanner",
|
"name": "@tauri-apps/plugin-barcode-scanner",
|
||||||
"version": "2.0.0-alpha.2",
|
"version": "2.0.0-alpha.0",
|
||||||
"description": "Scan QR codes, EAN-13 and other kinds of barcodes on Android and iOS",
|
"description": "Scan QR codes, EAN-13 and other kinds of barcodes on Android and iOS",
|
||||||
"license": "MIT or APACHE-2.0",
|
"license": "MIT or APACHE-2.0",
|
||||||
"authors": [
|
"authors": [
|
||||||
@@ -28,6 +28,6 @@
|
|||||||
"tslib": "^2.5.0"
|
"tslib": "^2.5.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tauri-apps/api": "2.0.0-alpha.11"
|
"@tauri-apps/api": "2.0.0-alpha.8"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
if("__TAURI__"in window){var __TAURI_BARCODESCANNER__=function(n){"use strict";async function e(n,e={},r){return window.__TAURI_INTERNALS__.invoke(n,e,r)}var r;return"function"==typeof SuppressedError&&SuppressedError,n.Format=void 0,(r=n.Format||(n.Format={})).QRCode="QR_CODE",r.UPC_A="UPC_A",r.UPC_E="UPC_E",r.EAN8="EAN_8",r.EAN13="EAN_13",r.Code39="CODE_39",r.Code93="CODE_93",r.Code128="CODE_128",r.Codabar="CODABAR",r.ITF="ITF",r.Aztec="AZTEC",r.DataMatrix="DATA_MATRIX",r.PDF417="PDF_417",n.cancel=async function(){return await e("plugin:barcodeScanner|cancel")},n.checkPermissions=async function(){return await e("plugin:barcodeScanner|checkPermissions").then((n=>n.camera))},n.openAppSettings=async function(){return await e("plugin:barcodeScanner|openAppSettings")},n.requestPermissions=async function(){return await e("plugin:barcodeScanner|requestPermissions").then((n=>n.camera))},n.scan=async function(n){return await e("plugin:barcodeScanner|scan",{...n})},n}({});Object.defineProperty(window.__TAURI__,"barcodeScanner",{value:__TAURI_BARCODESCANNER__})}
|
if("__TAURI__"in window){var __TAURI_BARCODESCANNER__=function(e){"use strict";var n=Object.defineProperty,t=(e,n,t)=>{if(!n.has(e))throw TypeError("Cannot "+t)},r=(e,n,r)=>(t(e,n,"read from private field"),r?r.call(e):n.get(e)),a=(e,n,r,a)=>(t(e,n,"write to private field"),a?a.call(e,r):n.set(e,r),r);function i(e,n=!1){let t=window.crypto.getRandomValues(new Uint32Array(1))[0],r=`_${t}`;return Object.defineProperty(window,r,{value:t=>(n&&Reflect.deleteProperty(window,r),e?.(t)),writable:!1,configurable:!0}),t}((e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})})({},{Channel:()=>c,PluginListener:()=>_,addPluginListener:()=>l,convertFileSrc:()=>u,invoke:()=>d,transformCallback:()=>i});var o,c=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,((e,n,t)=>{if(n.has(e))throw TypeError("Cannot add the same private member more than once");n instanceof WeakSet?n.add(e):n.set(e,t)})(this,o,(()=>{})),this.id=i((e=>{r(this,o).call(this,e)}))}set onmessage(e){a(this,o,e)}get onmessage(){return r(this,o)}toJSON(){return`__CHANNEL__:${this.id}`}};o=new WeakMap;var s,_=class{constructor(e,n,t){this.plugin=e,this.event=n,this.channelId=t}async unregister(){return d(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function l(e,n,t){let r=new c;return r.onmessage=t,d(`plugin:${e}|register_listener`,{event:n,handler:r}).then((()=>new _(e,n,r.id)))}async function d(e,n={},t){return new Promise(((r,a)=>{let o=i((e=>{r(e),Reflect.deleteProperty(window,`_${c}`)}),!0),c=i((e=>{a(e),Reflect.deleteProperty(window,`_${o}`)}),!0);window.__TAURI_IPC__({cmd:e,callback:o,error:c,payload:n,options:t})}))}function u(e,n="asset"){return window.__TAURI__.convertFileSrc(e,n)}return e.Format=void 0,(s=e.Format||(e.Format={})).QRCode="QR_CODE",s.UPC_A="UPC_A",s.UPC_E="UPC_E",s.EAN8="EAN_8",s.EAN13="EAN_13",s.Code39="CODE_39",s.Code93="CODE_93",s.Code128="CODE_128",s.Codabar="CODABAR",s.ITF="ITF",s.Aztec="AZTEC",s.DataMatrix="DATA_MATRIX",s.PDF417="PDF_417",e.cancel=async function(){return await d("plugin:barcodeScanner|cancel")},e.checkPermissions=async function(){return await d("plugin:barcodeScanner|checkPermissions").then((e=>e.camera))},e.openAppSettings=async function(){return await d("plugin:barcodeScanner|openAppSettings")},e.requestPermissions=async function(){return await d("plugin:barcodeScanner|requestPermissions").then((e=>e.camera))},e.scan=async function(e){return await d("plugin:barcodeScanner|scan",{...e})},e}({});Object.defineProperty(window.__TAURI__,"barcodeScanner",{value:__TAURI_BARCODESCANNER__})}
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
/target
|
||||||
|
/Cargo.lock
|
||||||
|
|
||||||
|
!dist-js
|
||||||
|
.tauri
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
[package]
|
||||||
|
name = "tauri-plugin-camera"
|
||||||
|
version = "1.0.0"
|
||||||
|
description = "Ask the user take a photo with the camera or select an image from the gallery."
|
||||||
|
authors.workspace = true
|
||||||
|
license.workspace = true
|
||||||
|
edition.workspace = true
|
||||||
|
rust-version.workspace = true
|
||||||
|
links = "tauri-plugin-camera"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
serde.workspace = true
|
||||||
|
serde_json.workspace = true
|
||||||
|
tauri.workspace = true
|
||||||
|
thiserror.workspace = true
|
||||||
|
|
||||||
|
[build-dependencies]
|
||||||
|
tauri-build.workspace = true
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
SPDXVersion: SPDX-2.1
|
||||||
|
DataLicense: CC0-1.0
|
||||||
|
PackageName: tauri
|
||||||
|
DataFormat: SPDXRef-1
|
||||||
|
PackageSupplier: Organization: The Tauri Programme in the Commons Conservancy
|
||||||
|
PackageHomePage: https://tauri.app
|
||||||
|
PackageLicenseDeclared: Apache-2.0
|
||||||
|
PackageLicenseDeclared: MIT
|
||||||
|
PackageCopyrightText: 2019-2022, The Tauri Programme in the Commons Conservancy
|
||||||
|
PackageSummary: <text>Tauri is a rust project that enables developers to make secure
|
||||||
|
and small desktop applications using a web frontend.
|
||||||
|
</text>
|
||||||
|
PackageComment: <text>The package includes the following libraries; see
|
||||||
|
Relationship information.
|
||||||
|
</text>
|
||||||
|
Created: 2019-05-20T09:00:00Z
|
||||||
|
PackageDownloadLocation: git://github.com/tauri-apps/tauri
|
||||||
|
PackageDownloadLocation: git+https://github.com/tauri-apps/tauri.git
|
||||||
|
PackageDownloadLocation: git+ssh://github.com/tauri-apps/tauri.git
|
||||||
|
Creator: Person: Daniel Thompson-Yvetot
|
||||||
@@ -0,0 +1,177 @@
|
|||||||
|
|
||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2017 - Present Tauri Apps Contributors
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
# Camera Plugin
|
||||||
|
|
||||||
|
Prompt the user to take a photo using the camera or pick an image from the gallery. Mobile only.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
There are three general methods of installation that we can recommend.
|
||||||
|
|
||||||
|
1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked)
|
||||||
|
2. Pull sources directly from Github using git tags / revision hashes (most secure)
|
||||||
|
3. Git submodule install this repo in your tauri project and then use file protocol to ingest the source (most secure, but inconvenient to use)
|
||||||
|
|
||||||
|
Install the Core plugin by adding the following to your `Cargo.toml` file:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[dependencies]
|
||||||
|
tauri-plugin-camera = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "feat/camera" }
|
||||||
|
```
|
||||||
|
|
||||||
|
You can install the JavaScript Guest bindings using your preferred JavaScript package manager:
|
||||||
|
|
||||||
|
> Note: Since most JavaScript package managers are unable to install packages from git monorepos we provide read-only mirrors of each plugin. This makes installation option 2 more ergonomic to use.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm install 'https://gitpkg.now.sh/tauri-apps/plugins-workspace/plugins/camera?feat/camera'
|
||||||
|
# or
|
||||||
|
yarn add 'https://gitpkg.now.sh/tauri-apps/plugins-workspace/plugins/camera?feat/camera'
|
||||||
|
```
|
||||||
|
|
||||||
|
**NOT AVAILABLE YET, WILL BE READY WHEN WE MERGE THE BRANCH:**
|
||||||
|
|
||||||
|
```sh
|
||||||
|
pnpm add https://github.com/tauri-apps/tauri-plugin-camera
|
||||||
|
# or
|
||||||
|
npm add https://github.com/tauri-apps/tauri-plugin-camera
|
||||||
|
# or
|
||||||
|
yarn add https://github.com/tauri-apps/tauri-plugin-camera
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
Register the core plugin with Tauri:
|
||||||
|
|
||||||
|
`src-tauri/src/lib.rs`
|
||||||
|
|
||||||
|
```rust
|
||||||
|
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||||
|
pub fn run() {
|
||||||
|
tauri::Builder::default()
|
||||||
|
.plugin(tauri_plugin_camera::init())
|
||||||
|
.run(tauri::generate_context!())
|
||||||
|
.expect("error while running tauri application");
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import { getPhoto } from "tauri-plugin-camera-api";
|
||||||
|
const image = await getPhoto();
|
||||||
|
```
|
||||||
|
|
||||||
|
### Android
|
||||||
|
|
||||||
|
Add the following permissions on the `src-tauri/gen/android/$(APPNAME)/app/src/main/AndroidManifest.xml` file:
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
|
```
|
||||||
|
|
||||||
|
### iOS
|
||||||
|
|
||||||
|
Configure the following properties on `src-tauri/gen/apple/$(APPNAME)_iOS/Info.plist`:
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<key>NSCameraUsageDescription</key>
|
||||||
|
<string>Description for the camera usage here</string>
|
||||||
|
<key>NSPhotoLibraryAddUsageDescription</key>
|
||||||
|
<string>Description for the library add usage here</string>
|
||||||
|
<key>NSPhotoLibraryUsageDescription</key>
|
||||||
|
<string>Description for the library usage here</string>
|
||||||
|
```
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
/build
|
||||||
|
/.tauri
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
plugins {
|
||||||
|
id("com.android.library")
|
||||||
|
id("org.jetbrains.kotlin.android")
|
||||||
|
}
|
||||||
|
|
||||||
|
android {
|
||||||
|
namespace = "app.tauri.camera"
|
||||||
|
compileSdk = 32
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
minSdk = 24
|
||||||
|
targetSdk = 32
|
||||||
|
|
||||||
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
consumerProguardFiles("consumer-rules.pro")
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
isMinifyEnabled = false
|
||||||
|
proguardFiles(
|
||||||
|
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||||
|
"proguard-rules.pro"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
kotlinOptions {
|
||||||
|
jvmTarget = "1.8"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
|
||||||
|
implementation("androidx.core:core-ktx:1.9.0")
|
||||||
|
implementation("androidx.appcompat:appcompat:1.6.0")
|
||||||
|
implementation("com.google.android.material:material:1.7.0")
|
||||||
|
testImplementation("junit:junit:4.13.2")
|
||||||
|
androidTestImplementation("androidx.test.ext:junit:1.1.5")
|
||||||
|
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
|
||||||
|
implementation("androidx.exifinterface:exifinterface:1.3.3")
|
||||||
|
implementation(project(":tauri-android"))
|
||||||
|
}
|
||||||
+21
@@ -0,0 +1,21 @@
|
|||||||
|
# Add project specific ProGuard rules here.
|
||||||
|
# You can control the set of applied configuration files using the
|
||||||
|
# proguardFiles setting in build.gradle.
|
||||||
|
#
|
||||||
|
# For more details, see
|
||||||
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
|
||||||
|
# If your project uses WebView with JS, uncomment the following
|
||||||
|
# and specify the fully qualified class name to the JavaScript interface
|
||||||
|
# class:
|
||||||
|
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||||
|
# public *;
|
||||||
|
#}
|
||||||
|
|
||||||
|
# Uncomment this to preserve the line number information for
|
||||||
|
# debugging stack traces.
|
||||||
|
#-keepattributes SourceFile,LineNumberTable
|
||||||
|
|
||||||
|
# If you keep the line number information, uncomment this to
|
||||||
|
# hide the original source file name.
|
||||||
|
#-renamesourcefileattribute SourceFile
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
include ':tauri-android'
|
||||||
|
project(':tauri-android').projectDir = new File('./.tauri/tauri-api')
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user