mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-04-25 11:46:06 +02:00
feat(clipboard): support readImage & writeImage (#845)
* feat(clipboard): support `read_image` & `write_image` * fix plugin name * platform specific bahavior * remove unnecessary BufWriter * improvement * update example * update example * format * header, fix change file * use image from tauri * fix ci * update tauri, fix read * image crate only on desktop [skip ci] * Update plugins/authenticator/src/u2f_crate/protocol.rs [skip ci] Co-authored-by: Amr Bashir <amr.bashir2015@gmail.com> * Update plugins/authenticator/src/u2f_crate/protocol.rs [skip ci] Co-authored-by: Amr Bashir <amr.bashir2015@gmail.com> * update deps, address code review * fix mobile [skip ci] --------- Co-authored-by: Lucas Nogueira <lucas@tauri.studio> Co-authored-by: Lucas Nogueira <lucas@tauri.app> Co-authored-by: Amr Bashir <amr.bashir2015@gmail.com>
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
"serve": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "2.0.0-beta.4",
|
||||
"@tauri-apps/api": "2.0.0-beta.6",
|
||||
"@tauri-apps/plugin-barcode-scanner": "2.0.0-beta.2",
|
||||
"@tauri-apps/plugin-biometric": "2.0.0-beta.2",
|
||||
"@tauri-apps/plugin-cli": "2.0.0-beta.2",
|
||||
@@ -30,7 +30,7 @@
|
||||
"@iconify-json/codicon": "^1.1.37",
|
||||
"@iconify-json/ph": "^1.1.8",
|
||||
"@sveltejs/vite-plugin-svelte": "^3.0.1",
|
||||
"@tauri-apps/cli": "2.0.0-beta.7",
|
||||
"@tauri-apps/cli": "2.0.0-beta.9",
|
||||
"@unocss/extractor-svelte": "^0.58.0",
|
||||
"internal-ip": "^8.0.0",
|
||||
"svelte": "^4.2.8",
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
"tray:default",
|
||||
"event:default",
|
||||
"window:default",
|
||||
"image:default",
|
||||
"notification:default",
|
||||
"os:allow-platform",
|
||||
"dialog:allow-open",
|
||||
@@ -54,8 +55,10 @@
|
||||
},
|
||||
"shell:allow-kill",
|
||||
"shell:allow-stdin-write",
|
||||
"clipboard-manager:allow-read",
|
||||
"clipboard-manager:allow-write",
|
||||
"clipboard-manager:allow-read-text",
|
||||
"clipboard-manager:allow-write-text",
|
||||
"clipboard-manager:allow-read-image",
|
||||
"clipboard-manager:allow-write-image",
|
||||
"fs:allow-rename",
|
||||
"fs:allow-mkdir",
|
||||
"fs:allow-remove",
|
||||
|
||||
@@ -41,8 +41,7 @@
|
||||
"type": "object",
|
||||
"required": [
|
||||
"identifier",
|
||||
"permissions",
|
||||
"windows"
|
||||
"permissions"
|
||||
],
|
||||
"properties": {
|
||||
"identifier": {
|
||||
@@ -93,14 +92,10 @@
|
||||
},
|
||||
"platforms": {
|
||||
"description": "Target platforms this capability applies. By default all platforms are affected by this capability.",
|
||||
"default": [
|
||||
"linux",
|
||||
"macOS",
|
||||
"windows",
|
||||
"android",
|
||||
"iOS"
|
||||
"type": [
|
||||
"array",
|
||||
"null"
|
||||
],
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/Target"
|
||||
}
|
||||
@@ -115,7 +110,7 @@
|
||||
],
|
||||
"properties": {
|
||||
"urls": {
|
||||
"description": "Remote domains this capability refers to. Can use glob patterns.",
|
||||
"description": "Remote domains this capability refers to using the [URLPattern standard](https://urlpattern.spec.whatwg.org/).\n\n# Examples\n\n- \"https://*.mydomain.dev\": allows subdomains of mydomain.dev - \"https://mydomain.dev/api/*\": allows any subpath of mydomain.dev/api",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
@@ -2297,6 +2292,12 @@
|
||||
"properties": {
|
||||
"identifier": {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"shell:default"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "shell:allow-execute -> Enables the execute command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
@@ -2532,31 +2533,99 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "clipboard-manager:allow-read -> Enables the read command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"clipboard-manager:allow-read"
|
||||
"clipboard-manager:default"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "clipboard-manager:allow-write -> Enables the write command without any pre-configured scope.",
|
||||
"description": "clipboard-manager:allow-clear -> Enables the clear command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"clipboard-manager:allow-write"
|
||||
"clipboard-manager:allow-clear"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "clipboard-manager:deny-read -> Denies the read command without any pre-configured scope.",
|
||||
"description": "clipboard-manager:allow-read-image -> Enables the read_image command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"clipboard-manager:deny-read"
|
||||
"clipboard-manager:allow-read-image"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "clipboard-manager:deny-write -> Denies the write command without any pre-configured scope.",
|
||||
"description": "clipboard-manager:allow-read-text -> Enables the read_text command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"clipboard-manager:deny-write"
|
||||
"clipboard-manager:allow-read-text"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "clipboard-manager:allow-write-html -> Enables the write_html command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"clipboard-manager:allow-write-html"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "clipboard-manager:allow-write-image -> Enables the write_image command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"clipboard-manager:allow-write-image"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "clipboard-manager:allow-write-text -> Enables the write_text command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"clipboard-manager:allow-write-text"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "clipboard-manager:deny-clear -> Denies the clear command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"clipboard-manager:deny-clear"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "clipboard-manager:deny-read-image -> Denies the read_image command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"clipboard-manager:deny-read-image"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "clipboard-manager:deny-read-text -> Denies the read_text command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"clipboard-manager:deny-read-text"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "clipboard-manager:deny-write-html -> Denies the write_html command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"clipboard-manager:deny-write-html"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "clipboard-manager:deny-write-image -> Denies the write_image command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"clipboard-manager:deny-write-image"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "clipboard-manager:deny-write-text -> Denies the write_text command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"clipboard-manager:deny-write-text"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"dialog:default"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -4680,6 +4749,12 @@
|
||||
"fs:write-files"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"global-shortcut:default"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "global-shortcut:allow-is-registered -> Enables the is_registered command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
@@ -4827,13 +4902,6 @@
|
||||
"image:allow-from-bytes"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "image:allow-from-ico-bytes -> Enables the from_ico_bytes command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"image:allow-from-ico-bytes"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "image:allow-from-path -> Enables the from_path command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
@@ -4841,20 +4909,6 @@
|
||||
"image:allow-from-path"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "image:allow-from-png-bytes -> Enables the from_png_bytes command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"image:allow-from-png-bytes"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "image:allow-height -> Enables the height command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"image:allow-height"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "image:allow-new -> Enables the new command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
@@ -4870,10 +4924,10 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "image:allow-width -> Enables the width command without any pre-configured scope.",
|
||||
"description": "image:allow-size -> Enables the size command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"image:allow-width"
|
||||
"image:allow-size"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -4883,13 +4937,6 @@
|
||||
"image:deny-from-bytes"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "image:deny-from-ico-bytes -> Denies the from_ico_bytes command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"image:deny-from-ico-bytes"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "image:deny-from-path -> Denies the from_path command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
@@ -4897,20 +4944,6 @@
|
||||
"image:deny-from-path"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "image:deny-from-png-bytes -> Denies the from_png_bytes command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"image:deny-from-png-bytes"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "image:deny-height -> Denies the height command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"image:deny-height"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "image:deny-new -> Denies the new command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
@@ -4926,10 +4959,10 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "image:deny-width -> Denies the width command without any pre-configured scope.",
|
||||
"description": "image:deny-size -> Denies the size command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"image:deny-width"
|
||||
"image:deny-size"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -5317,6 +5350,12 @@
|
||||
"notification:deny-request-permission"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"os:default"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "os:allow-arch -> Enables the arch command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
@@ -5548,6 +5587,12 @@
|
||||
"path:deny-resolve-directory"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"process:default"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "process:allow-exit -> Enables the exit command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
@@ -5597,6 +5642,12 @@
|
||||
"resources:deny-close"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"shell:default"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "shell:allow-execute -> Enables the execute command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
@@ -5660,6 +5711,13 @@
|
||||
"tray:default"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "tray:allow-get-by-id -> Enables the get_by_id command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"tray:allow-get-by-id"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "tray:allow-new -> Enables the new command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
@@ -5667,6 +5725,13 @@
|
||||
"tray:allow-new"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "tray:allow-remove-by-id -> Enables the remove_by_id command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"tray:allow-remove-by-id"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "tray:allow-set-icon -> Enables the set_icon command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
@@ -5723,6 +5788,13 @@
|
||||
"tray:allow-set-visible"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "tray:deny-get-by-id -> Denies the get_by_id command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"tray:deny-get-by-id"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "tray:deny-new -> Denies the new command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
@@ -5730,6 +5802,13 @@
|
||||
"tray:deny-new"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "tray:deny-remove-by-id -> Denies the remove_by_id command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"tray:deny-remove-by-id"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "tray:deny-set-icon -> Denies the set_icon command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
|
||||
@@ -11,6 +11,13 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "A list of capabilities.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/Capability"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "A list of capabilities.",
|
||||
"type": "object",
|
||||
@@ -34,8 +41,7 @@
|
||||
"type": "object",
|
||||
"required": [
|
||||
"identifier",
|
||||
"permissions",
|
||||
"windows"
|
||||
"permissions"
|
||||
],
|
||||
"properties": {
|
||||
"identifier": {
|
||||
@@ -86,14 +92,10 @@
|
||||
},
|
||||
"platforms": {
|
||||
"description": "Target platforms this capability applies. By default all platforms are affected by this capability.",
|
||||
"default": [
|
||||
"linux",
|
||||
"macOS",
|
||||
"windows",
|
||||
"android",
|
||||
"iOS"
|
||||
"type": [
|
||||
"array",
|
||||
"null"
|
||||
],
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/Target"
|
||||
}
|
||||
@@ -108,7 +110,7 @@
|
||||
],
|
||||
"properties": {
|
||||
"urls": {
|
||||
"description": "Remote domains this capability refers to. Can use glob patterns.",
|
||||
"description": "Remote domains this capability refers to using the [URLPattern standard](https://urlpattern.spec.whatwg.org/).\n\n# Examples\n\n- \"https://*.mydomain.dev\": allows subdomains of mydomain.dev - \"https://mydomain.dev/api/*\": allows any subpath of mydomain.dev/api",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
@@ -2290,6 +2292,12 @@
|
||||
"properties": {
|
||||
"identifier": {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"shell:default"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "shell:allow-execute -> Enables the execute command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
@@ -2503,6 +2511,12 @@
|
||||
"app:deny-version"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"barcode-scanner:default"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "barcode-scanner:allow-cancel -> Enables the cancel command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
@@ -2587,6 +2601,12 @@
|
||||
"barcode-scanner:deny-vibrate"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"biometric:default"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "biometric:allow-authenticate -> Enables the authenticate command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
@@ -2616,31 +2636,99 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "clipboard-manager:allow-read -> Enables the read command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"clipboard-manager:allow-read"
|
||||
"clipboard-manager:default"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "clipboard-manager:allow-write -> Enables the write command without any pre-configured scope.",
|
||||
"description": "clipboard-manager:allow-clear -> Enables the clear command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"clipboard-manager:allow-write"
|
||||
"clipboard-manager:allow-clear"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "clipboard-manager:deny-read -> Denies the read command without any pre-configured scope.",
|
||||
"description": "clipboard-manager:allow-read-image -> Enables the read_image command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"clipboard-manager:deny-read"
|
||||
"clipboard-manager:allow-read-image"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "clipboard-manager:deny-write -> Denies the write command without any pre-configured scope.",
|
||||
"description": "clipboard-manager:allow-read-text -> Enables the read_text command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"clipboard-manager:deny-write"
|
||||
"clipboard-manager:allow-read-text"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "clipboard-manager:allow-write-html -> Enables the write_html command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"clipboard-manager:allow-write-html"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "clipboard-manager:allow-write-image -> Enables the write_image command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"clipboard-manager:allow-write-image"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "clipboard-manager:allow-write-text -> Enables the write_text command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"clipboard-manager:allow-write-text"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "clipboard-manager:deny-clear -> Denies the clear command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"clipboard-manager:deny-clear"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "clipboard-manager:deny-read-image -> Denies the read_image command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"clipboard-manager:deny-read-image"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "clipboard-manager:deny-read-text -> Denies the read_text command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"clipboard-manager:deny-read-text"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "clipboard-manager:deny-write-html -> Denies the write_html command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"clipboard-manager:deny-write-html"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "clipboard-manager:deny-write-image -> Denies the write_image command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"clipboard-manager:deny-write-image"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "clipboard-manager:deny-write-text -> Denies the write_text command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"clipboard-manager:deny-write-text"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"dialog:default"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -4827,6 +4915,83 @@
|
||||
"http:deny-fetch-send"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "image:default -> Default permissions for the plugin.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"image:default"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "image:allow-from-bytes -> Enables the from_bytes command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"image:allow-from-bytes"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "image:allow-from-path -> Enables the from_path command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"image:allow-from-path"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "image:allow-new -> Enables the new command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"image:allow-new"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "image:allow-rgba -> Enables the rgba command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"image:allow-rgba"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "image:allow-size -> Enables the size command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"image:allow-size"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "image:deny-from-bytes -> Denies the from_bytes command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"image:deny-from-bytes"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "image:deny-from-path -> Denies the from_path command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"image:deny-from-path"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "image:deny-new -> Denies the new command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"image:deny-new"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "image:deny-rgba -> Denies the rgba command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"image:deny-rgba"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "image:deny-size -> Denies the size command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"image:deny-size"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "log:default -> Allows the log command",
|
||||
"type": "string",
|
||||
@@ -5163,6 +5328,12 @@
|
||||
"menu:deny-text"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"nfc:default"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "nfc:allow-is-available -> Enables the is_available command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
@@ -5254,6 +5425,12 @@
|
||||
"notification:deny-request-permission"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"os:default"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "os:allow-arch -> Enables the arch command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
@@ -5485,6 +5662,12 @@
|
||||
"path:deny-resolve-directory"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"process:default"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "process:allow-exit -> Enables the exit command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
@@ -5534,6 +5717,12 @@
|
||||
"resources:deny-close"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"shell:default"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "shell:allow-execute -> Enables the execute command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
@@ -5597,6 +5786,13 @@
|
||||
"tray:default"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "tray:allow-get-by-id -> Enables the get_by_id command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"tray:allow-get-by-id"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "tray:allow-new -> Enables the new command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
@@ -5604,6 +5800,13 @@
|
||||
"tray:allow-new"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "tray:allow-remove-by-id -> Enables the remove_by_id command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"tray:allow-remove-by-id"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "tray:allow-set-icon -> Enables the set_icon command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
@@ -5660,6 +5863,13 @@
|
||||
"tray:allow-set-visible"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "tray:deny-get-by-id -> Denies the get_by_id command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"tray:deny-get-by-id"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "tray:deny-new -> Denies the new command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
@@ -5667,6 +5877,13 @@
|
||||
"tray:deny-new"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "tray:deny-remove-by-id -> Denies the remove_by_id command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"tray:deny-remove-by-id"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "tray:deny-set-icon -> Denies the set_icon command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
|
||||
@@ -80,9 +80,10 @@ pub fn create_tray<R: Runtime>(app: &tauri::AppHandle<R>) -> tauri::Result<()> {
|
||||
i @ "icon-1" | i @ "icon-2" => {
|
||||
if let Some(tray) = app.tray_by_id("tray-1") {
|
||||
let _ = tray.set_icon(Some(if i == "icon-1" {
|
||||
tauri::Image::from_ico_bytes(include_bytes!("../icons/icon.ico")).unwrap()
|
||||
tauri::image::Image::from_bytes(include_bytes!("../icons/icon.ico"))
|
||||
.unwrap()
|
||||
} else {
|
||||
tauri::Image::from_png_bytes(include_bytes!(
|
||||
tauri::image::Image::from_bytes(include_bytes!(
|
||||
"../icons/tray_icon_with_transparency.png"
|
||||
))
|
||||
.unwrap()
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
export function arrayBufferToBase64(buffer, callback) {
|
||||
const blob = new Blob([buffer], {
|
||||
type: "application/octet-binary",
|
||||
});
|
||||
const reader = new FileReader();
|
||||
reader.onload = function (evt) {
|
||||
const dataurl = evt.target.result;
|
||||
callback(dataurl.substr(dataurl.indexOf(",") + 1));
|
||||
};
|
||||
reader.readAsDataURL(blob);
|
||||
}
|
||||
@@ -1,23 +1,59 @@
|
||||
<script>
|
||||
import { writeText, readText } from "@tauri-apps/plugin-clipboard-manager";
|
||||
import * as clipboard from "@tauri-apps/plugin-clipboard-manager";
|
||||
import { open } from "@tauri-apps/plugin-dialog";
|
||||
import { arrayBufferToBase64 } from "../lib/utils";
|
||||
import { readFile } from "@tauri-apps/plugin-fs";
|
||||
|
||||
export let onMessage;
|
||||
export let insecureRenderHtml;
|
||||
let text = "clipboard message";
|
||||
|
||||
function write() {
|
||||
writeText(text)
|
||||
function writeText() {
|
||||
clipboard
|
||||
.writeText(text)
|
||||
.then(() => {
|
||||
onMessage("Wrote to the clipboard");
|
||||
})
|
||||
.catch(onMessage);
|
||||
}
|
||||
|
||||
function read() {
|
||||
readText()
|
||||
async function writeImage() {
|
||||
try {
|
||||
const res = await open({
|
||||
title: "Image to write to clipboard",
|
||||
filters: [
|
||||
{
|
||||
name: "Clipboard IMG",
|
||||
extensions: ["png", "jpg", "jpeg"],
|
||||
},
|
||||
],
|
||||
});
|
||||
const bytes = await readFile(res.path);
|
||||
await clipboard.writeImage(bytes);
|
||||
onMessage("wrote image");
|
||||
} catch (e) {
|
||||
onMessage(e);
|
||||
}
|
||||
}
|
||||
|
||||
async function read() {
|
||||
try {
|
||||
const image = await clipboard.readImage();
|
||||
arrayBufferToBase64(await image.rgba(), function (base64) {
|
||||
const src = "data:image/png;base64," + base64;
|
||||
insecureRenderHtml('<img src="' + src + '"></img>');
|
||||
});
|
||||
return;
|
||||
} catch (_) {}
|
||||
|
||||
clipboard
|
||||
.readText()
|
||||
.then((contents) => {
|
||||
onMessage(`Clipboard contents: ${contents}`);
|
||||
})
|
||||
.catch(onMessage);
|
||||
.catch((e) => {
|
||||
onMessage(e);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -27,6 +63,8 @@
|
||||
placeholder="Text to write to the clipboard"
|
||||
bind:value={text}
|
||||
/>
|
||||
<button class="btn" type="button" on:click={write}>Write</button>
|
||||
<button class="btn" type="button" on:click={writeText}>Write</button>
|
||||
<button class="btn" type="button" on:click={writeImage}>Pick Image</button>
|
||||
|
||||
<button class="btn" type="button" on:click={read}>Read</button>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<script>
|
||||
import * as fs from "@tauri-apps/plugin-fs";
|
||||
import { convertFileSrc } from "@tauri-apps/api/core";
|
||||
import { arrayBufferToBase64 } from "../lib/utils";
|
||||
|
||||
export let onMessage;
|
||||
export let insecureRenderHtml;
|
||||
@@ -20,18 +21,6 @@
|
||||
return dirSelect.value ? parseInt(dir.value) : null;
|
||||
}
|
||||
|
||||
function arrayBufferToBase64(buffer, callback) {
|
||||
const blob = new Blob([buffer], {
|
||||
type: "application/octet-binary",
|
||||
});
|
||||
const reader = new FileReader();
|
||||
reader.onload = function (evt) {
|
||||
const dataurl = evt.target.result;
|
||||
callback(dataurl.substr(dataurl.indexOf(",") + 1));
|
||||
};
|
||||
reader.readAsDataURL(blob);
|
||||
}
|
||||
|
||||
const DirOptions = Object.keys(fs.BaseDirectory)
|
||||
.filter((key) => isNaN(parseInt(key)))
|
||||
.map((dir) => [dir, fs.BaseDirectory[dir]]);
|
||||
@@ -215,7 +204,7 @@
|
||||
<button class="btn" on:click={stat}>Stat</button>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
|
||||
<h3>Watch</h3>
|
||||
|
||||
<input
|
||||
@@ -225,7 +214,9 @@
|
||||
/>
|
||||
<br />
|
||||
<div>
|
||||
<label for="watch-debounce-delay">Debounce delay in milliseconds (`0` disables the debouncer)</label>
|
||||
<label for="watch-debounce-delay"
|
||||
>Debounce delay in milliseconds (`0` disables the debouncer)</label
|
||||
>
|
||||
<input
|
||||
class="input"
|
||||
id="watch-debounce-delay"
|
||||
|
||||
Reference in New Issue
Block a user