diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3ef97ec..44bddbc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,15 +31,6 @@ jobs: deno-version: v2.x - name: Install Rust stable uses: dtolnay/rust-toolchain@stable - - name: Install Dependencies - run: pnpm install - - name: Setup - run: pnpm prepare - - name: Build - run: pnpm build - - name: JS Test - if: matrix.os == 'ubuntu-24.04' - run: pnpm test - name: Install protobuf (Mac) if: matrix.os == 'macos-14' run: | @@ -55,11 +46,17 @@ jobs: choco install protoc echo "VCPKG_ROOT=$env:VCPKG_INSTALLATION_ROOT" | Out-File -FilePath $env:GITHUB_ENV -Append vcpkg install openssl:x64-windows-static-md - # choco install openssl -y - # echo OPENSSL_DIR='"C:\\Program Files\\OpenSSL-Win64"' >> $env:GITHUB_ENV - # echo OPENSSL_INCLUDE_DIR='"C:\\Program Files\\OpenSSL-Win64\\include"' >> $env:GITHUB_ENV - # echo OPENSSL_LIB_DIR='"C:\\Program Files\\OpenSSL-Win64\\lib"' >> $env:GITHUB_ENV - # openssl version + - name: Install Dependencies + run: pnpm install + - name: Setup + run: pnpm prepare + - name: Build + env: + NODE_OPTIONS: --max-old-space-size=4096 + run: pnpm build + - name: JS Test + if: matrix.os == 'ubuntu-24.04' + run: pnpm test - name: Cargo Build and Test if: matrix.os == 'ubuntu-24.04' run: | diff --git a/.github/workflows/manifest-schema-upload.yml b/.github/workflows/manifest-schema-upload.yml index 3aa0c8f..76f87ec 100644 --- a/.github/workflows/manifest-schema-upload.yml +++ b/.github/workflows/manifest-schema-upload.yml @@ -23,6 +23,10 @@ jobs: - uses: denoland/setup-deno@v2 with: deno-version: v2.x + - name: Install Protobuf + run: | + sudo apt-get update + sudo apt-get install -y protobuf-compiler - name: Install Dependencies run: pnpm install - name: Setup diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 63da6db..89b5b48 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -3,6 +3,7 @@ "svelte.svelte-vscode", "tauri-apps.tauri-vscode", "rust-lang.rust-analyzer", - "denoland.vscode-deno" + "denoland.vscode-deno", + "tamasfe.even-better-toml" ] } diff --git a/Cargo.lock b/Cargo.lock index 10958e2..b7844fd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -612,12 +612,6 @@ version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" -[[package]] -name = "base64ct" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" - [[package]] name = "bindgen" version = "0.69.5" @@ -1235,12 +1229,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe1d7dcda7d1da79e444bdfba1465f2f849a58b07774e1df473ee77030cb47a7" -[[package]] -name = "const-oid" -version = "0.9.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" - [[package]] name = "const-random" version = "0.1.18" @@ -1471,14 +1459,11 @@ dependencies = [ "axum-server", "block-padding", "cbc", - "hex", "openssl", "rand 0.8.5", "reqwest 0.12.9", "ring", - "rsa", "rustls 0.23.16", - "sha2", "tokio", ] @@ -1589,17 +1574,6 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da692b8d1080ea3045efaab14434d40468c3d8657e42abddfffca87b428f4c1b" -[[package]] -name = "der" -version = "0.7.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" -dependencies = [ - "const-oid", - "pem-rfc7468", - "zeroize", -] - [[package]] name = "deranged" version = "0.3.11" @@ -1652,7 +1626,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", - "const-oid", "crypto-common", "subtle", ] @@ -2026,9 +1999,9 @@ checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" [[package]] name = "flate2" -version = "1.0.34" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1b589b4dc103969ad3cf85c950899926ec64300a1a46d76c03a6072957036f0" +checksum = "c936bfdafb507ebbf50b8074c54fa31c5be9a1e7e5f467dd659697041407d07c" dependencies = [ "crc32fast", "libz-ng-sys", @@ -2529,6 +2502,19 @@ dependencies = [ "system-deps", ] +[[package]] +name = "grpc" +version = "0.1.0" +dependencies = [ + "anyhow", + "prost", + "serde", + "serde_json", + "tonic", + "tonic-build", + "uuid", +] + [[package]] name = "gtk" version = "0.18.1" @@ -3318,6 +3304,7 @@ dependencies = [ "anyhow", "chrono", "cocoa 0.24.1", + "crypto", "log", "mac-security-rs", "mdns-sd", @@ -3358,9 +3345,6 @@ name = "lazy_static" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" -dependencies = [ - "spin", -] [[package]] name = "lazycell" @@ -3435,12 +3419,6 @@ dependencies = [ "windows-targets 0.52.6", ] -[[package]] -name = "libm" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8355be11b20d696c8f18f6cc018c4e372165b1fa8126cef092399c9951984ffa" - [[package]] name = "libredox" version = "0.1.3" @@ -3882,23 +3860,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "num-bigint-dig" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc84195820f291c7697304f3cbdadd1cb7199c0efc917ff5eafd71225c136151" -dependencies = [ - "byteorder", - "lazy_static", - "libm", - "num-integer", - "num-iter", - "num-traits", - "rand 0.8.5", - "smallvec", - "zeroize", -] - [[package]] name = "num-conv" version = "0.1.0" @@ -3936,17 +3897,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "num-iter" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - [[package]] name = "num-rational" version = "0.4.2" @@ -3965,7 +3915,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", - "libm", ] [[package]] @@ -4468,15 +4417,6 @@ dependencies = [ "hmac", ] -[[package]] -name = "pem-rfc7468" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" -dependencies = [ - "base64ct", -] - [[package]] name = "percent-encoding" version = "2.3.1" @@ -4670,27 +4610,6 @@ dependencies = [ "futures-io", ] -[[package]] -name = "pkcs1" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f" -dependencies = [ - "der", - "pkcs8", - "spki", -] - -[[package]] -name = "pkcs8" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" -dependencies = [ - "der", - "spki", -] - [[package]] name = "pkg-config" version = "0.3.31" @@ -5448,27 +5367,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "rsa" -version = "0.9.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d0e5124fcb30e76a7e79bfee683a2746db83784b86289f6251b54b7950a0dfc" -dependencies = [ - "const-oid", - "digest", - "num-bigint-dig", - "num-integer", - "num-traits", - "pkcs1", - "pkcs8", - "rand_core 0.6.4", - "sha2", - "signature", - "spki", - "subtle", - "zeroize", -] - [[package]] name = "rusqlite" version = "0.31.0" @@ -5575,6 +5473,20 @@ dependencies = [ "sct", ] +[[package]] +name = "rustls" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" +dependencies = [ + "log", + "ring", + "rustls-pki-types", + "rustls-webpki 0.102.8", + "subtle", + "zeroize", +] + [[package]] name = "rustls" version = "0.23.16" @@ -5979,16 +5891,6 @@ dependencies = [ "libc", ] -[[package]] -name = "signature" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" -dependencies = [ - "digest", - "rand_core 0.6.4", -] - [[package]] name = "simd-adler32" version = "0.3.7" @@ -6098,16 +6000,6 @@ dependencies = [ "lock_api", ] -[[package]] -name = "spki" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" -dependencies = [ - "base64ct", - "der", -] - [[package]] name = "stable_deref_trait" version = "1.2.0" @@ -6293,6 +6185,20 @@ dependencies = [ "windows 0.52.0", ] +[[package]] +name = "sysinfo" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3b5ae3f4f7d64646c46c4cae4e3f01d1c5d255c7406fdd7c7f999a94e488791" +dependencies = [ + "core-foundation-sys", + "libc", + "memchr", + "ntapi", + "rayon", + "windows 0.56.0", +] + [[package]] name = "system-configuration" version = "0.5.1" @@ -6702,18 +6608,26 @@ dependencies = [ "crypto", "db", "flate2", + "futures-util", + "grpc", "ico", "log", "mac-security-rs", "mdns-sd", + "mime_guess", "obfstr", + "openssl", "plist", "prost", + "rayon", + "reqwest 0.12.9", "rust_search", + "rustls 0.23.16", "serde", "serde_json", "strum", "strum_macros", + "sysinfo 0.32.0", "tar", "tauri", "tauri-icns", @@ -6721,9 +6635,12 @@ dependencies = [ "tauri-plugin-clipboard", "tauri-plugin-network", "tauri-plugin-store", + "tauri-plugin-upload", "tauri-winres", "thiserror 1.0.66", "tokio", + "tokio-stream", + "tokio-util", "tonic", "tonic-build", "tonic-reflection", @@ -6901,7 +6818,7 @@ version = "2.0.8" dependencies = [ "serde", "starship-battery", - "sysinfo", + "sysinfo 0.30.13", "tauri", "tauri-plugin", "thiserror 1.0.66", @@ -6940,9 +6857,8 @@ dependencies = [ [[package]] name = "tauri-plugin-upload" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "116754130d3f95cf73552a0723376186a8f21607ac5ff350980af87a0eccba73" +version = "2.2.1" +source = "git+https://github.com/HuakunShen/tauri-plugins-workspace.git?branch=kunkun#70f6d77c69715683a0b63841b49bf6c0c3b98d4c" dependencies = [ "futures-util", "log", @@ -6952,7 +6868,7 @@ dependencies = [ "serde_json", "tauri", "tauri-plugin", - "thiserror 1.0.66", + "thiserror 2.0.3", "tokio", "tokio-util", ] @@ -7257,6 +7173,17 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-rustls" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" +dependencies = [ + "rustls 0.22.4", + "rustls-pki-types", + "tokio", +] + [[package]] name = "tokio-rustls" version = "0.26.0" @@ -7370,7 +7297,10 @@ dependencies = [ "percent-encoding", "pin-project", "prost", + "rustls-pemfile 2.2.0", + "rustls-pki-types", "tokio", + "tokio-rustls 0.25.0", "tokio-stream", "tower", "tower-layer", diff --git a/Cargo.toml b/Cargo.toml index 2e165db..45caf75 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,6 +8,7 @@ members = [ "packages/mac-security-rs", "packages/tauri-plugins/jarvis", "packages/crypto", + "packages/grpc", ] [workspace.dependencies] @@ -15,6 +16,7 @@ serde = { version = "1", features = ["derive"] } anyhow = "1.0.86" serde_json = "1" tokio = { version = "1.0", features = ["macros", "rt-multi-thread", "signal"] } +tokio-util = "0.7.12" mdns-sd = "0.11.1" tauri-plugin-network = { path = "./vendors/tauri-plugin-network" } tauri-plugin-clipboard = "2.1.8" @@ -24,6 +26,7 @@ strum = "0.26" strum_macros = "0.26" chrono = "0.4.38" applications = { path = "./vendors/applications-rs" } +grpc = { path = "./packages/grpc" } tauri-plugin-jarvis = { path = "./packages/tauri-plugins/jarvis" } tauri-plugin-system-info = { path = "./vendors/tauri-plugin-system-info" } db = { path = "./packages/db" } @@ -35,3 +38,9 @@ reqwest = { version = "0.12", features = ["json", "rustls-tls"] } crypto = { path = "./packages/crypto" } base64 = "0.22.1" obfstr = "0.4.4" +sysinfo = "0.32.0" +openssl = "0.10.68" +tower = { version = "0.4", features = ["util"] } +tower-http = { version = "0.4.0", features = ["fs", "trace", "cors"] } +rayon = "1.10.0" +tauri-plugin-upload = { git = "https://github.com/HuakunShen/tauri-plugins-workspace.git", branch = "kunkun", package = "tauri-plugin-upload" } diff --git a/apps/cli/package.json b/apps/cli/package.json index 8dd72aa..7de5fa4 100644 --- a/apps/cli/package.json +++ b/apps/cli/package.json @@ -30,9 +30,9 @@ "debug": "^4.3.6", "fs-extra": "^11.2.0", "inquirer": "^10.1.2", - "valibot": "^0.40.0" + "valibot": "^1.0.0-beta.8" }, "files": [ "dist" ] -} \ No newline at end of file +} diff --git a/apps/create-kunkun/package.json b/apps/create-kunkun/package.json index 314e834..e4c587e 100644 --- a/apps/create-kunkun/package.json +++ b/apps/create-kunkun/package.json @@ -27,7 +27,7 @@ "commander": "^12.1.0", "fs-extra": "^11.2.0", "handlebars": "^4.7.8", - "valibot": "^0.40.0" + "valibot": "^1.0.0-beta.8" }, "files": [ "dist" diff --git a/apps/desktop/package.json b/apps/desktop/package.json index 8a8c374..ecd4242 100644 --- a/apps/desktop/package.json +++ b/apps/desktop/package.json @@ -24,8 +24,9 @@ "@tauri-apps/api": "^2.1.1", "@tauri-apps/plugin-shell": "^2.0.1", "gsap": "^3.12.5", - "kkrpc": "^0.0.12", + "kkrpc": "^0.0.13", "lz-string": "^1.5.0", + "pretty-bytes": "^6.1.1", "semver": "^7.6.3", "svelte-sonner": "^0.3.28", "sveltekit-superforms": "^2.20.1", diff --git a/apps/desktop/src-tauri/Cargo.toml b/apps/desktop/src-tauri/Cargo.toml index ec90199..6e88b19 100644 --- a/apps/desktop/src-tauri/Cargo.toml +++ b/apps/desktop/src-tauri/Cargo.toml @@ -40,7 +40,8 @@ tauri-plugin-dialog = "2.0.1" tauri-plugin-notification = "2.0.1" tauri-plugin-os = "2.0.1" tauri-plugin-http = "2.0.1" -tauri-plugin-upload = "2.0.1" +tauri-plugin-upload = { workspace = true } +# tauri-plugin-upload = "2.2.1" tauri-plugin-jarvis = { workspace = true } tauri-plugin-network = { workspace = true } tauri-plugin-system-info = { workspace = true } @@ -48,6 +49,7 @@ tauri-plugin-clipboard = { workspace = true } tauri-plugin-store = "2.1.0" tauri-plugin-deep-link = "2" tauri-plugin-log = { version = "2.0.1", features = ["colored"] } +crypto = { workspace = true } zip = "2.1.3" uuid = "1.11.0" # tauri-plugin-devtools = "2.0.0" diff --git a/apps/desktop/src-tauri/src/lib.rs b/apps/desktop/src-tauri/src/lib.rs index ecadf7f..b870223 100644 --- a/apps/desktop/src-tauri/src/lib.rs +++ b/apps/desktop/src-tauri/src/lib.rs @@ -173,8 +173,11 @@ pub fn run() { )); app.manage(tauri_plugin_jarvis::model::app_state::AppState {}); tauri_plugin_jarvis::setup::server::setup_server(app.handle())?; // start the server - - let mdns = tauri_plugin_jarvis::setup::peer_discovery::setup_mdns(my_port)?; + let jarvis_state = app.state::(); + let mdns = tauri_plugin_jarvis::setup::peer_discovery::setup_mdns( + my_port, + crypto::RsaCrypto::public_key_to_string(&jarvis_state.rsa_public_key), + )?; tauri_plugin_jarvis::setup::peer_discovery::handle_mdns_service_evt( app.handle(), mdns.browse()?, diff --git a/apps/desktop/src-tauri/tauri.conf.json b/apps/desktop/src-tauri/tauri.conf.json index 6d03a5d..ef42742 100644 --- a/apps/desktop/src-tauri/tauri.conf.json +++ b/apps/desktop/src-tauri/tauri.conf.json @@ -36,6 +36,9 @@ ] }, "plugins": { + "fs": { + "requireLiteralLeadingDot": false + }, "updater": { "endpoints": ["https://updater.kunkun.sh"], "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDc1NENCRjZFM0JBOEQ0ODMKUldTRDFLZzdicjlNZFhHS0ZKYk13WkdZUTFUM01LNjkvVW5Bb2x1SnB1R0crbFRuMnlRSlJ0STgK" diff --git a/apps/desktop/src/lib/cmds/builtin.ts b/apps/desktop/src/lib/cmds/builtin.ts index f34cddb..f9f0b01 100644 --- a/apps/desktop/src/lib/cmds/builtin.ts +++ b/apps/desktop/src/lib/cmds/builtin.ts @@ -73,6 +73,18 @@ export const rawBuiltinCmds: BuiltinCmd[] = [ }, 2_000) } }, + { + name: "File Transfer", + icon: { + type: IconEnum.Iconify, + value: "clarity:file-share-solid" + }, + description: "", + function: async () => { + goto("/extension/file-transfer") + appState.clearSearchTerm() + } + }, { name: "Add Dev Extension", icon: { diff --git a/apps/desktop/src/lib/components/common/DragNDrop.svelte b/apps/desktop/src/lib/components/common/DragNDrop.svelte index c74dbce..0cea233 100644 --- a/apps/desktop/src/lib/components/common/DragNDrop.svelte +++ b/apps/desktop/src/lib/components/common/DragNDrop.svelte @@ -1,5 +1,5 @@ + + + +
+
+ {#if progresses.length > 0} + {#each progresses as progress} + {@const progressPerc = Math.round((progress.progressBytes / progress.totalBytes) * 100)} +
+ + {progressPerc}% + {prettyBytes(progress.transferSpeedBytesPerSecond)}ps +
+ {/each} + {/if} + + + (dragging = true)} onCancelled={() => (dragging = false)}> + + + {#if files.length > 0} +
+
Total Files: {previewBucketInfo?.total_files ?? 0}
+
Total Bytes: {prettyBytes(
+								previewBucketInfo?.total_bytes ?? 0
+							)}
+
+
+
+ {#each files as file} + { + files = files.filter((f) => f !== file) + }} + /> + {/each} +
+
+ {/if} +
+
+
+
+ + + Peers in local network + + + Hostname + Addreess + Port + Send + + + + {#each Object.values(peers) as peer} + + {peer.hostname} + {peer.addresses[0]} + {peer.port} + + + + + {/each} + + +
+
diff --git a/apps/desktop/src/routes/extension/file-transfer/file-icon.svelte b/apps/desktop/src/routes/extension/file-transfer/file-icon.svelte new file mode 100644 index 0000000..ca836cb --- /dev/null +++ b/apps/desktop/src/routes/extension/file-transfer/file-icon.svelte @@ -0,0 +1,35 @@ + + + + + {#if isDirectory} + + {:else} + + {/if} + + + +
{filepath}
+ +
+
diff --git a/apps/desktop/src/routes/extension/ui-iframe/+page.svelte b/apps/desktop/src/routes/extension/ui-iframe/+page.svelte index a7f0389..cd92fe7 100644 --- a/apps/desktop/src/routes/extension/ui-iframe/+page.svelte +++ b/apps/desktop/src/routes/extension/ui-iframe/+page.svelte @@ -63,6 +63,7 @@ uiControl.showMoveBtn = false }, hideRefreshButton: async () => { + console.log("hideRefreshButton") uiControl.showRefreshBtn = false }, showBackButton: async (position?: Position) => { @@ -153,7 +154,7 @@ -{#if uiControl.backBtnPosition} +{#if uiControl.backBtnPosition && uiControl.showBackBtn} {/if} -{#if uiControl.refreshBtnPosition} +{#if uiControl.refreshBtnPosition && uiControl.showRefreshBtn}