diff --git a/Cargo.lock b/Cargo.lock index 23f4bb0b..62acfde8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -233,6 +233,7 @@ dependencies = [ "tauri-plugin-shell", "tauri-plugin-store", "tauri-plugin-updater", + "tauri-plugin-upload", "tauri-plugin-window-state", "time", "tiny_http", diff --git a/examples/api/package.json b/examples/api/package.json index c81db111..7cd411cc 100644 --- a/examples/api/package.json +++ b/examples/api/package.json @@ -29,6 +29,7 @@ "@tauri-apps/plugin-shell": "^2.3.0", "@tauri-apps/plugin-store": "^2.3.0", "@tauri-apps/plugin-updater": "^2.9.0", + "@tauri-apps/plugin-upload": "^2.3.0", "@zerodevx/svelte-json-view": "1.0.11" }, "devDependencies": { diff --git a/examples/api/src-tauri/Cargo.toml b/examples/api/src-tauri/Cargo.toml index d9966254..9a2d349c 100644 --- a/examples/api/src-tauri/Cargo.toml +++ b/examples/api/src-tauri/Cargo.toml @@ -38,6 +38,7 @@ tauri-plugin-process = { path = "../../../plugins/process", version = "2.3.0" } tauri-plugin-opener = { path = "../../../plugins/opener", version = "2.4.0" } tauri-plugin-shell = { path = "../../../plugins/shell", version = "2.3.0" } tauri-plugin-store = { path = "../../../plugins/store", version = "2.3.0" } +tauri-plugin-upload = { path = "../../../plugins/upload", version = "2.3.0" } [dependencies.tauri] workspace = true diff --git a/examples/api/src-tauri/capabilities/base.json b/examples/api/src-tauri/capabilities/base.json index 1fb9f244..8508bb6b 100644 --- a/examples/api/src-tauri/capabilities/base.json +++ b/examples/api/src-tauri/capabilities/base.json @@ -95,6 +95,7 @@ { "identifier": "opener:allow-open-path", "allow": [{ "path": "$APPDATA" }, { "path": "$APPDATA/**" }] - } + }, + "upload:default" ] } diff --git a/examples/api/src-tauri/src/lib.rs b/examples/api/src-tauri/src/lib.rs index a19992b0..3c58f2c8 100644 --- a/examples/api/src-tauri/src/lib.rs +++ b/examples/api/src-tauri/src/lib.rs @@ -39,6 +39,7 @@ pub fn run() { .plugin(tauri_plugin_opener::init()) .plugin(tauri_plugin_shell::init()) .plugin(tauri_plugin_store::Builder::default().build()) + .plugin(tauri_plugin_upload::init()) .setup(move |app| { #[cfg(desktop)] { diff --git a/examples/api/src/App.svelte b/examples/api/src/App.svelte index 9396f6f9..8e114c4b 100644 --- a/examples/api/src/App.svelte +++ b/examples/api/src/App.svelte @@ -16,6 +16,7 @@ import Opener from './views/Opener.svelte' import Store from './views/Store.svelte' import Updater from './views/Updater.svelte' + import Upload from './views/Upload.svelte' import Clipboard from './views/Clipboard.svelte' import WebRTC from './views/WebRTC.svelte' import Scanner from './views/Scanner.svelte' @@ -107,6 +108,11 @@ component: Updater, icon: 'i-codicon-cloud-download' }, + { + label: 'Upload', + component: Upload, + icon: 'i-codicon-cloud-upload' + }, { label: 'Clipboard', component: Clipboard, diff --git a/examples/api/src/views/Upload.svelte b/examples/api/src/views/Upload.svelte new file mode 100644 index 00000000..6c1c3852 --- /dev/null +++ b/examples/api/src/views/Upload.svelte @@ -0,0 +1,376 @@ + + +
+
+

File Download

+ +
+
+ + +
+ +
+ +
+ + +
+
+ + {#if downloadPath} +
+
+ File will be saved as: +
{downloadPath}
+
+
+ {/if} + + + + {#if downloadProgress} +
+
+ Progress: {downloadProgress.percentage}% + Speed: {Math.round(downloadProgress.transferSpeed / 1024)} KB/s +
+
+
+
+
+ {Math.round(downloadProgress.progressTotal / 1024)} KB / {Math.round(downloadProgress.total / 1024)} KB +
+
+ {/if} + + {#if downloadResult} +
+ +
+ {/if} +
+
+ +
+

File Upload

+ +
+
+ + +
+ +
+ +
+ + +
+
+ + + + {#if uploadProgress} +
+
+ Progress: {uploadProgress.percentage}% + Speed: {Math.round(uploadProgress.transferSpeed / 1024)} KB/s +
+
+
+
+
+ {Math.round(uploadProgress.progressTotal / 1024)} KB / {Math.round(uploadProgress.total / 1024)} KB +
+
+ {/if} + + {#if uploadResult} +
+ +
+ {/if} +
+
+
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 46a684e3..aa0ba090 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -110,6 +110,9 @@ importers: '@tauri-apps/plugin-updater': specifier: ^2.9.0 version: link:../../plugins/updater + '@tauri-apps/plugin-upload': + specifier: ^2.3.0 + version: link:../../plugins/upload '@zerodevx/svelte-json-view': specifier: 1.0.11 version: 1.0.11(svelte@5.28.2) @@ -2339,9 +2342,9 @@ snapshots: - encoding - mocha - '@covector/assemble@0.12.0(mocha@10.8.2)': + '@covector/assemble@0.12.0': dependencies: - '@covector/command': 0.8.0(mocha@10.8.2) + '@covector/command': 0.8.0 '@covector/files': 0.8.0 effection: 2.0.8(mocha@10.8.2) js-yaml: 4.1.0 @@ -2352,10 +2355,9 @@ snapshots: unified: 9.2.2 transitivePeerDependencies: - encoding - - mocha - supports-color - '@covector/changelog@0.12.0(mocha@10.8.2)': + '@covector/changelog@0.12.0': dependencies: '@covector/files': 0.8.0 effection: 2.0.8(mocha@10.8.2) @@ -2365,16 +2367,14 @@ snapshots: unified: 9.2.2 transitivePeerDependencies: - encoding - - mocha - supports-color - '@covector/command@0.8.0(mocha@10.8.2)': + '@covector/command@0.8.0': dependencies: '@effection/process': 2.1.4 effection: 2.0.8(mocha@10.8.2) transitivePeerDependencies: - encoding - - mocha '@covector/files@0.8.0': dependencies: @@ -2421,6 +2421,8 @@ snapshots: dependencies: effection: 2.0.8(mocha@10.8.2) mocha: 10.8.2 + transitivePeerDependencies: + - encoding '@effection/process@2.1.4': dependencies: @@ -3258,9 +3260,9 @@ snapshots: dependencies: '@clack/prompts': 0.7.0 '@covector/apply': 0.10.0(mocha@10.8.2) - '@covector/assemble': 0.12.0(mocha@10.8.2) - '@covector/changelog': 0.12.0(mocha@10.8.2) - '@covector/command': 0.8.0(mocha@10.8.2) + '@covector/assemble': 0.12.0 + '@covector/changelog': 0.12.0 + '@covector/command': 0.8.0 '@covector/files': 0.8.0 effection: 2.0.8(mocha@10.8.2) globby: 11.1.0