From 6c769e5ff4035371fcb6311cd4204bf97f2cf5d0 Mon Sep 17 00:00:00 2001 From: Puyodead1 Date: Thu, 21 Dec 2023 18:22:43 -0500 Subject: [PATCH] updater crap --- package.json | 3 +- scripts/tauri-version.js | 23 ++ src-tauri/.gitignore | 2 +- src-tauri/Cargo.lock | 797 ++++++++++++++++++++++++++++++-------- src-tauri/Cargo.toml | 16 +- src-tauri/src/lib.rs | 75 +++- src-tauri/src/updater.rs | 204 ++++++++++ src-tauri/tauri.conf.json | 8 +- 8 files changed, 949 insertions(+), 179 deletions(-) create mode 100644 scripts/tauri-version.js create mode 100644 src-tauri/src/updater.rs diff --git a/package.json b/package.json index 86af4bb1..af4f4af3 100644 --- a/package.json +++ b/package.json @@ -105,7 +105,8 @@ "url": "git+https://github.com/spacebarchat/client.git" }, "scripts": { - "build": "tsc && vite build", + "build": "npm run ci:prebuild && tsc && vite build", + "ci:prebuild": "node scripts/tauri-version.js", "dev": "vite", "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", "lint:fix": "pnpx prettier . --write", diff --git a/scripts/tauri-version.js b/scripts/tauri-version.js new file mode 100644 index 00000000..a0d2b8ff --- /dev/null +++ b/scripts/tauri-version.js @@ -0,0 +1,23 @@ +import fs from "fs"; +import path from "path"; +import process from "process"; + +if (!process.env.CI) { + console.log("Not running in CI, skipping. Please do not run this script manually!"); + process.exit(0); +} + +const GITHUB_RUN_ID = process.env.GITHUB_RUN_ID; +const GITHUB_RUN_ATTEMPT = process.env.GITHUB_RUN_ATTEMPT; +const GITHUB_REF_NAME = process.env.GITHUB_REF_NAME; + +const pkgJsonPath = path.resolve("./package.json"); +const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, "utf8")); +const pkgVersion = pkgJson.version; + +// const tauriJsonPath = path.resolve("./src-tauri/tauri.conf.json"); +const tauriJsonPath = path.resolve("./src-tauri/version.json"); +const tauriJson = { + version: `${pkgVersion}+${GITHUB_RUN_ID}${GITHUB_RUN_ATTEMPT}`, +}; +fs.writeFileSync(tauriJsonPath, JSON.stringify(tauriJson, null, 4)); diff --git a/src-tauri/.gitignore b/src-tauri/.gitignore index f4dfb82b..1cfe7f2f 100644 --- a/src-tauri/.gitignore +++ b/src-tauri/.gitignore @@ -1,4 +1,4 @@ # Generated by Cargo # will have compiled files and executables /target/ - +version.json diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index bbf5150d..254bce30 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -17,6 +17,17 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "aes" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + [[package]] name = "aho-corasick" version = "1.1.2" @@ -47,6 +58,24 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" +[[package]] +name = "android_log-sys" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85965b6739a430150bdd138e2374a98af0c3ee0d030b3bb7fc3bddff58d0102e" + +[[package]] +name = "android_logger" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8619b80c242aa7bd638b5c7ddd952addeecb71f69c75e33f1d47b2804f8f883a" +dependencies = [ + "android_log-sys", + "env_logger", + "log", + "once_cell", +] + [[package]] name = "android_system_properties" version = "0.1.5" @@ -58,18 +87,25 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.75" +version = "1.0.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" +checksum = "59d2a3357dde987206219e78ecfbbb6e8dad06cbb65292758d3270e6254f7355" [[package]] name = "app" -version = "0.1.0" +version = "0.0.0" dependencies = [ + "chrono", + "log", + "reqwest", "serde", "serde_json", "tauri", - "tauri-build 2.0.0-alpha.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tauri-build", + "tauri-plugin-log", + "tauri-plugin-process", + "tauri-plugin-updater", + "url", ] [[package]] @@ -89,7 +125,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ca33f4bc4ed1babef42cad36cc1f51fa88be00420404e5b1e80ab1b18f7678c" dependencies = [ "concurrent-queue", - "event-listener 4.0.0", + "event-listener 4.0.1", "event-listener-strategy", "futures-core", "pin-project-lite", @@ -143,9 +179,9 @@ dependencies = [ [[package]] name = "async-io" -version = "2.2.1" +version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6d3b15875ba253d1110c740755e246537483f152fa334f91abd7fe84c88b3ff" +checksum = "6afaa937395a620e33dc6a742c593c01aced20aa376ffb0f628121198578ccc7" dependencies = [ "async-lock 3.2.0", "cfg-if", @@ -175,7 +211,7 @@ version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7125e42787d53db9dd54261812ef17e937c95a51e4d291373b670342fa44310c" dependencies = [ - "event-listener 4.0.0", + "event-listener 4.0.1", "event-listener-strategy", "pin-project-lite", ] @@ -205,7 +241,7 @@ checksum = "5fd55a5ba1179988837d24ab4c7cc8ed6efdeff578ede0416b4225a5fca35bd0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.42", ] [[package]] @@ -214,7 +250,7 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e47d90f65a225c4527103a8d747001fc56e375203592b25ad103e1ca13124c5" dependencies = [ - "async-io 2.2.1", + "async-io 2.2.2", "async-lock 2.8.0", "atomic-waker", "cfg-if", @@ -228,19 +264,19 @@ dependencies = [ [[package]] name = "async-task" -version = "4.5.0" +version = "4.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4eb2cdb97421e01129ccb49169d8279ed21e829929144f4a22a6e54ac549ca1" +checksum = "e1d90cd0b264dfdd8eb5bad0a2c217c1f88fa96a8573f40e7b12de23fb468f46" [[package]] name = "async-trait" -version = "0.1.74" +version = "0.1.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" +checksum = "fdf6721fb0140e4f897002dd086c06f6c27775df19cfe1fccb21181a48fd2c98" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.42", ] [[package]] @@ -299,6 +335,12 @@ version = "0.21.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" +[[package]] +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + [[package]] name = "bitflags" version = "1.3.2" @@ -372,6 +414,16 @@ version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" +[[package]] +name = "byte-unit" +version = "4.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da78b32057b8fdfc352504708feeba7216dcd65a2c9ab02978cbd288d1279b6c" +dependencies = [ + "serde", + "utf8-width", +] + [[package]] name = "bytemuck" version = "1.14.0" @@ -393,6 +445,27 @@ dependencies = [ "serde", ] +[[package]] +name = "bzip2" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdb116a6ef3f6c3698828873ad02c3014b3c85cadb88496095628e3ef1e347f8" +dependencies = [ + "bzip2-sys", + "libc", +] + +[[package]] +name = "bzip2-sys" +version = "0.1.11+1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc" +dependencies = [ + "cc", + "libc", + "pkg-config", +] + [[package]] name = "cairo-rs" version = "0.18.3" @@ -420,9 +493,9 @@ dependencies = [ [[package]] name = "cargo_toml" -version = "0.17.1" +version = "0.17.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d1ece59890e746567b467253aea0adbe8a21784d0b025d8a306f66c391c2957" +checksum = "8a969e13a7589e9e3e4207e153bae624ade2b5622fb4684a4923b23ec3d57719" dependencies = [ "serde", "toml 0.8.2", @@ -434,6 +507,7 @@ version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" dependencies = [ + "jobserver", "libc", ] @@ -484,11 +558,39 @@ checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" dependencies = [ "android-tzdata", "iana-time-zone", + "js-sys", "num-traits", "serde", + "wasm-bindgen", "windows-targets 0.48.5", ] +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + +[[package]] +name = "cocoa" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f425db7937052c684daec3bd6375c8abe2d146dca4b8b143d6db777c39138f3a" +dependencies = [ + "bitflags 1.3.2", + "block", + "cocoa-foundation", + "core-foundation", + "core-graphics 0.22.3", + "foreign-types 0.3.2", + "libc", + "objc", +] + [[package]] name = "cocoa" version = "0.25.0" @@ -499,8 +601,8 @@ dependencies = [ "block", "cocoa-foundation", "core-foundation", - "core-graphics", - "foreign-types", + "core-graphics 0.23.1", + "foreign-types 0.5.0", "libc", "objc", ] @@ -544,6 +646,12 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "constant_time_eq" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" + [[package]] name = "convert_case" version = "0.4.0" @@ -566,6 +674,19 @@ version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" +[[package]] +name = "core-graphics" +version = "0.22.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "core-graphics-types", + "foreign-types 0.3.2", + "libc", +] + [[package]] name = "core-graphics" version = "0.23.1" @@ -575,7 +696,7 @@ dependencies = [ "bitflags 1.3.2", "core-foundation", "core-graphics-types", - "foreign-types", + "foreign-types 0.5.0", "libc", ] @@ -610,9 +731,9 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.8" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" +checksum = "14c3242926edf34aec4ac3a77108ad4854bffaa2e4ddc1824124ce59231302d5" dependencies = [ "cfg-if", "crossbeam-utils", @@ -620,9 +741,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.16" +version = "0.8.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" +checksum = "c06d96137f14f244c37f989d9fff8f95e6c18b918e71f36638f8c49112e4c78f" dependencies = [ "cfg-if", ] @@ -661,17 +782,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331" dependencies = [ "quote", - "syn 2.0.39", + "syn 2.0.42", ] [[package]] name = "ctor" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37e366bff8cd32dd8754b0991fb66b279dc48f598c3a18914852a6673deef583" +checksum = "30d2b3721e861707777e3195b0158f950ae6dc4a27e4d02ff9f67e3eb3de199e" dependencies = [ "quote", - "syn 2.0.39", + "syn 2.0.42", ] [[package]] @@ -695,7 +816,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.39", + "syn 2.0.42", ] [[package]] @@ -706,7 +827,7 @@ checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" dependencies = [ "darling_core", "quote", - "syn 2.0.39", + "syn 2.0.42", ] [[package]] @@ -751,6 +872,7 @@ checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", "crypto-common", + "subtle", ] [[package]] @@ -847,7 +969,17 @@ checksum = "f95e2801cd355d4a1a3e3953ce6ee5ae9603a5c833455343a8bfe3f44d418246" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.42", +] + +[[package]] +name = "env_logger" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95b3f3e67048839cb0d0781f445682a35113da7121f7c949db0e2be96a4fbece" +dependencies = [ + "log", + "regex", ] [[package]] @@ -885,9 +1017,9 @@ dependencies = [ [[package]] name = "event-listener" -version = "4.0.0" +version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "770d968249b5d99410d61f5bf89057f3199a077a04d087092f58e7d10692baae" +checksum = "84f2cdcf274580f2d63697192d744727b3198894b1bf02923643bf59e2c26712" dependencies = [ "concurrent-queue", "parking", @@ -900,7 +1032,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "958e4d70b6d5e81971bebec42271ec641e7ff4e170a6fa605f2b8a8b65cb97d3" dependencies = [ - "event-listener 4.0.0", + "event-listener 4.0.1", "pin-project-lite", ] @@ -928,6 +1060,15 @@ dependencies = [ "simd-adler32", ] +[[package]] +name = "fern" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9f0c14694cbd524c8720dd69b0e3179344f04ebb5f90f2e4a440c6ea3b2f1ee" +dependencies = [ + "log", +] + [[package]] name = "field-offset" version = "0.3.6" @@ -938,6 +1079,18 @@ dependencies = [ "rustc_version", ] +[[package]] +name = "filetime" +version = "0.2.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ee447700ac8aa0b2f2bd7bc4462ad686ba06baa6727ac149a2d6277f0d240fd" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "windows-sys 0.52.0", +] + [[package]] name = "flate2" version = "1.0.28" @@ -954,6 +1107,15 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared 0.1.1", +] + [[package]] name = "foreign-types" version = "0.5.0" @@ -961,7 +1123,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" dependencies = [ "foreign-types-macros", - "foreign-types-shared", + "foreign-types-shared 0.3.1", ] [[package]] @@ -972,9 +1134,15 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.42", ] +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + [[package]] name = "foreign-types-shared" version = "0.3.1" @@ -1068,7 +1236,7 @@ checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.42", ] [[package]] @@ -1325,7 +1493,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.42", ] [[package]] @@ -1404,7 +1572,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.42", ] [[package]] @@ -1456,6 +1624,15 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "html5ever" version = "0.26.0" @@ -1506,9 +1683,9 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "hyper" -version = "0.14.27" +version = "0.14.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" +checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" dependencies = [ "bytes", "futures-channel", @@ -1521,13 +1698,26 @@ dependencies = [ "httpdate", "itoa 1.0.10", "pin-project-lite", - "socket2 0.4.10", + "socket2 0.5.5", "tokio", "tower-service", "tracing", "want", ] +[[package]] +name = "hyper-tls" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +dependencies = [ + "bytes", + "hyper", + "native-tls", + "tokio", + "tokio-native-tls", +] + [[package]] name = "iana-time-zone" version = "0.1.58" @@ -1621,6 +1811,15 @@ dependencies = [ "cfb", ] +[[package]] +name = "inout" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +dependencies = [ + "generic-array", +] + [[package]] name = "instant" version = "0.1.12" @@ -1704,6 +1903,15 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" +[[package]] +name = "jobserver" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" +dependencies = [ + "libc", +] + [[package]] name = "js-sys" version = "0.3.66" @@ -1781,9 +1989,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.150" +version = "0.2.151" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" +checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" [[package]] name = "libloading" @@ -1842,6 +2050,9 @@ name = "log" version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +dependencies = [ + "value-bag", +] [[package]] name = "loom" @@ -1932,6 +2143,12 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" +[[package]] +name = "minisign-verify" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "933dca44d65cdd53b355d0b73d380a2ff5da71f87f036053188bf1eab6a19881" + [[package]] name = "miniz_oxide" version = "0.7.1" @@ -1959,7 +2176,7 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b564d551449738387fb4541aef5fbfceaa81b2b732f2534c1c7c89dc7d673eaa" dependencies = [ - "cocoa", + "cocoa 0.25.0", "crossbeam-channel", "gtk", "keyboard-types", @@ -1971,6 +2188,24 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "native-tls" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" +dependencies = [ + "lazy_static", + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + [[package]] name = "ndk" version = "0.7.0" @@ -2095,6 +2330,15 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "num_threads" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44" +dependencies = [ + "libc", +] + [[package]] name = "objc" version = "0.2.7" @@ -2138,6 +2382,50 @@ version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +[[package]] +name = "openssl" +version = "0.10.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b8419dc8cc6d866deb801274bba2e6f8f6108c1bb7fcc10ee5ab864931dbb45" +dependencies = [ + "bitflags 2.4.1", + "cfg-if", + "foreign-types 0.3.2", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.42", +] + +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "openssl-sys" +version = "0.9.97" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3eaad34cdd97d81de97964fc7f29e2d104f483840d906ef56daa1912338460b" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + [[package]] name = "ordered-stream" version = "0.2.0" @@ -2208,6 +2496,29 @@ dependencies = [ "windows-targets 0.48.5", ] +[[package]] +name = "password-hash" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7676374caaee8a325c9e7a2ae557f216c5563a171d6997b0ef8a65af35147700" +dependencies = [ + "base64ct", + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "pbkdf2" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" +dependencies = [ + "digest", + "hmac", + "password-hash", + "sha2", +] + [[package]] name = "percent-encoding" version = "2.3.1" @@ -2318,7 +2629,7 @@ dependencies = [ "phf_shared 0.11.2", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.42", ] [[package]] @@ -2373,9 +2684,9 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.27" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" +checksum = "69d3587f8a9e599cc7ec2c00e331f71c4e69a5f9a4b8a6efd5b07466b9736f9a" [[package]] name = "plist" @@ -2504,9 +2815,9 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" [[package]] name = "proc-macro2" -version = "1.0.70" +version = "1.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" +checksum = "75cb1540fadbd5b8fbccc4dddad2734eba435053f725621c070711a14bb5f4b8" dependencies = [ "unicode-ident", ] @@ -2682,9 +2993,9 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "reqwest" -version = "0.11.22" +version = "0.11.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" +checksum = "37b1ae8d9ac08420c66222fb9096fc5de435c3c48542bc5336c51892cffafb41" dependencies = [ "base64", "bytes", @@ -2695,10 +3006,12 @@ dependencies = [ "http", "http-body", "hyper", + "hyper-tls", "ipnet", "js-sys", "log", "mime", + "native-tls", "once_cell", "percent-encoding", "pin-project-lite", @@ -2707,6 +3020,7 @@ dependencies = [ "serde_urlencoded", "system-configuration", "tokio", + "tokio-native-tls", "tokio-util", "tower-service", "url", @@ -2786,6 +3100,15 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "schannel" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" +dependencies = [ + "windows-sys 0.48.0", +] + [[package]] name = "scoped-tls" version = "1.0.1" @@ -2798,6 +3121,29 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "security-framework" +version = "2.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "selectors" version = "0.22.0" @@ -2823,6 +3169,9 @@ name = "semver" version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" +dependencies = [ + "serde", +] [[package]] name = "serde" @@ -2841,7 +3190,7 @@ checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.42", ] [[package]] @@ -2863,14 +3212,14 @@ checksum = "3081f5ffbb02284dda55132aa26daecedd7372a42417bbbab6f14ab7d6bb9145" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.42", ] [[package]] name = "serde_spanned" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12022b835073e5b11e90a14f86838ceb1c8fb0325b72416845c487ac0fa95e80" +checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1" dependencies = [ "serde", ] @@ -2913,7 +3262,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.42", ] [[package]] @@ -3114,6 +3463,12 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +[[package]] +name = "subtle" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" + [[package]] name = "swift-rs" version = "1.0.6" @@ -3138,9 +3493,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.39" +version = "2.0.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" +checksum = "5b7d0a2c048d661a1a59fcd7355baa232f7ed34e0ee4df2eef3c1c1c0d3852d8" dependencies = [ "proc-macro2", "quote", @@ -3189,9 +3544,9 @@ checksum = "3c0dff18fed076d29cb5779e918ef4b8a5dbb756204e4a027794f0bce233d949" dependencies = [ "bitflags 1.3.2", "cc", - "cocoa", + "cocoa 0.25.0", "core-foundation", - "core-graphics", + "core-graphics 0.23.1", "crossbeam-channel", "dispatch", "gdkwayland-sys", @@ -3233,6 +3588,17 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "tar" +version = "0.4.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b16afcea1f22891c49a00c751c7b63b2233284064f11a200fc624137c51e2ddb" +dependencies = [ + "filetime", + "libc", + "xattr", +] + [[package]] name = "target-lexicon" version = "0.12.12" @@ -3241,12 +3607,13 @@ checksum = "14c39fd04924ca3a864207c66fc2cd7d22d7c016007f9ce846cbb9326331930a" [[package]] name = "tauri" -version = "2.0.0-alpha.18" -source = "git+https://github.com/tauri-apps/tauri.git?branch=dev#940ec1dd01bb760d0716c5547e812353610c85cf" +version = "2.0.0-alpha.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05fb63873c39d3fd5ddad995d395e7b7394ece0b69aeacb31e91d24af48f3de1" dependencies = [ "anyhow", "bytes", - "cocoa", + "cocoa 0.25.0", "dirs-next", "embed_plist", "futures-util", @@ -3270,11 +3637,11 @@ dependencies = [ "serialize-to-javascript", "state", "swift-rs", - "tauri-build 2.0.0-alpha.12 (git+https://github.com/tauri-apps/tauri.git?branch=dev)", + "tauri-build", "tauri-macros", "tauri-runtime", "tauri-runtime-wry", - "tauri-utils 2.0.0-alpha.11 (git+https://github.com/tauri-apps/tauri.git?branch=dev)", + "tauri-utils", "thiserror", "tokio", "tray-icon", @@ -3287,29 +3654,9 @@ dependencies = [ [[package]] name = "tauri-build" -version = "2.0.0-alpha.12" +version = "2.0.0-alpha.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0997a36aa2a1431500ef6ef92e7076521ae3258a8f73914b49ba876361ba2fe" -dependencies = [ - "anyhow", - "cargo_toml", - "dirs-next", - "heck", - "json-patch", - "plist", - "semver", - "serde", - "serde_json", - "swift-rs", - "tauri-utils 2.0.0-alpha.11 (registry+https://github.com/rust-lang/crates.io-index)", - "tauri-winres", - "walkdir", -] - -[[package]] -name = "tauri-build" -version = "2.0.0-alpha.12" -source = "git+https://github.com/tauri-apps/tauri.git?branch=dev#940ec1dd01bb760d0716c5547e812353610c85cf" +checksum = "a7a2582ffb43e5c28932c43ffc40c295a9196a9a33ffb1163269c6baed84834a" dependencies = [ "anyhow", "cargo_toml", @@ -3321,15 +3668,16 @@ dependencies = [ "serde", "serde_json", "swift-rs", - "tauri-utils 2.0.0-alpha.11 (git+https://github.com/tauri-apps/tauri.git?branch=dev)", + "tauri-utils", "tauri-winres", "walkdir", ] [[package]] name = "tauri-codegen" -version = "2.0.0-alpha.11" -source = "git+https://github.com/tauri-apps/tauri.git?branch=dev#940ec1dd01bb760d0716c5547e812353610c85cf" +version = "2.0.0-alpha.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b06976ec7b704d6b842169ffd4ce596e9ce45917a0ab462cb96a119fa2829be9" dependencies = [ "base64", "brotli", @@ -3343,7 +3691,7 @@ dependencies = [ "serde", "serde_json", "sha2", - "tauri-utils 2.0.0-alpha.11 (git+https://github.com/tauri-apps/tauri.git?branch=dev)", + "tauri-utils", "thiserror", "time", "url", @@ -3353,21 +3701,80 @@ dependencies = [ [[package]] name = "tauri-macros" -version = "2.0.0-alpha.11" -source = "git+https://github.com/tauri-apps/tauri.git?branch=dev#940ec1dd01bb760d0716c5547e812353610c85cf" +version = "2.0.0-alpha.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff509be5a5ac34ec2e60d9029af1032c0a33e421f3e823bc92695192e2871c17" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.42", "tauri-codegen", - "tauri-utils 2.0.0-alpha.11 (git+https://github.com/tauri-apps/tauri.git?branch=dev)", + "tauri-utils", +] + +[[package]] +name = "tauri-plugin-log" +version = "2.0.0-alpha.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "344ddab2bf314fff6132070c59a4d39065e5f98b6832448ef05e14cd62fcdc6a" +dependencies = [ + "android_logger", + "byte-unit", + "cocoa 0.24.1", + "fern", + "log", + "objc", + "serde", + "serde_json", + "serde_repr", + "swift-rs", + "tauri", + "tauri-build", + "time", +] + +[[package]] +name = "tauri-plugin-process" +version = "2.0.0-alpha.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b55c149c1027bc3de752d51ca9227cfa2ce592a4934735f70c6050360e0b60b3" +dependencies = [ + "tauri", +] + +[[package]] +name = "tauri-plugin-updater" +version = "2.0.0-alpha.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0473197ceb5b436f8b5be139875c54b59fee756f8c15415ef374495de13747c1" +dependencies = [ + "base64", + "dirs-next", + "flate2", + "futures-util", + "http", + "minisign-verify", + "percent-encoding", + "reqwest", + "semver", + "serde", + "serde_json", + "tar", + "tauri", + "tempfile", + "thiserror", + "time", + "tokio", + "url", + "zip", ] [[package]] name = "tauri-runtime" -version = "1.0.0-alpha.5" -source = "git+https://github.com/tauri-apps/tauri.git?branch=dev#940ec1dd01bb760d0716c5547e812353610c85cf" +version = "1.0.0-alpha.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64a989e58af6e554dbac798a0a8d112faafc1509bcfab626466181e0724f09c5" dependencies = [ "gtk", "http", @@ -3375,7 +3782,7 @@ dependencies = [ "raw-window-handle", "serde", "serde_json", - "tauri-utils 2.0.0-alpha.11 (git+https://github.com/tauri-apps/tauri.git?branch=dev)", + "tauri-utils", "thiserror", "url", "windows 0.52.0", @@ -3383,10 +3790,11 @@ dependencies = [ [[package]] name = "tauri-runtime-wry" -version = "1.0.0-alpha.6" -source = "git+https://github.com/tauri-apps/tauri.git?branch=dev#940ec1dd01bb760d0716c5547e812353610c85cf" +version = "1.0.0-alpha.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a9f181a6f5f982204ae293c19f37ba90116b8ec0bfd0a08c7a7ba67200cd9e3" dependencies = [ - "cocoa", + "cocoa 0.25.0", "gtk", "http", "jni", @@ -3394,7 +3802,7 @@ dependencies = [ "raw-window-handle", "tao", "tauri-runtime", - "tauri-utils 2.0.0-alpha.11 (git+https://github.com/tauri-apps/tauri.git?branch=dev)", + "tauri-utils", "webkit2gtk", "webview2-com", "windows 0.52.0", @@ -3403,37 +3811,9 @@ dependencies = [ [[package]] name = "tauri-utils" -version = "2.0.0-alpha.11" +version = "2.0.0-alpha.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce0dbf67341adad8d48255d605b45b25bf1c7445116355e61ed6219d204e94e0" -dependencies = [ - "ctor", - "dunce", - "glob", - "heck", - "html5ever", - "infer", - "json-patch", - "kuchikiki", - "log", - "memchr", - "phf 0.11.2", - "proc-macro2", - "quote", - "semver", - "serde", - "serde_json", - "serde_with", - "thiserror", - "url", - "walkdir", - "windows-version", -] - -[[package]] -name = "tauri-utils" -version = "2.0.0-alpha.11" -source = "git+https://github.com/tauri-apps/tauri.git?branch=dev#940ec1dd01bb760d0716c5547e812353610c85cf" +checksum = "f4858f99fc9f28b72008ef51d04d18b7e3646845c2bc18ee340045fed6ed5095" dependencies = [ "brotli", "ctor", @@ -3500,22 +3880,22 @@ checksum = "8eaa81235c7058867fa8c0e7314f33dcce9c215f535d1913822a2b3f5e289f3c" [[package]] name = "thiserror" -version = "1.0.50" +version = "1.0.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" +checksum = "f11c217e1416d6f036b870f14e0413d480dbf28edbee1f877abaf0206af43bb7" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.50" +version = "1.0.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" +checksum = "01742297787513b79cf8e29d1056ede1313e2420b7b3b15d0a768b4921f549df" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.42", ] [[package]] @@ -3530,12 +3910,14 @@ dependencies = [ [[package]] name = "time" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" +checksum = "f657ba42c3f86e7680e53c8cd3af8abbe56b5491790b46e22e19c0d57463583e" dependencies = [ "deranged", "itoa 1.0.10", + "libc", + "num_threads", "powerfmt", "serde", "time-core", @@ -3550,9 +3932,9 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" +checksum = "26197e33420244aeb70c3e8c78376ca46571bc4e701e4791c2cd9f57dcb3a43f" dependencies = [ "time-core", ] @@ -3574,9 +3956,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.35.0" +version = "1.35.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "841d45b238a16291a4e1584e61820b8ae57d696cc5015c459c229ccc6990cc1c" +checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104" dependencies = [ "backtrace", "bytes", @@ -3588,6 +3970,16 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + [[package]] name = "tokio-util" version = "0.7.10" @@ -3686,7 +4078,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.42", ] [[package]] @@ -3730,12 +4122,12 @@ dependencies = [ [[package]] name = "tray-icon" -version = "0.11.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5375d350db4ccd3c783a4c683be535e70df5c62b07a824e7bcd6d43ef6d74181" +checksum = "fad962d06d2bfd9b2ab4f665fc73b175523b834b1466a294520201c5845145f8" dependencies = [ - "cocoa", - "core-graphics", + "cocoa 0.25.0", + "core-graphics 0.23.1", "crossbeam-channel", "dirs-next", "libappindicator", @@ -3771,10 +4163,11 @@ checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "uds_windows" -version = "1.0.2" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce65604324d3cce9b966701489fbd0cf318cb1f7bd9dd07ac9a4ee6fb791930d" +checksum = "89daebc3e6fd160ac4aa9fc8b3bf71e1f74fbf92367ae71fb83a037e8bf164b9" dependencies = [ + "memoffset 0.9.0", "tempfile", "winapi", ] @@ -3824,6 +4217,12 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" +[[package]] +name = "utf8-width" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86bd8d4e895da8537e5315b8254664e6b769c4ff3db18321b297a1e7004392e3" + [[package]] name = "uuid" version = "1.6.1" @@ -3839,6 +4238,18 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" +[[package]] +name = "value-bag" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a72e1902dde2bd6441347de2b70b7f5d59bf157c6c62f0c44572607a1d55bbe" + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + [[package]] name = "version-compare" version = "0.1.1" @@ -3929,7 +4340,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.42", "wasm-bindgen-shared", ] @@ -3963,7 +4374,7 @@ checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.42", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -4063,7 +4474,7 @@ checksum = "ac1345798ecd8122468840bcdf1b95e5dc6d2206c5e4b0eafa078d061f59c9bc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.42", ] [[package]] @@ -4114,7 +4525,7 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af6abc2b9c56bd95887825a1ce56cde49a2a97c07e28db465d541f5098a2656c" dependencies = [ - "cocoa", + "cocoa 0.25.0", "objc", "raw-window-handle", "windows-sys 0.52.0", @@ -4168,7 +4579,7 @@ checksum = "12168c33176773b86799be25e2a2ba07c7aab9968b37541f1094dbd7a60c8946" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.42", ] [[package]] @@ -4179,7 +4590,7 @@ checksum = "9d8dc32e0095a7eeccebd0e3f09e9509365ecb3fc6ac4d6f5f14a3f6392942d1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.42", ] [[package]] @@ -4391,9 +4802,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winnow" -version = "0.5.26" +version = "0.5.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67b5f0a4e7a27a64c651977932b9dc5667ca7fc31ac44b03ed37a0cf42fdfff" +checksum = "9b5c3db89721d50d0e2a673f5043fc4722f76dcc352d7b1ab8b8288bed4ed2c5" dependencies = [ "memchr", ] @@ -4420,15 +4831,15 @@ dependencies = [ [[package]] name = "wry" -version = "0.35.0" +version = "0.35.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "764ce8212721205a90c79f5fa04f5135af597bea9072f22a5e7f39dcd0669f2e" +checksum = "a2ad1bc1d6925e0cde1bd01830b0073cd0448e21357e843b9ede33b6d81c7423" dependencies = [ "base64", "block", "cfg_aliases", - "cocoa", - "core-graphics", + "cocoa 0.25.0", + "core-graphics 0.23.1", "crossbeam-channel", "dunce", "gdkx11", @@ -4484,6 +4895,17 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "xattr" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7dae5072fe1f8db8f8d29059189ac175196e410e40ba42d5d4684ae2f750995" +dependencies = [ + "libc", + "linux-raw-sys 0.4.12", + "rustix 0.38.28", +] + [[package]] name = "xdg-home" version = "1.0.0" @@ -4560,6 +4982,55 @@ dependencies = [ "zvariant", ] +[[package]] +name = "zip" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261" +dependencies = [ + "aes", + "byteorder", + "bzip2", + "constant_time_eq", + "crc32fast", + "crossbeam-utils", + "flate2", + "hmac", + "pbkdf2", + "sha1", + "time", + "zstd", +] + +[[package]] +name = "zstd" +version = "0.11.2+zstd.1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" +dependencies = [ + "zstd-safe", +] + +[[package]] +name = "zstd-safe" +version = "5.0.2+zstd.1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db" +dependencies = [ + "libc", + "zstd-sys", +] + +[[package]] +name = "zstd-sys" +version = "2.0.9+zstd.1.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e16efa8a874a0481a574084d34cc26fdb3b99627480f785888deb6386506656" +dependencies = [ + "cc", + "pkg-config", +] + [[package]] name = "zvariant" version = "3.15.0" diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 3b9c9701..09a211c9 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "app" -version = "0.1.0" +version = "0.0.0" description = "Spacebar Client" authors = ["Puyodead1"] license = "AGPL-3.0-only" @@ -17,14 +17,18 @@ crate-type = ["staticlib", "cdylib", "rlib"] tauri-build = { version = "2.0.0-alpha", features = [] } [dependencies] -# tauri = { version = "2.0.0-alpha", features = [] } -tauri = { git = "https://github.com/tauri-apps/tauri.git", branch = "dev", features = [ - "devtools", - "tray-icon", -] } +tauri = { version = "2.0.0-alpha", features = ["devtools", "tray-icon"] } +tauri-plugin-updater = "2.0.0-alpha" +tauri-plugin-process = "2.0.0-alpha" +tauri-plugin-log = "2.0.0-alpha" +reqwest = { version = "0.11.22", features = ["json"] } +url = "2.4.1" +chrono = "0.4" +log = "0.4.20" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" + [features] # this feature is used for production builds or when `devPath` points to the filesystem # DO NOT REMOVE!! diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 873bdac2..837d4091 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -1,6 +1,11 @@ +use tauri::RunEvent; #[cfg(desktop)] -use tauri::Manager; +use tauri::{AppHandle, Env, Manager}; +use tauri_plugin_log::{Target, TargetKind, WEBVIEW_TARGET}; + +#[macro_use] mod tray; +mod updater; #[tauri::command] async fn close_splashscreen(window: tauri::Window) { @@ -21,14 +26,58 @@ pub fn run() { std::env::set_var("RUST_BACKTRACE", "1"); std::env::set_var("RUST_LOG", "debug"); - tauri::Builder::default() + let mut context = tauri::generate_context!(); + + let config = context.config_mut(); + + let mut app = tauri::Builder::default() + .plugin(tauri_plugin_process::init()) + // Add logging plugin + .plugin( + tauri_plugin_log::Builder::default() + .clear_targets() + .targets([ + Target::new(TargetKind::Webview), + Target::new(TargetKind::LogDir { + file_name: Some("webview.log".into()), + }) + .filter(|metadata| metadata.target() == WEBVIEW_TARGET), + Target::new(TargetKind::LogDir { + file_name: Some("rust.log".into()), + }) + .filter(|metadata| metadata.target() != WEBVIEW_TARGET), + ]) + .format(move |out, message, record| { + out.finish(format_args!( + "{} [{}] {}", + chrono::Local::now().format("%Y-%m-%d %H:%M:%S"), + record.level(), + message + )); + }) + .level(log::LevelFilter::Info) + .build(), + ); + + if config.tauri.bundle.updater.active { + app = app.plugin(tauri_plugin_updater::Builder::new().build()); + } + + let app = app .setup(move |app| { #[cfg(desktop)] { + // Tray let handle = app.handle(); tray::create_tray(handle)?; } + // Open the dev tools automatically when debugging the application + #[cfg(debug_assertions)] + if let Some(main_window) = app.get_window("main") { + main_window.open_devtools(); + }; + Ok(()) }) .on_window_event(|event| match event.event() { @@ -38,7 +87,25 @@ pub fn run() { } _ => {} }) - .invoke_handler(tauri::generate_handler![close_splashscreen,]) - .run(tauri::generate_context!()) + .invoke_handler(tauri::generate_handler![ + close_splashscreen, + updater::check_for_updates, + updater::install_update + ]) + .build(context) .expect("error while running tauri application"); + + #[cfg(desktop)] + app.run(|app_handle, e| match e { + RunEvent::Ready => { + #[cfg(any(target_os = "macos", debug_assertions))] + let window = app_handle.get_window("main").unwrap(); + + #[cfg(debug_assertions)] + window.open_devtools(); + + println!("App is ready"); + } + _ => {} + }); } diff --git a/src-tauri/src/updater.rs b/src-tauri/src/updater.rs new file mode 100644 index 00000000..a22cced7 --- /dev/null +++ b/src-tauri/src/updater.rs @@ -0,0 +1,204 @@ +use serde::{Deserialize, Serialize}; +use std::sync::Mutex; +use tauri::{Manager, Runtime}; +use tauri_plugin_updater::{Update, UpdaterExt}; +use url::Url; + +static UPDATE_INFO: Mutex> = Mutex::new(None); + +#[derive(Deserialize, Debug)] +struct Release { + assets: Vec, + prerelease: bool, +} + +#[derive(Deserialize, Debug)] +struct Asset { + name: String, + browser_download_url: String, +} + +#[derive(Serialize, Debug, Clone)] +struct UpdateAvailable { + version: String, + body: Option, +} + +// ignore_version: String +#[tauri::command] +pub fn check_for_updates(ignore_prereleases: bool, window: tauri::Window) { + let handle = window.app_handle().clone(); + + if !handle.config().tauri.bundle.updater.active { + return; + } + + println!("Current version: {}", handle.package_info().version); + + tauri::async_runtime::spawn(async move { + println!("Searching for update file on github."); + // Custom configure the updater. + let github_releases_endpoint = "https://api.github.com/repos/spacebarchat/client/releases"; + let github_releases_endpoint = match Url::parse(github_releases_endpoint) { + Ok(url) => url, + Err(e) => { + println!("Failed to parse url: {:?}. Failed to check for updates", e); + return; + } + }; + let client = reqwest::Client::new(); + let req = client + .get(github_releases_endpoint.clone()) + .header("Content-Type", "application/json") + // If this is not set you will get a 403 forbidden error. + .header("User-Agent", "spacebar-client"); + let response = match req.send().await { + Ok(response) => response, + Err(e) => { + println!( + "Failed to send request: {:?}. Failed to check for updates", + e + ); + return; + } + }; + + if response.status() != reqwest::StatusCode::OK { + println!( + "Non OK status code: {:?}. Failed to check for updates", + response.status() + ); + return; + } + let releases = match response.json::>().await { + Ok(releases) => releases, + Err(e) => { + println!( + "Failed to parse response: {:?}. Failed to check for updates", + e + ); + return; + } + }; + + // check if there are any releases + if releases.len() == 0 { + println!("No releases found. Failed to check for updates"); + return; + } + + // if ignore_prereleases is true, find first release that is not a prerelease, otherwise get the first release + let latest_release = if ignore_prereleases { + releases.iter().find(|release| !release.prerelease).unwrap() + } else { + releases.get(0).unwrap() + }; + + // Find an asset named "latest.json". + let tauri_release_asset = latest_release + .assets + .iter() + .find(|asset| asset.name == "latest.json"); + + // If we found the asset, set it as the updater endpoint. + let tauri_release_asset = match tauri_release_asset { + Some(tauri_release_asset) => tauri_release_asset, + None => { + println!("Failed to find latest.json asset. Failed to check for updates\n\nFound Assets are:"); + // Print a list of the assets found + for asset in latest_release.assets.iter() { + println!(" {:?}", asset.name); + } + return; + } + }; + + let tauri_release_endpoint = match Url::parse(&tauri_release_asset.browser_download_url) { + Ok(url) => url, + Err(e) => { + println!("Failed to parse url: {:?}. Failed to check for updates", e); + return; + } + }; + let updater_builder = match handle + .updater_builder() + .version_comparator(|current_version, latest_version| { + println!("Current version: {}", current_version); + println!("Latest version: {}", latest_version.version.clone()); + false + }) + .endpoints(vec![tauri_release_endpoint]) + .header("User-Agent", "spacebar-client") + { + Ok(updater_builder) => updater_builder, + Err(e) => { + println!( + "Failed to build updater builder: {:?}. Failed to check for updates", + e + ); + return; + } + }; + + let updater = match updater_builder.build() { + Ok(updater) => updater, + Err(e) => { + println!( + "Failed to build updater: {:?}. Failed to check for updates", + e + ); + return; + } + }; + + println!("Checking for updates"); + + let response = updater.check().await; + + println!("Update check response: {:?}", response); + + match response { + Ok(Some(update)) => { + // if ignore_version == update.version { + // println!("Ignoring update as user has asked to ignore this version."); + // return; + // } + UPDATE_INFO.lock().unwrap().replace(update.clone()); + + match window.emit( + "UPDATE_AVAILABLE", + Some(UpdateAvailable { + version: update.version, + body: update.body, + }), + ) { + Ok(_) => {} + Err(e) => { + println!("Failed to emit update available event: {:?}", e); + } + } + } + _ => {} + } + }); +} + +#[tauri::command] +pub async fn install_update(_window: tauri::Window) { + println!("Downloading and installing update!"); + + let update = match UPDATE_INFO.lock().unwrap().clone() { + Some(update) => update, + None => { + println!("No update found to install"); + return; + } + }; + + let install_response = update.download_and_install(|_, _| {}, || {}).await; + if let Err(e) = install_response { + println!("Failed to install update: {:?}", e); + } else { + println!("Update installed"); + } +} diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 9c61be26..a4575a08 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -4,16 +4,16 @@ "beforeBuildCommand": "pnpm run build", "devPath": "http://localhost:1420", "distDir": "../build", - "withGlobalTauri": false + "withGlobalTauri": true }, "package": { "productName": "Spacebar", - "version": "../package.json" + "version": "./version.json" }, "tauri": { "bundle": { "active": true, - "targets": "all", + "targets": ["app", "appimage", "deb", "dmg", "nsis", "updater"], "identifier": "chat.spacebar.app", "icon": [ "icons/32x32.png", @@ -50,7 +50,7 @@ "open": true }, "updater": { - "endpoints": ["https://api.old.server.spacebar.chat/api/updates?platform={{target}}&arch={{arch}}"] + "endpoints": ["https://github.com/spacebarchat/client/releases/download/latest/latest.json"] } } }