From 6d4c6f043be4a6f042084384d4f9503af04eb78d Mon Sep 17 00:00:00 2001 From: ForgQi <34411314+ForgQi@users.noreply.github.com> Date: Sun, 29 May 2022 22:08:46 +0800 Subject: [PATCH] fix: #26 #27 --- src-tauri/Cargo.lock | 389 ++++++++++++++++---------------------- src-tauri/Cargo.toml | 6 +- src-tauri/src/lib.rs | 38 ++-- src-tauri/src/main.rs | 65 +++---- src-tauri/tauri.conf.json | 2 +- src/App.svelte | 9 +- src/Login.svelte | 8 +- src/Sidebar.svelte | 31 ++- src/Upload.svelte | 38 ++-- src/store.ts | 14 ++ 10 files changed, 271 insertions(+), 329 deletions(-) diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 5451d2d..3b3e863 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -170,9 +170,9 @@ checksum = "e6b4d9b1225d28d360ec6a231d65af1fd99a2a095154c8040689617290569c5c" [[package]] name = "biliup" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4df872a826a35e5faca334241eaa7f13dfaae04722aeaa63a5e0867bdb3bd026" +checksum = "54417ad41441d0f1d25235cac196681ec8d62b24f8ba4e36b7562076723785cc" dependencies = [ "anyhow", "base64", @@ -183,7 +183,6 @@ dependencies = [ "dialoguer", "futures", "glob", - "hex-literal", "image", "indicatif", "md-5", @@ -199,7 +198,6 @@ dependencies = [ "serde_urlencoded", "serde_yaml", "thiserror", - "time 0.3.9", "tokio", "typed-builder", "url", @@ -409,7 +407,7 @@ dependencies = [ "clap_lex", "indexmap", "lazy_static", - "strsim 0.10.0", + "strsim", "termcolor", "textwrap", ] @@ -711,38 +709,14 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35" -[[package]] -name = "darling" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d706e75d87e35569db781a9b5e2416cff1236a47ed380831f959382ccd5f858" -dependencies = [ - "darling_core 0.10.2", - "darling_macro 0.10.2", -] - [[package]] name = "darling" version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" dependencies = [ - "darling_core 0.13.4", - "darling_macro 0.13.4", -] - -[[package]] -name = "darling_core" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0c960ae2da4de88a91b2d920c2a7233b400bc33cb28453a2987822d8392519b" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim 0.9.3", - "syn", + "darling_core", + "darling_macro", ] [[package]] @@ -755,18 +729,7 @@ dependencies = [ "ident_case", "proc-macro2", "quote", - "strsim 0.10.0", - "syn", -] - -[[package]] -name = "darling_macro" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72" -dependencies = [ - "darling_core 0.10.2", - "quote", + "strsim", "syn", ] @@ -776,7 +739,7 @@ version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" dependencies = [ - "darling_core 0.13.4", + "darling_core", "quote", "syn", ] @@ -983,13 +946,11 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.23" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b39522e96686d38f4bc984b9198e3a0613264abaebaff2c5c918bfa6b6da09af" +checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6" dependencies = [ - "cfg-if", "crc32fast", - "libc", "miniz_oxide 0.5.1", ] @@ -1332,7 +1293,7 @@ checksum = "25a68131a662b04931e71891fb14aaf65ee4b44d08e8abc10f49e77418c86c64" dependencies = [ "anyhow", "heck 0.4.0", - "proc-macro-crate 1.1.3", + "proc-macro-crate", "proc-macro-error", "proc-macro2", "quote", @@ -1427,7 +1388,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24f518afe90c23fba585b2d7697856f9e6a7bbc62f65588035e66f6afb01a2e9" dependencies = [ "anyhow", - "proc-macro-crate 1.1.3", + "proc-macro-crate", "proc-macro-error", "proc-macro2", "quote", @@ -1483,12 +1444,6 @@ dependencies = [ "libc", ] -[[package]] -name = "hex-literal" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" - [[package]] name = "html5ever" version = "0.25.2" @@ -1545,9 +1500,9 @@ checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" [[package]] name = "hyper" -version = "0.14.18" +version = "0.14.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b26ae0a80afebe130861d90abf98e3814a4f28a4c6ffeb5ab8ebb2be311e0ef2" +checksum = "42dc3c131584288d375f2d07f822b0cb012d8c6fb899a5b9fdb3cb7eb9b6004f" dependencies = [ "bytes", "futures-channel", @@ -1659,9 +1614,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.8.1" +version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f647032dfaa1f8b6dc29bd3edb7bbef4861b8b8007ebb118d6db284fd59f6ee" +checksum = "e6012d540c5baa3589337a98ce73408de9b5a25ec9fc2c6fd6be8f0d39e0ca5a" dependencies = [ "autocfg 1.1.0", "hashbrown", @@ -1669,9 +1624,9 @@ dependencies = [ [[package]] name = "indicatif" -version = "0.17.0-rc.10" +version = "0.17.0-rc.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "088977cb4de4e09ea0232bd51c844490475ad94344fb0c60784f1fb380059b6d" +checksum = "4017d0ce94b8e91e29d2c78ed891e57e5ec3dc4371820a9d96abab4af09eb8ad" dependencies = [ "console", "number_prefix", @@ -1760,6 +1715,20 @@ dependencies = [ "walkdir", ] +[[package]] +name = "jni" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6df18c2e3db7e453d3c6ac5b3e9d5182664d28788126d39b91f2d1e22b017ec" +dependencies = [ + "cesu8", + "combine", + "jni-sys", + "log", + "thiserror", + "walkdir", +] + [[package]] name = "jni-sys" version = "0.3.0" @@ -2036,9 +2005,9 @@ dependencies = [ [[package]] name = "ndk" -version = "0.4.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d64d6af06fde0e527b1ba5c7b79a6cc89cfc46325b0b2887dffe8f70197e0c3c" +checksum = "2032c77e030ddee34a6787a64166008da93f6a352b629261d0fee232b8742dd4" dependencies = [ "bitflags", "jni-sys", @@ -2054,39 +2023,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" [[package]] -name = "ndk-glue" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3648f3609716eb7dbf5f5b5d4b84fcd67dd4c34efcdb12e4a6c0929c2ac48349" -dependencies = [ - "lazy_static", - "libc", - "log", - "ndk", - "ndk-context", - "ndk-macro", - "ndk-sys", -] - -[[package]] -name = "ndk-macro" -version = "0.2.0" +name = "ndk-sys" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05d1c6307dc424d0f65b9b06e94f88248e6305726b14729fd67a5e47b2dc481d" +checksum = "6e5a6ae77c8ee183dcbbba6150e2e6b9f3f4196a7666c02a715a95692ec1fa97" dependencies = [ - "darling 0.10.2", - "proc-macro-crate 0.1.5", - "proc-macro2", - "quote", - "syn", + "jni-sys", ] -[[package]] -name = "ndk-sys" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1bcdd74c20ad5d95aacd60ef9ba40fdf77f767051040541df557b7a9b2a2121" - [[package]] name = "new_debug_unreachable" version = "1.0.4" @@ -2195,7 +2139,7 @@ version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b0498641e53dd6ac1a4f22547548caa6864cc4933784319cd1775271c5a46ce" dependencies = [ - "proc-macro-crate 1.1.3", + "proc-macro-crate", "proc-macro2", "quote", "syn", @@ -2257,9 +2201,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.11.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b10983b38c53aebdf33f542c6275b0f58a238129d00c4ae0e6fb59738d783ca" +checksum = "7709cef83f0c1f58f666e746a08b21e0085f7440fa6a29cc194d68aac97a4225" [[package]] name = "opaque-debug" @@ -2324,9 +2268,9 @@ dependencies = [ [[package]] name = "os_info" -version = "3.3.0" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04304d855bb5385d4b595edf0147b8e281871766b75dd4c87b2bdf3c9e5c2d19" +checksum = "0eca3ecae1481e12c3d9379ec541b238a16f0b75c9a409942daa8ec20dbfdb62" dependencies = [ "log", "serde", @@ -2345,9 +2289,9 @@ dependencies = [ [[package]] name = "os_str_bytes" -version = "6.0.1" +version = "6.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "029d8d0b2f198229de29dca79676f2738ff952edf3fde542eb8bf94d8c21b435" +checksum = "21326818e99cfe6ce1e524c2a805c189a99b5ae555a35d19f9a284b427d86afa" [[package]] name = "pango" @@ -2428,6 +2372,12 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "paste" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c520e05135d6e763148b6426a837e239041653ba7becd2e538c076c738025fc" + [[package]] name = "pathdiff" version = "0.2.1" @@ -2646,15 +2596,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" -[[package]] -name = "proc-macro-crate" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" -dependencies = [ - "toml", -] - [[package]] name = "proc-macro-crate" version = "1.1.3" @@ -3248,6 +3189,9 @@ name = "semver" version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8cb243bdfdb5936c8dc3c45762a19d12ab4550cdc753bc247637d4ec35a040fd" +dependencies = [ + "serde", +] [[package]] name = "semver-parser" @@ -3335,7 +3279,7 @@ version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e182d6ec6f05393cc0e5ed1bf81ad6db3a8feedf8ee515ecdd369809bcce8082" dependencies = [ - "darling 0.13.4", + "darling", "proc-macro2", "quote", "syn", @@ -3609,12 +3553,6 @@ dependencies = [ "quote", ] -[[package]] -name = "strsim" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c" - [[package]] name = "strsim" version = "0.10.0" @@ -3699,9 +3637,9 @@ dependencies = [ [[package]] name = "tao" -version = "0.8.5" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df895eb66ff23d1824055114d6fbdd2c297bf70ad85349a4adaee0f8b2a860d1" +checksum = "53da5dd98a3c605a3ca8fe967d7c50eba8a36072ff13e04e24402b2c492ac55a" dependencies = [ "bitflags", "cairo-rs", @@ -3720,21 +3658,24 @@ dependencies = [ "glib-sys", "gtk", "instant", + "jni 0.19.0", "lazy_static", "libc", "log", "ndk", - "ndk-glue", + "ndk-context", "ndk-sys", "objc", + "once_cell", "parking_lot 0.11.2", + "paste", "raw-window-handle", "scopeguard", "serde", "tao-core-video-sys", "unicode-segmentation", - "windows 0.30.0", - "windows_macros", + "windows 0.37.0", + "windows-implement", "x11-dl", ] @@ -3772,9 +3713,9 @@ dependencies = [ [[package]] name = "tauri" -version = "1.0.0-rc.11" +version = "1.0.0-rc.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c7350af2191f3b7a288cadd672a01fc47c8c3610f990fc5e9b78b9953e2e82" +checksum = "81af088a87f908dab3a268f92e3c331e911bed6b1756bbfaeadedfe9dd40fe4f" dependencies = [ "anyhow", "attohttpc", @@ -3818,20 +3759,21 @@ dependencies = [ "thiserror", "tokio", "url", - "uuid 1.0.0", + "uuid 1.1.0", "webkit2gtk", "webview2-com", - "windows 0.30.0", + "windows 0.37.0", ] [[package]] name = "tauri-build" -version = "1.0.0-rc.9" +version = "1.0.0-rc.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae2a4dfb8e5d8a5a4325fda01e9ddf327db23115dce0f54a4a3f9e8f74341f28" +checksum = "9bbf472a3caf7ec80358996056fe56f0ff3f91f71bc42e96efdbdc3c2618511a" dependencies = [ "anyhow", "cargo_toml", + "heck 0.4.0", "semver 1.0.9", "serde_json", "tauri-utils", @@ -3840,9 +3782,9 @@ dependencies = [ [[package]] name = "tauri-codegen" -version = "1.0.0-rc.7" +version = "1.0.0-rc.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7f042dc907b65468e33495b9d48982dec21216f5b7e9281eb10214aa028a0f" +checksum = "0ae4ebcd190eb22fcee58b40b77d32f5b372a20440833bf27ae7921db131ecca" dependencies = [ "base64", "brotli", @@ -3851,20 +3793,21 @@ dependencies = [ "proc-macro2", "quote", "regex", + "semver 1.0.9", "serde", "serde_json", "sha2", "tauri-utils", "thiserror", - "uuid 1.0.0", + "uuid 1.1.0", "walkdir", ] [[package]] name = "tauri-macros" -version = "1.0.0-rc.7" +version = "1.0.0-rc.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd358b30472a20c70d861b579960da1aee95232e833f72628d5f8dacf9cb2bcc" +checksum = "cc72220c1e52ecb33b4d9f04ff171009f100d28789c18049e19e374ec0355531" dependencies = [ "heck 0.4.0", "proc-macro2", @@ -3876,9 +3819,9 @@ dependencies = [ [[package]] name = "tauri-runtime" -version = "0.5.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffba4a1d7e3a5770253c7dff2dd16553ae7f04c0505ac728447083c2e9bf2d09" +checksum = "dc343e974f76c0f5471da85f87510bb54dfc9a7664f3e649af58f49887965e43" dependencies = [ "gtk", "http", @@ -3888,16 +3831,16 @@ dependencies = [ "serde_json", "tauri-utils", "thiserror", - "uuid 1.0.0", + "uuid 1.1.0", "webview2-com", - "windows 0.30.0", + "windows 0.37.0", ] [[package]] name = "tauri-runtime-wry" -version = "0.5.2" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b78338baa375a2c3f7746e91595ef2b33b09bc4714586cc6b4486fb718d98e33" +checksum = "0cd6fe3f8dc12a9c409ee6da19379636525e0ff8da12897c04dc1e76b8c8ff62" dependencies = [ "cocoa", "gtk", @@ -3905,18 +3848,18 @@ dependencies = [ "rand 0.8.5", "tauri-runtime", "tauri-utils", - "uuid 1.0.0", + "uuid 1.1.0", "webkit2gtk", "webview2-com", - "windows 0.30.0", + "windows 0.37.0", "wry", ] [[package]] name = "tauri-utils" -version = "1.0.0-rc.7" +version = "1.0.0-rc.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c41e14b545d79532743e1d279b9b8488babf35737fcc6cfcd9dbc5fde58919c9" +checksum = "2a636fa13c9210cc19243e3efee408fe0c09a3de820c329c61fecb25dbf1e643" dependencies = [ "brotli", "ctor", @@ -3929,6 +3872,7 @@ dependencies = [ "phf 0.10.1", "proc-macro2", "quote", + "semver 1.0.9", "serde", "serde_json", "serde_with", @@ -4372,9 +4316,9 @@ checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" [[package]] name = "uuid" -version = "1.0.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cfcd319456c4d6ea10087ed423473267e1a071f3bc0aa89f80d60997843c6f0" +checksum = "93bbc61e655a4833cf400d0d15bf3649313422fa7572886ad6dab16d79886365" dependencies = [ "getrandom 0.2.6", ] @@ -4598,21 +4542,21 @@ dependencies = [ [[package]] name = "webview2-com" -version = "0.13.0" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb8e90ac2d9ce39cdb70017aaec641be09fbdd702b7b332b9896d053eb469524" +checksum = "a489a9420acabb3c2ed0434b6f71f6b56b9485ec32665a28dec1ee186d716e0f" dependencies = [ "webview2-com-macros", "webview2-com-sys", - "windows 0.30.0", - "windows_macros", + "windows 0.37.0", + "windows-implement", ] [[package]] name = "webview2-com-macros" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1515c6c82fcee93f6edaacc72c8e233dbe4ff3ca569dce1901dfc36c404a3e99" +checksum = "eaebe196c01691db62e9e4ca52c5ef1e4fd837dcae27dae3ada599b5a8fd05ac" dependencies = [ "proc-macro2", "quote", @@ -4621,15 +4565,15 @@ dependencies = [ [[package]] name = "webview2-com-sys" -version = "0.13.0" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92160310b3322397e4ff8a8285a7429d73a07a68fda44ee80879605b93e53f76" +checksum = "0258c53ee9adc0a4f8ba1c8c317588f7a58c7048a55b621d469ba75ab3709ca1" dependencies = [ "regex", "serde", "serde_json", "thiserror", - "windows 0.30.0", + "windows 0.37.0", "windows-bindgen", ] @@ -4688,19 +4632,6 @@ dependencies = [ "windows_x86_64_msvc 0.24.0", ] -[[package]] -name = "windows" -version = "0.30.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b749ebd2304aa012c5992d11a25d07b406bdbe5f79d371cb7a918ce501a19eb0" -dependencies = [ - "windows_aarch64_msvc 0.30.0", - "windows_i686_gnu 0.30.0", - "windows_i686_msvc 0.30.0", - "windows_x86_64_gnu 0.30.0", - "windows_x86_64_msvc 0.30.0", -] - [[package]] name = "windows" version = "0.35.0" @@ -4714,16 +4645,46 @@ dependencies = [ "windows_x86_64_msvc 0.35.0", ] +[[package]] +name = "windows" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57b543186b344cc61c85b5aab0d2e3adf4e0f99bc076eff9aa5927bcc0b8a647" +dependencies = [ + "windows-implement", + "windows_aarch64_msvc 0.37.0", + "windows_i686_gnu 0.37.0", + "windows_i686_msvc 0.37.0", + "windows_x86_64_gnu 0.37.0", + "windows_x86_64_msvc 0.37.0", +] + [[package]] name = "windows-bindgen" -version = "0.30.0" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bed7be31ade0af08fec9b5343e9edcc005d22b1f11859b8a59b24797f5858e8" +dependencies = [ + "windows-metadata", + "windows-tokens", +] + +[[package]] +name = "windows-implement" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "944c545fcae9dd66488308f8b69aa3ba34f53714416ecfcdcbbfa4b6821e27c6" +checksum = "67a1062e555f7d9d66fd1130ed4f7c6ec41a47529ee0850cd0e926d95b26bb14" dependencies = [ - "windows_quote", - "windows_reader", + "syn", + "windows-tokens", ] +[[package]] +name = "windows-metadata" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f33f2b90a6664e369c41ab5ff262d06f048fc9685d9bf8a0e99a47750bb0463" + [[package]] name = "windows-sys" version = "0.36.1" @@ -4738,10 +4699,10 @@ dependencies = [ ] [[package]] -name = "windows_aarch64_msvc" -version = "0.30.0" +name = "windows-tokens" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29277a4435d642f775f63c7d1faeb927adba532886ce0287bd985bffb16b6bca" +checksum = "3263d25f1170419995b78ff10c06b949e8a986c35c208dc24333c64753a87169" [[package]] name = "windows_aarch64_msvc" @@ -4756,14 +4717,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" [[package]] -name = "windows_gen" -version = "0.30.0" +name = "windows_aarch64_msvc" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30dff4d91d22520628bb94b66f2bb313cb16a09a515a32320a84a1b449bc94c0" -dependencies = [ - "windows_quote", - "windows_reader", -] +checksum = "2623277cb2d1c216ba3b578c0f3cf9cdebeddb6e66b1b218bb33596ea7769c3a" [[package]] name = "windows_i686_gnu" @@ -4771,12 +4728,6 @@ version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0866510a3eca9aed73a077490bbbf03e5eaac4e1fd70849d89539e5830501fd" -[[package]] -name = "windows_i686_gnu" -version = "0.30.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1145e1989da93956c68d1864f32fb97c8f561a8f89a5125f6a2b7ea75524e4b8" - [[package]] name = "windows_i686_gnu" version = "0.35.0" @@ -4790,16 +4741,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" [[package]] -name = "windows_i686_msvc" -version = "0.24.0" +name = "windows_i686_gnu" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf0ffed56b7e9369a29078d2ab3aaeceea48eb58999d2cff3aa2494a275b95c6" +checksum = "d3925fd0b0b804730d44d4b6278c50f9699703ec49bcd628020f46f4ba07d9e1" [[package]] name = "windows_i686_msvc" -version = "0.30.0" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4a09e3a0d4753b73019db171c1339cd4362c8c44baf1bcea336235e955954a6" +checksum = "bf0ffed56b7e9369a29078d2ab3aaeceea48eb58999d2cff3aa2494a275b95c6" [[package]] name = "windows_i686_msvc" @@ -4814,28 +4765,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" [[package]] -name = "windows_macros" -version = "0.30.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62ae44ab917e9005fe710d99d52d227ca0164b10a09be90649142cc3fab825d3" -dependencies = [ - "syn", - "windows_gen", - "windows_quote", - "windows_reader", -] - -[[package]] -name = "windows_quote" -version = "0.30.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71f02c51a77e6248c1206aaa920802c32d50a05205e229b118d7f3afd3036667" - -[[package]] -name = "windows_reader" -version = "0.30.0" +name = "windows_i686_msvc" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e44e6df0da993cda589c5ac852272fbb2a0ead67a031a017dd3eac11528a2d72" +checksum = "ce907ac74fe331b524c1298683efbf598bb031bc84d5e274db2083696d07c57c" [[package]] name = "windows_x86_64_gnu" @@ -4843,12 +4776,6 @@ version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "384a173630588044205a2993b6864a2f56e5a8c1e7668c07b93ec18cf4888dc4" -[[package]] -name = "windows_x86_64_gnu" -version = "0.30.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ca64fcb0220d58db4c119e050e7af03c69e6f4f415ef69ec1773d9aab422d5a" - [[package]] name = "windows_x86_64_gnu" version = "0.35.0" @@ -4862,16 +4789,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" [[package]] -name = "windows_x86_64_msvc" -version = "0.24.0" +name = "windows_x86_64_gnu" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bd8f062d8ca5446358159d79a90be12c543b3a965c847c8f3eedf14b321d399" +checksum = "2babfba0828f2e6b32457d5341427dcbb577ceef556273229959ac23a10af33d" [[package]] name = "windows_x86_64_msvc" -version = "0.30.0" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08cabc9f0066848fef4bc6a1c1668e6efce38b661d2aeec75d18d8617eebb5f1" +checksum = "9bd8f062d8ca5446358159d79a90be12c543b3a965c847c8f3eedf14b321d399" [[package]] name = "windows_x86_64_msvc" @@ -4885,6 +4812,12 @@ version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" +[[package]] +name = "windows_x86_64_msvc" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4dd6dc7df2d84cf7b33822ed5b86318fb1781948e9663bacd047fc9dd52259d" + [[package]] name = "winreg" version = "0.10.1" @@ -4916,9 +4849,9 @@ dependencies = [ [[package]] name = "wry" -version = "0.16.2" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5676092e1a33448ed0f268717bcbb2e928354b78f4c1f60f3d43641eedea0d9" +checksum = "38425583b1f8c16c074fa4f962f7f0ddd5cb2f6b241a494a26db5eca3ccd4fd7" dependencies = [ "block", "cocoa", @@ -4928,7 +4861,7 @@ dependencies = [ "glib", "gtk", "http", - "jni", + "jni 0.18.0", "libc", "log", "objc", @@ -4942,8 +4875,8 @@ dependencies = [ "webkit2gtk", "webkit2gtk-sys", "webview2-com", - "windows 0.30.0", - "windows_macros", + "windows 0.37.0", + "windows-implement", ] [[package]] diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index f89632d..8664b71 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -12,18 +12,18 @@ build = "src/build.rs" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [build-dependencies] -tauri-build = { version = "1.0.0-rc.9", features = [] } +tauri-build = { version = "1.0.0-rc.12", features = [] } [dependencies] serde_json = "1.0" serde = { version = "1.0", features = ["derive"] } -tauri = { version = "1.0.0-rc.11", features = ["api-all"] } +tauri = { version = "1.0.0-rc.14", features = ["api-all"] } reqwest = { version = "0.11", features = ["json",] } tokio = { version = "1", features = ["full"] } anyhow = "1.0" thiserror = "1.0" serde_yaml = "0.8" -biliup = { version = "0.1.7" } +biliup = { version = "0.1.8" } futures = "0.3.17" bytes = "1.1.0" diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index d5173a3..4f6d931 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -7,14 +7,39 @@ use std::pin::Pin; use std::task::Poll; use futures::{FutureExt, Stream}; use std::future::Future; +use std::rc::Rc; use reqwest::Body; use bytes::{Buf, Bytes}; -use tauri::Window; +use tauri::{App, Window}; use tokio::sync::mpsc::UnboundedSender; use tokio::sync::mpsc::Sender; +use std::sync::{Arc}; +use tokio::sync::Mutex; pub mod error; +#[derive(Default)] +pub struct Credential { + pub credential: Mutex>> +} + +impl Credential { + pub async fn get_credential(&self) -> error::Result> { + let mut guard = self.credential.lock().await; + if guard.is_none() { + let client = Client::new(); + let login_info = client + .login_by_cookies(std::fs::File::open(cookie_file()?)?) + .await?; + let arc = Arc::new((login_info, client)); + *guard = Some(arc.clone()); + Ok(arc.clone()) + } else { + Ok(guard.as_ref().unwrap().clone()) + } + } +} + pub fn config_file() -> error::Result { Ok(config_path()?.join("config.yaml")) } @@ -29,7 +54,7 @@ pub fn config_path() -> error::Result { if !config_dir.exists() { std::fs::create_dir(&config_dir)?; } - println!("{config_dir:?}"); + println!("config_path: {config_dir:?}"); Ok(config_dir) } @@ -43,14 +68,6 @@ pub async fn login_by_password(username: &str, password: &str) -> anyhow::Result Ok(()) } -pub async fn login_by_cookies() -> anyhow::Result<(LoginInfo, Client)> { - let client = Client::new(); - let login_info = client - .login_by_cookies(std::fs::File::open(cookie_file()?)?) - .await?; - Ok((login_info, client)) -} - pub fn encode_hex(bytes: &[u16]) -> String { let mut s = String::with_capacity(bytes.len() * 2); for &b in bytes { @@ -114,6 +131,5 @@ impl From for Body { mod test { #[test] fn test_hex() { - } } diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index fb62b0b..2201d0a 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -11,7 +11,6 @@ use std::sync::Arc; use std::sync::atomic::{AtomicBool, Ordering}; use std::task::Poll; use std::time::Instant; - use anyhow::{anyhow, bail, Context}; use biliup::{Account, Config, line, User, VideoFile}; use biliup::client::{Client, LoginInfo}; @@ -19,10 +18,8 @@ use biliup::video::{BiliBili, Studio, Video}; use bytes::Buf; use futures::future::abortable; use futures::stream::Abortable; -use tauri::{Manager, Window}; - -// use app::video::{BiliBili, Client, LoginInfo, Studio, Video}; -use app::{config_file, cookie_file, encode_hex, login_by_cookies}; +use tauri::{Manager, State, Window}; +use app::{config_file, cookie_file, Credential, encode_hex}; use app::error; use app::error::Result; use futures::StreamExt; @@ -59,14 +56,12 @@ fn login(username: &str, password: &str, remember_me: bool) -> Result { } } } - // println!("body = {:?}", client); Ok("登录成功".into()) } #[tauri::command] -async fn login_by_cookie() -> Result { - login_by_cookies().await?; - // println!("body = {:?}", client); +async fn login_by_cookie(credential: tauri::State<'_, Credential>) -> Result { + credential.get_credential().await?; Ok("登录成功".into()) } @@ -82,7 +77,6 @@ async fn login_by_sms(code: u32, res: serde_json::Value) -> Result { #[tauri::command] async fn send_sms(country_code: u32, phone: u64) -> Result { let ret = Client::new().send_sms(phone, country_code).await?; - // println!("body = {:?}", client); Ok(ret) } @@ -98,14 +92,12 @@ async fn login_by_qrcode(res: serde_json::Value) -> Result { #[tauri::command] async fn get_qrcode() -> Result { let qrcode = Client::new().get_qrcode().await?; - // println!("body = {:?}", client); Ok(qrcode) } - #[tauri::command] -async fn upload(mut video: Video, window: Window) -> Result