From b351c38e88e61dc68312829f385afc93df2648fc Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 7 Jan 2023 19:34:36 +0000 Subject: [PATCH 01/27] fix(deps): update rust crate notify to v5 --- Cargo.lock | 244 +++++++++++------------------------- plugins/fs-watch/Cargo.toml | 2 +- 2 files changed, 71 insertions(+), 175 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 85718b5a..fd37b042 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -23,7 +23,7 @@ version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cipher", "cpufeatures", "opaque-debug", @@ -158,7 +158,7 @@ dependencies = [ "log", "rand 0.7.3", "runloop", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -393,12 +393,6 @@ dependencies = [ "smallvec", ] -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -411,7 +405,7 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c80e5460aa66fe3b91d40bcbdab953a597b60053e34d684ac6903f863b680a6" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cipher", "cpufeatures", "zeroize", @@ -442,7 +436,7 @@ dependencies = [ "num-traits", "time 0.1.45", "wasm-bindgen", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -606,7 +600,7 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -615,7 +609,7 @@ version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "crossbeam-utils", ] @@ -625,7 +619,7 @@ version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d1cfb3ea8a53f37c40dea2c7bedcbd88bdfae54f5e2175d6ecaff1c988353add" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "crossbeam-utils", ] @@ -635,7 +629,7 @@ version = "0.8.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -871,7 +865,7 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "dirs-sys-next", ] @@ -883,7 +877,7 @@ checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" dependencies = [ "libc", "redox_users", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -894,7 +888,7 @@ checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" dependencies = [ "libc", "redox_users", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -962,7 +956,7 @@ version = "0.8.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9852635589dc9f9ea1b6fe9f05b50ef208c85c834a562f0c6abb1c475736ec2b" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -1005,7 +999,7 @@ version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4e884668cd0c7480504233e951174ddc3b382f7c2666e3b7310b5c4e7b0c37f9" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "redox_syscall", "windows-sys 0.42.0", @@ -1063,41 +1057,15 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "fsevent" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ab7d1bd1bd33cc98b0889831b72da23c0aa4df9cec7e0702f46ecea04b35db6" -dependencies = [ - "bitflags", - "fsevent-sys", -] - [[package]] name = "fsevent-sys" -version = "2.0.1" +version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f41b048a94555da0f42f1d632e2e19510084fb8e303b0daa2816e733fb3644a0" +checksum = "76ee7a02da4d231650c7cea31349b889be2f45ddb3ef3032d2ec8185f6313fd2" dependencies = [ "libc", ] -[[package]] -name = "fuchsia-zircon" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" -dependencies = [ - "bitflags", - "fuchsia-zircon-sys", -] - -[[package]] -name = "fuchsia-zircon-sys" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" - [[package]] name = "futf" version = "0.1.5" @@ -1318,7 +1286,7 @@ version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "wasi 0.9.0+wasi-snapshot-preview1", ] @@ -1329,7 +1297,7 @@ version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "js-sys", "libc", "wasi 0.11.0+wasi-snapshot-preview1", @@ -1373,7 +1341,7 @@ dependencies = [ "gobject-sys", "libc", "system-deps 6.0.3", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -1696,7 +1664,7 @@ dependencies = [ "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -1787,9 +1755,9 @@ dependencies = [ [[package]] name = "inotify" -version = "0.7.1" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4816c66d2c8ae673df83366c18341538f234a26d65a9ecea5c348b453ac1d02f" +checksum = "f8069d3ec154eb856955c1c0fbffefbf5f3c40a104ec912d4797314c1801abff" dependencies = [ "bitflags", "inotify-sys", @@ -1811,7 +1779,7 @@ version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -1958,13 +1926,23 @@ dependencies = [ ] [[package]] -name = "kernel32-sys" -version = "0.2.2" +name = "kqueue" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +checksum = "2c8fc60ba15bf51257aa9807a48a61013db043fcf3a78cb0d916e8e396dcad98" dependencies = [ - "winapi 0.2.8", - "winapi-build", + "kqueue-sys", + "libc", +] + +[[package]] +name = "kqueue-sys" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8367585489f01bc55dd27404dcf56b95e6da061a256a666ab23be9ba96a2e587" +dependencies = [ + "bitflags", + "libc", ] [[package]] @@ -1988,12 +1966,6 @@ dependencies = [ "spin 0.5.2", ] -[[package]] -name = "lazycell" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" - [[package]] name = "libappindicator" version = "0.7.1" @@ -2030,8 +2002,8 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" dependencies = [ - "cfg-if 1.0.0", - "winapi 0.3.9", + "cfg-if", + "winapi", ] [[package]] @@ -2117,7 +2089,7 @@ version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "value-bag", ] @@ -2127,7 +2099,7 @@ version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff50ecb28bb86013e935fb6683ab1f6d3a20016f123c76fd4c27470076ac30f5" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "generator", "scoped-tls", "serde", @@ -2225,25 +2197,6 @@ dependencies = [ "adler", ] -[[package]] -name = "mio" -version = "0.6.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4" -dependencies = [ - "cfg-if 0.1.10", - "fuchsia-zircon", - "fuchsia-zircon-sys", - "iovec", - "kernel32-sys", - "libc", - "log", - "miow", - "net2", - "slab", - "winapi 0.2.8", -] - [[package]] name = "mio" version = "0.8.5" @@ -2256,30 +2209,6 @@ dependencies = [ "windows-sys 0.42.0", ] -[[package]] -name = "mio-extras" -version = "2.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52403fe290012ce777c4626790c8951324a2b9e3316b3143779c72b029742f19" -dependencies = [ - "lazycell", - "log", - "mio 0.6.23", - "slab", -] - -[[package]] -name = "miow" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d" -dependencies = [ - "kernel32-sys", - "net2", - "winapi 0.2.8", - "ws2_32-sys", -] - [[package]] name = "native-tls" version = "0.2.11" @@ -2326,17 +2255,6 @@ dependencies = [ "jni-sys", ] -[[package]] -name = "net2" -version = "0.2.38" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74d0df99cfcd2530b2e694f6e17e7f37b8e26bb23983ac530c0c97408837c631" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "winapi 0.3.9", -] - [[package]] name = "new_debug_unreachable" version = "1.0.4" @@ -2350,7 +2268,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" dependencies = [ "bitflags", - "cfg-if 1.0.0", + "cfg-if", "libc", "memoffset", ] @@ -2373,20 +2291,20 @@ dependencies = [ [[package]] name = "notify" -version = "4.0.17" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae03c8c853dba7bfd23e571ff0cff7bc9dceb40a4cd684cd1681824183f45257" +checksum = "ed2c66da08abae1c024c01d635253e402341b4060a12e99b31c7594063bf490a" dependencies = [ "bitflags", + "crossbeam-channel", "filetime", - "fsevent", "fsevent-sys", "inotify", + "kqueue", "libc", - "mio 0.6.23", - "mio-extras", + "mio", "walkdir", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -2396,7 +2314,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" dependencies = [ "overload", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -2547,7 +2465,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "29d971fd5722fec23977260f6e81aa67d2f22cadbdc2aa049f1022d9a3be1566" dependencies = [ "bitflags", - "cfg-if 1.0.0", + "cfg-if", "foreign-types", "libc", "once_cell", @@ -2643,12 +2561,12 @@ version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "instant", "libc", "redox_syscall", "smallvec", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -2657,7 +2575,7 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ff9f3fef3968a3ec5945535ed654cb38ff72d7495a25619e2247fb15a2ed9ba" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "redox_syscall", "smallvec", @@ -2905,7 +2823,7 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8419d2b623c7c0896ff2d5d96e2cb4ede590fed28fcc34934f4c33c036e620a1" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "opaque-debug", "universal-hash", @@ -3141,7 +3059,7 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] @@ -3194,7 +3112,7 @@ dependencies = [ "spin 0.5.2", "untrusted", "web-sys", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -3535,7 +3453,7 @@ version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "digest 0.10.6", ] @@ -3547,7 +3465,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" dependencies = [ "block-buffer 0.9.0", - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "digest 0.9.0", "opaque-debug", @@ -3559,7 +3477,7 @@ version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "digest 0.10.6", ] @@ -3601,7 +3519,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" dependencies = [ "libc", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -4346,12 +4264,12 @@ version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "fastrand", "libc", "redox_syscall", "remove_dir_all", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -4417,7 +4335,7 @@ checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" dependencies = [ "libc", "wasi 0.10.0+wasi-snapshot-preview1", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -4484,7 +4402,7 @@ dependencies = [ "bytes 1.3.0", "libc", "memchr", - "mio 0.8.5", + "mio", "num_cpus", "pin-project-lite", "socket2", @@ -4572,7 +4490,7 @@ version = "0.1.37" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -4848,7 +4766,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" dependencies = [ "same-file", - "winapi 0.3.9", + "winapi", "winapi-util", ] @@ -4886,7 +4804,7 @@ version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "wasm-bindgen-macro", ] @@ -4911,7 +4829,7 @@ version = "0.4.33" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23639446165ca5a5de86ae1d8896b737ae80319560fbaa4c2887b7da6e7ebd7d" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "js-sys", "wasm-bindgen", "web-sys", @@ -5071,12 +4989,6 @@ dependencies = [ "web-sys", ] -[[package]] -name = "winapi" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" - [[package]] name = "winapi" version = "0.3.9" @@ -5087,12 +4999,6 @@ dependencies = [ "winapi-x86_64-pc-windows-gnu", ] -[[package]] -name = "winapi-build" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" - [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" @@ -5105,7 +5011,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] @@ -5309,7 +5215,7 @@ version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] @@ -5350,16 +5256,6 @@ dependencies = [ "windows-implement", ] -[[package]] -name = "ws2_32-sys" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" -dependencies = [ - "winapi 0.2.8", - "winapi-build", -] - [[package]] name = "x11" version = "2.20.1" diff --git a/plugins/fs-watch/Cargo.toml b/plugins/fs-watch/Cargo.toml index 89501ac8..b3dbd942 100644 --- a/plugins/fs-watch/Cargo.toml +++ b/plugins/fs-watch/Cargo.toml @@ -15,4 +15,4 @@ serde_json.workspace = true tauri.workspace = true log.workspace = true thiserror.workspace = true -notify = "4.0" \ No newline at end of file +notify = "5.0" \ No newline at end of file From 24b09c385e63260692d4eaf11ac74afcd4610ff2 Mon Sep 17 00:00:00 2001 From: FabianLars Date: Sat, 7 Jan 2023 22:25:44 +0100 Subject: [PATCH 02/27] adapt plugin to notify v5 --- Cargo.lock | 13 +++ plugins/fs-watch/Cargo.toml | 3 +- plugins/fs-watch/guest-js/index.ts | 173 ++++++++++++++--------------- plugins/fs-watch/src/lib.rs | 99 ++++++----------- 4 files changed, 132 insertions(+), 156 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fd37b042..1ff0a30b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2303,10 +2303,22 @@ dependencies = [ "kqueue", "libc", "mio", + "serde", "walkdir", "winapi", ] +[[package]] +name = "notify-debouncer-mini" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e23e9fa24f094b143c1eb61f90ac6457de87be6987bc70746e0179f7dbc9007b" +dependencies = [ + "crossbeam-channel", + "notify", + "serde", +] + [[package]] name = "nu-ansi-term" version = "0.46.0" @@ -4048,6 +4060,7 @@ version = "0.1.0" dependencies = [ "log", "notify", + "notify-debouncer-mini", "serde", "serde_json", "tauri", diff --git a/plugins/fs-watch/Cargo.toml b/plugins/fs-watch/Cargo.toml index b3dbd942..b8f648a9 100644 --- a/plugins/fs-watch/Cargo.toml +++ b/plugins/fs-watch/Cargo.toml @@ -15,4 +15,5 @@ serde_json.workspace = true tauri.workspace = true log.workspace = true thiserror.workspace = true -notify = "5.0" \ No newline at end of file +notify = { version = "5.0" , features = ["serde"] } +notify-debouncer-mini = { version = "0.2.1" , features = ["serde"] } diff --git a/plugins/fs-watch/guest-js/index.ts b/plugins/fs-watch/guest-js/index.ts index bb16c2c9..0fb7eb24 100644 --- a/plugins/fs-watch/guest-js/index.ts +++ b/plugins/fs-watch/guest-js/index.ts @@ -1,110 +1,103 @@ -import { invoke } from "@tauri-apps/api/tauri"; -import { UnlistenFn } from "@tauri-apps/api/event"; -import { appWindow, WebviewWindow } from "@tauri-apps/api/window"; +import { invoke } from '@tauri-apps/api/tauri'; +import { UnlistenFn } from '@tauri-apps/api/event'; +import { appWindow, WebviewWindow } from '@tauri-apps/api/window'; const w: WebviewWindow = appWindow; export interface WatchOptions { - recursive?: boolean; + recursive?: boolean; } export interface DebouncedWatchOptions extends WatchOptions { - delayMs?: number; + delayMs?: number; } -export interface RawEvent { - path: string | null; - operation: number; - cookie: number | null; -} - -export type DebouncedEvent = - | { type: "NoticeWrite"; payload: string } - | { type: "NoticeRemove"; payload: string } - | { type: "Create"; payload: string } - | { type: "Write"; payload: string } - | { type: "Chmod"; payload: string } - | { type: "Remove"; payload: string } - | { type: "Rename"; payload: string } - | { type: "Rescan"; payload: null } - | { type: "Error"; payload: { error: string; path: string | null } }; +export type RawEvent = { + type: RawEventKind; + paths: string[]; + attrs: unknown; +}; + +type RawEventKind = + | 'any ' + | { + access?: unknown; + } + | { + create?: unknown; + } + | { + modify?: unknown; + } + | { + remove?: unknown; + } + | 'other'; + +export type DebouncedEvent = { kind: 'any'; path: string } | { kind: 'AnyContinous'; path: string }; async function unwatch(id: number): Promise { - await invoke("plugin:fs-watch|unwatch", { id }); + await invoke('plugin:fs-watch|unwatch', { id }); } -export async function watch( - paths: string | string[], - options: DebouncedWatchOptions, - cb: (event: DebouncedEvent) => void -): Promise { - const opts = { - recursive: false, - delayMs: 2000, - ...options, - }; - let watchPaths; - if (typeof paths === "string") { - watchPaths = [paths]; - } else { - watchPaths = paths; - } - - const id = window.crypto.getRandomValues(new Uint32Array(1))[0]; - - await invoke("plugin:fs-watch|watch", { - id, - paths: watchPaths, - options: opts, - }); - - const unlisten = await w.listen( - `watcher://debounced-event/${id}`, - (event) => { - cb(event.payload); +export async function watch(paths: string | string[], options: DebouncedWatchOptions, cb: (event: DebouncedEvent) => void): Promise { + const opts = { + recursive: false, + delayMs: 2000, + ...options, + }; + let watchPaths; + if (typeof paths === 'string') { + watchPaths = [paths]; + } else { + watchPaths = paths; } - ); - return () => { - void unwatch(id); - unlisten(); - }; + const id = window.crypto.getRandomValues(new Uint32Array(1))[0]; + + await invoke('plugin:fs-watch|watch', { + id, + paths: watchPaths, + options: opts, + }); + + const unlisten = await w.listen(`watcher://debounced-event/${id}`, (event) => { + cb(event.payload); + }); + + return () => { + void unwatch(id); + unlisten(); + }; } -export async function watchImmediate( - paths: string | string[], - options: WatchOptions, - cb: (event: RawEvent) => void -): Promise { - const opts = { - recursive: false, - ...options, - delayMs: null, - }; - let watchPaths; - if (typeof paths === "string") { - watchPaths = [paths]; - } else { - watchPaths = paths; - } - - const id = window.crypto.getRandomValues(new Uint32Array(1))[0]; - - await invoke("plugin:fs-watch|watch", { - id, - paths: watchPaths, - options: opts, - }); - - const unlisten = await w.listen( - `watcher://raw-event/${id}`, - (event) => { - cb(event.payload); +export async function watchImmediate(paths: string | string[], options: WatchOptions, cb: (event: RawEvent) => void): Promise { + const opts = { + recursive: false, + ...options, + delayMs: null, + }; + let watchPaths; + if (typeof paths === 'string') { + watchPaths = [paths]; + } else { + watchPaths = paths; } - ); - return () => { - void unwatch(id); - unlisten(); - }; + const id = window.crypto.getRandomValues(new Uint32Array(1))[0]; + + await invoke('plugin:fs-watch|watch', { + id, + paths: watchPaths, + options: opts, + }); + + const unlisten = await w.listen(`watcher://raw-event/${id}`, (event) => { + cb(event.payload); + }); + + return () => { + void unwatch(id); + unlisten(); + }; } diff --git a/plugins/fs-watch/src/lib.rs b/plugins/fs-watch/src/lib.rs index 790507b7..c022b253 100644 --- a/plugins/fs-watch/src/lib.rs +++ b/plugins/fs-watch/src/lib.rs @@ -1,7 +1,5 @@ -use notify::{ - raw_watcher, watcher, DebouncedEvent, Op, RawEvent, RecommendedWatcher, RecursiveMode, - Watcher as _, -}; +use notify::{Config, Event, RecommendedWatcher, RecursiveMode, Watcher}; +use notify_debouncer_mini::{new_debouncer, DebounceEventResult, Debouncer}; use serde::{ser::Serializer, Deserialize, Serialize}; use tauri::{ command, @@ -39,72 +37,33 @@ impl Serialize for Error { } #[derive(Default)] -struct WatcherCollection(Mutex)>>); +struct WatcherCollection(Mutex)>>); -#[derive(Clone, Serialize)] -struct RawEventWrapper { - path: Option, - operation: u32, - cookie: Option, +enum WatcherKind { + Debouncer(Debouncer), + Watcher(RecommendedWatcher), } -#[derive(Clone, Serialize)] -#[serde(tag = "type", content = "payload")] -enum DebouncedEventWrapper { - NoticeWrite(PathBuf), - NoticeRemove(PathBuf), - Create(PathBuf), - Write(PathBuf), - Chmod(PathBuf), - Remove(PathBuf), - Rename(PathBuf, PathBuf), - Rescan, - Error { - error: String, - path: Option, - }, -} - -impl From for DebouncedEventWrapper { - fn from(event: DebouncedEvent) -> Self { - match event { - DebouncedEvent::NoticeWrite(path) => Self::NoticeWrite(path), - DebouncedEvent::NoticeRemove(path) => Self::NoticeRemove(path), - DebouncedEvent::Create(path) => Self::Create(path), - DebouncedEvent::Write(path) => Self::Write(path), - DebouncedEvent::Chmod(path) => Self::Chmod(path), - DebouncedEvent::Remove(path) => Self::Remove(path), - DebouncedEvent::Rename(from, to) => Self::Rename(from, to), - DebouncedEvent::Rescan => Self::Rescan, - DebouncedEvent::Error(error, path) => Self::Error { - error: error.to_string(), - path, - }, - } - } -} - -fn watch_raw(window: Window, rx: Receiver, id: Id) { +fn watch_raw(window: Window, rx: Receiver>, id: Id) { spawn(move || { let event_name = format!("watcher://raw-event/{}", id); while let Ok(event) = rx.recv() { - let _ = window.emit( - &event_name, - RawEventWrapper { - path: event.path, - operation: event.op.unwrap_or_else(|_| Op::empty()).bits(), - cookie: event.cookie, - }, - ); + if let Ok(event) = event { + // TODO: Should errors be emitted too? + let _ = window.emit(&event_name, event); + } } }); } -fn watch_debounced(window: Window, rx: Receiver, id: Id) { +fn watch_debounced(window: Window, rx: Receiver, id: Id) { spawn(move || { let event_name = format!("watcher://debounced-event/{}", id); while let Ok(event) = rx.recv() { - let _ = window.emit(&event_name, DebouncedEventWrapper::from(event)); + if let Ok(event) = event { + // TODO: Should errors be emitted too? + let _ = window.emit(&event_name, event); + } } }); } @@ -132,20 +91,21 @@ async fn watch( let watcher = if let Some(delay) = options.delay_ms { let (tx, rx) = channel(); - let mut watcher = watcher(tx, Duration::from_millis(delay))?; + let mut debouncer = new_debouncer(Duration::from_millis(delay), None, tx)?; + let watcher = debouncer.watcher(); for path in &paths { watcher.watch(path, mode)?; } watch_debounced(window, rx, id); - watcher + WatcherKind::Debouncer(debouncer) } else { let (tx, rx) = channel(); - let mut watcher = raw_watcher(tx)?; + let mut watcher = RecommendedWatcher::new(tx, Config::default())?; for path in &paths { watcher.watch(path, mode)?; } watch_raw(window, rx, id); - watcher + WatcherKind::Watcher(watcher) }; watchers.0.lock().unwrap().insert(id, (watcher, paths)); @@ -155,10 +115,19 @@ async fn watch( #[command] async fn unwatch(watchers: State<'_, WatcherCollection>, id: Id) -> Result<()> { - if let Some((mut watcher, paths)) = watchers.0.lock().unwrap().remove(&id) { - for path in paths { - watcher.unwatch(path)?; - } + if let Some((watcher, paths)) = watchers.0.lock().unwrap().remove(&id) { + match watcher { + WatcherKind::Debouncer(mut debouncer) => { + for path in paths { + debouncer.watcher().unwatch(&path)? + } + } + WatcherKind::Watcher(mut watcher) => { + for path in paths { + watcher.unwatch(&path)? + } + } + }; } Ok(()) } From ea5fb0013c0507ff082a94352645efcc51d321f7 Mon Sep 17 00:00:00 2001 From: FabianLars Date: Sat, 7 Jan 2023 22:28:10 +0100 Subject: [PATCH 03/27] fmt --- plugins/fs-watch/guest-js/index.ts | 174 ++++++++++++++++------------- 1 file changed, 95 insertions(+), 79 deletions(-) diff --git a/plugins/fs-watch/guest-js/index.ts b/plugins/fs-watch/guest-js/index.ts index 0fb7eb24..31d333b2 100644 --- a/plugins/fs-watch/guest-js/index.ts +++ b/plugins/fs-watch/guest-js/index.ts @@ -1,103 +1,119 @@ -import { invoke } from '@tauri-apps/api/tauri'; -import { UnlistenFn } from '@tauri-apps/api/event'; -import { appWindow, WebviewWindow } from '@tauri-apps/api/window'; +import { invoke } from "@tauri-apps/api/tauri"; +import { UnlistenFn } from "@tauri-apps/api/event"; +import { appWindow, WebviewWindow } from "@tauri-apps/api/window"; const w: WebviewWindow = appWindow; export interface WatchOptions { - recursive?: boolean; + recursive?: boolean; } export interface DebouncedWatchOptions extends WatchOptions { - delayMs?: number; + delayMs?: number; } export type RawEvent = { - type: RawEventKind; - paths: string[]; - attrs: unknown; + type: RawEventKind; + paths: string[]; + attrs: unknown; }; type RawEventKind = - | 'any ' - | { - access?: unknown; - } - | { - create?: unknown; - } - | { - modify?: unknown; - } - | { - remove?: unknown; - } - | 'other'; - -export type DebouncedEvent = { kind: 'any'; path: string } | { kind: 'AnyContinous'; path: string }; + | "any " + | { + access?: unknown; + } + | { + create?: unknown; + } + | { + modify?: unknown; + } + | { + remove?: unknown; + } + | "other"; + +export type DebouncedEvent = + | { kind: "any"; path: string } + | { kind: "AnyContinous"; path: string }; async function unwatch(id: number): Promise { - await invoke('plugin:fs-watch|unwatch', { id }); + await invoke("plugin:fs-watch|unwatch", { id }); } -export async function watch(paths: string | string[], options: DebouncedWatchOptions, cb: (event: DebouncedEvent) => void): Promise { - const opts = { - recursive: false, - delayMs: 2000, - ...options, - }; - let watchPaths; - if (typeof paths === 'string') { - watchPaths = [paths]; - } else { - watchPaths = paths; +export async function watch( + paths: string | string[], + options: DebouncedWatchOptions, + cb: (event: DebouncedEvent) => void +): Promise { + const opts = { + recursive: false, + delayMs: 2000, + ...options, + }; + let watchPaths; + if (typeof paths === "string") { + watchPaths = [paths]; + } else { + watchPaths = paths; + } + + const id = window.crypto.getRandomValues(new Uint32Array(1))[0]; + + await invoke("plugin:fs-watch|watch", { + id, + paths: watchPaths, + options: opts, + }); + + const unlisten = await w.listen( + `watcher://debounced-event/${id}`, + (event) => { + cb(event.payload); } + ); - const id = window.crypto.getRandomValues(new Uint32Array(1))[0]; - - await invoke('plugin:fs-watch|watch', { - id, - paths: watchPaths, - options: opts, - }); - - const unlisten = await w.listen(`watcher://debounced-event/${id}`, (event) => { - cb(event.payload); - }); - - return () => { - void unwatch(id); - unlisten(); - }; + return () => { + void unwatch(id); + unlisten(); + }; } -export async function watchImmediate(paths: string | string[], options: WatchOptions, cb: (event: RawEvent) => void): Promise { - const opts = { - recursive: false, - ...options, - delayMs: null, - }; - let watchPaths; - if (typeof paths === 'string') { - watchPaths = [paths]; - } else { - watchPaths = paths; +export async function watchImmediate( + paths: string | string[], + options: WatchOptions, + cb: (event: RawEvent) => void +): Promise { + const opts = { + recursive: false, + ...options, + delayMs: null, + }; + let watchPaths; + if (typeof paths === "string") { + watchPaths = [paths]; + } else { + watchPaths = paths; + } + + const id = window.crypto.getRandomValues(new Uint32Array(1))[0]; + + await invoke("plugin:fs-watch|watch", { + id, + paths: watchPaths, + options: opts, + }); + + const unlisten = await w.listen( + `watcher://raw-event/${id}`, + (event) => { + cb(event.payload); } + ); - const id = window.crypto.getRandomValues(new Uint32Array(1))[0]; - - await invoke('plugin:fs-watch|watch', { - id, - paths: watchPaths, - options: opts, - }); - - const unlisten = await w.listen(`watcher://raw-event/${id}`, (event) => { - cb(event.payload); - }); - - return () => { - void unwatch(id); - unlisten(); - }; + return () => { + void unwatch(id); + unlisten(); + }; } From d33ee156b865eddc162bcce28de7cc01db248efc Mon Sep 17 00:00:00 2001 From: Thomas van der Westen Date: Sun, 15 Jan 2023 11:47:32 +0100 Subject: [PATCH 04/27] Fix sql example in readme (#91) The line where the plugin is added: `.plugin(tauri_plugin_sql::Builder::default())` give my this error; ```the trait `Plugin>` is not implemented for `tauri_plugin_sql::Builder```` I found this fix: https://github.com/tauri-apps/tauri/issues/5947 and it works. --- plugins/sql/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/sql/README.md b/plugins/sql/README.md index 2b7c6f9b..6b034f7c 100644 --- a/plugins/sql/README.md +++ b/plugins/sql/README.md @@ -42,7 +42,7 @@ First you need to register the core plugin with Tauri: ```rust fn main() { tauri::Builder::default() - .plugin(tauri_plugin_sql::Builder::default()) + .plugin(tauri_plugin_sql::Builder::default().build()) .run(tauri::generate_context!()) .expect("error while running tauri application"); } From c9f716c9ae812ae964191cb7396781428a640125 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 17 Jan 2023 11:20:20 +0100 Subject: [PATCH 05/27] chore(deps): update dependency eslint-config-standard-with-typescript to v29 (#94) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- package.json | 2 +- pnpm-lock.yaml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index be7cfb05..dc56217a 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "@typescript-eslint/parser": "^5.46.1", "eslint": "^8.0.1", "eslint-config-prettier": "^8.5.0", - "eslint-config-standard-with-typescript": "^27.0.0", + "eslint-config-standard-with-typescript": "^29.0.0", "eslint-plugin-import": "^2.25.2", "eslint-plugin-n": "^15.0.0", "eslint-plugin-promise": "^6.0.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a60ce9c8..212590cb 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,7 +11,7 @@ importers: '@typescript-eslint/parser': ^5.46.1 eslint: ^8.0.1 eslint-config-prettier: ^8.5.0 - eslint-config-standard-with-typescript: ^27.0.0 + eslint-config-standard-with-typescript: ^29.0.0 eslint-plugin-import: ^2.25.2 eslint-plugin-n: ^15.0.0 eslint-plugin-promise: ^6.0.0 @@ -26,7 +26,7 @@ importers: '@typescript-eslint/parser': 5.46.1_ha6vam6werchizxrnqvarmz2zu eslint: 8.29.0 eslint-config-prettier: 8.5.0_eslint@8.29.0 - eslint-config-standard-with-typescript: 27.0.1_f7skxvi3ubnnb5utlsc5vholvm + eslint-config-standard-with-typescript: 29.0.0_f7skxvi3ubnnb5utlsc5vholvm eslint-plugin-import: 2.26.0_z7hwuz3w5sq2sbhy7d4iqrnsvq eslint-plugin-n: 15.6.0_eslint@8.29.0 eslint-plugin-promise: 6.1.1_eslint@8.29.0 @@ -1218,8 +1218,8 @@ packages: eslint: 8.29.0 dev: true - /eslint-config-standard-with-typescript/27.0.1_f7skxvi3ubnnb5utlsc5vholvm: - resolution: {integrity: sha512-jJVyJldqqiCu3uSA/FP0x9jCDMG+Bbl73twTSnp0aysumJrz4iaVqLl+tGgmPrv0R829GVs117Nmn47M1DDDXA==} + /eslint-config-standard-with-typescript/29.0.0_f7skxvi3ubnnb5utlsc5vholvm: + resolution: {integrity: sha512-pDdpuqkbmamL2LW1QuyJv6FtjSKVOTOmEhJDLQ8okU8jgZYqnVUmb2GIiZnKLgfA44gxuQatkJvyIoSEWv/ipA==} peerDependencies: '@typescript-eslint/eslint-plugin': ^5.0.0 eslint: ^8.0.1 From c9d15db48e458d7e8497674d549d86dfe13bf79e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 17 Jan 2023 16:01:58 +0100 Subject: [PATCH 06/27] chore(deps): update dependency eslint-config-standard-with-typescript to v30 (#95) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- package.json | 2 +- pnpm-lock.yaml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index dc56217a..1ae3eef2 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "@typescript-eslint/parser": "^5.46.1", "eslint": "^8.0.1", "eslint-config-prettier": "^8.5.0", - "eslint-config-standard-with-typescript": "^29.0.0", + "eslint-config-standard-with-typescript": "^30.0.0", "eslint-plugin-import": "^2.25.2", "eslint-plugin-n": "^15.0.0", "eslint-plugin-promise": "^6.0.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 212590cb..43c5c0b8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,7 +11,7 @@ importers: '@typescript-eslint/parser': ^5.46.1 eslint: ^8.0.1 eslint-config-prettier: ^8.5.0 - eslint-config-standard-with-typescript: ^29.0.0 + eslint-config-standard-with-typescript: ^30.0.0 eslint-plugin-import: ^2.25.2 eslint-plugin-n: ^15.0.0 eslint-plugin-promise: ^6.0.0 @@ -26,7 +26,7 @@ importers: '@typescript-eslint/parser': 5.46.1_ha6vam6werchizxrnqvarmz2zu eslint: 8.29.0 eslint-config-prettier: 8.5.0_eslint@8.29.0 - eslint-config-standard-with-typescript: 29.0.0_f7skxvi3ubnnb5utlsc5vholvm + eslint-config-standard-with-typescript: 30.0.0_f7skxvi3ubnnb5utlsc5vholvm eslint-plugin-import: 2.26.0_z7hwuz3w5sq2sbhy7d4iqrnsvq eslint-plugin-n: 15.6.0_eslint@8.29.0 eslint-plugin-promise: 6.1.1_eslint@8.29.0 @@ -1218,8 +1218,8 @@ packages: eslint: 8.29.0 dev: true - /eslint-config-standard-with-typescript/29.0.0_f7skxvi3ubnnb5utlsc5vholvm: - resolution: {integrity: sha512-pDdpuqkbmamL2LW1QuyJv6FtjSKVOTOmEhJDLQ8okU8jgZYqnVUmb2GIiZnKLgfA44gxuQatkJvyIoSEWv/ipA==} + /eslint-config-standard-with-typescript/30.0.0_f7skxvi3ubnnb5utlsc5vholvm: + resolution: {integrity: sha512-/Ltst1BCZCWrGmqprLHBkTwuAbcoQrR8uMeSzZAv1vHKIVg+2nFje+DULA30SW01yCNhnx0a8yhZBkR0ZZPp+w==} peerDependencies: '@typescript-eslint/eslint-plugin': ^5.0.0 eslint: ^8.0.1 From 581d0887e0046cac1e06275cb0dac527d2b02bb9 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 19 Jan 2023 12:09:08 +0100 Subject: [PATCH 07/27] chore(deps): update dependency eslint-config-standard-with-typescript to v31 (#99) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- package.json | 2 +- pnpm-lock.yaml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 1ae3eef2..56ec54f6 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "@typescript-eslint/parser": "^5.46.1", "eslint": "^8.0.1", "eslint-config-prettier": "^8.5.0", - "eslint-config-standard-with-typescript": "^30.0.0", + "eslint-config-standard-with-typescript": "^31.0.0", "eslint-plugin-import": "^2.25.2", "eslint-plugin-n": "^15.0.0", "eslint-plugin-promise": "^6.0.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 43c5c0b8..8a5e7f63 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,7 +11,7 @@ importers: '@typescript-eslint/parser': ^5.46.1 eslint: ^8.0.1 eslint-config-prettier: ^8.5.0 - eslint-config-standard-with-typescript: ^30.0.0 + eslint-config-standard-with-typescript: ^31.0.0 eslint-plugin-import: ^2.25.2 eslint-plugin-n: ^15.0.0 eslint-plugin-promise: ^6.0.0 @@ -26,7 +26,7 @@ importers: '@typescript-eslint/parser': 5.46.1_ha6vam6werchizxrnqvarmz2zu eslint: 8.29.0 eslint-config-prettier: 8.5.0_eslint@8.29.0 - eslint-config-standard-with-typescript: 30.0.0_f7skxvi3ubnnb5utlsc5vholvm + eslint-config-standard-with-typescript: 31.0.0_f7skxvi3ubnnb5utlsc5vholvm eslint-plugin-import: 2.26.0_z7hwuz3w5sq2sbhy7d4iqrnsvq eslint-plugin-n: 15.6.0_eslint@8.29.0 eslint-plugin-promise: 6.1.1_eslint@8.29.0 @@ -1218,8 +1218,8 @@ packages: eslint: 8.29.0 dev: true - /eslint-config-standard-with-typescript/30.0.0_f7skxvi3ubnnb5utlsc5vholvm: - resolution: {integrity: sha512-/Ltst1BCZCWrGmqprLHBkTwuAbcoQrR8uMeSzZAv1vHKIVg+2nFje+DULA30SW01yCNhnx0a8yhZBkR0ZZPp+w==} + /eslint-config-standard-with-typescript/31.0.0_f7skxvi3ubnnb5utlsc5vholvm: + resolution: {integrity: sha512-FLTrcJR62gPPPFwwverxwDTcQDb4HOCfDqmELZgNMSbh1M/Ui36X47a9ZANeo3iuPhMOfvrfuShChW9chdasnA==} peerDependencies: '@typescript-eslint/eslint-plugin': ^5.0.0 eslint: ^8.0.1 From 4ff7843581aced66b2c4e21a64e514e255b41cc4 Mon Sep 17 00:00:00 2001 From: Jonas Kruckenberg Date: Thu, 19 Jan 2023 17:36:29 +0100 Subject: [PATCH 08/27] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 215d2d1a..57583af9 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ | [fs-extra](plugins/fs-extra) | File system methods that aren't included in the core API. | ✅ | ✅ | ✅ | ? | ? | | [fs-watch](plugins/fs-watch) | Watch the filesystem for changes. | ✅ | ✅ | ✅ | ? | ? | | [localhost](plugins/localhost) | Use a localhost server in production apps. | ✅ | ✅ | ✅ | ? | ? | -| [log](plugins/log) | Configurable logging. | ✅ | ✅ | ✅ | ? | ? | +| [log](plugins/log) | Configurable logging. | ✅ | ✅ | ✅ | ✅ | ✅ | | [persisted-scope](plugins/persisted-scope) | Persist runtime scope changes on the filesystem. | ✅ | ✅ | ✅ | ? | ? | | [positioner](plugins/positioner) | Move windows to common locations. | ✅ | ✅ | ✅ | ? | ? | | [sql](plugins/sql) | Interface with SQL databases. | ✅ | ✅ | ✅ | ? | ? | From 47e85ad06d570025463ecd5da9c56a0037aed646 Mon Sep 17 00:00:00 2001 From: amrbashir Date: Mon, 23 Jan 2023 19:46:54 +0200 Subject: [PATCH 09/27] feat(window-state): add flags to control what is saved/restored --- Cargo.lock | 13 +- plugins/window-state/Cargo.toml | 3 +- plugins/window-state/src/lib.rs | 222 ++++++++++++++++++++------------ 3 files changed, 150 insertions(+), 88 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index be0a39ba..e433e4ba 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -235,7 +235,7 @@ checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ "hermit-abi 0.1.19", "libc", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -610,7 +610,7 @@ checksum = "f4ffc801dacf156c5854b9df4f425a626539c3a6ef7893cc0c5084a23f0b6c59" dependencies = [ "atty", "lazy_static", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -2458,7 +2458,7 @@ checksum = "f346ff70e7dbfd675fe90590b92d59ef2de15a8779ae305ebcbfd3f0caf59be4" dependencies = [ "autocfg", "bitflags", - "cfg-if 1.0.0", + "cfg-if", "libc", "memoffset", "pin-utils", @@ -3032,7 +3032,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22122d5ec4f9fe1b3916419b76be1e80bcb93f618d071d2edf841b137b2a2bd6" dependencies = [ "autocfg", - "cfg-if 1.0.0", + "cfg-if", "libc", "log", "wepoll-ffi", @@ -4435,6 +4435,7 @@ name = "tauri-plugin-window-state" version = "0.1.0" dependencies = [ "bincode", + "bitflags", "log", "serde", "serde_json", @@ -4869,7 +4870,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce65604324d3cce9b966701489fbd0cf318cb1f7bd9dd07ac9a4ee6fb791930d" dependencies = [ "tempfile", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -5598,7 +5599,7 @@ dependencies = [ "static_assertions", "tracing", "uds_windows", - "winapi 0.3.9", + "winapi", "zbus_macros", "zbus_names", "zvariant", diff --git a/plugins/window-state/Cargo.toml b/plugins/window-state/Cargo.toml index 00d15f97..16535398 100644 --- a/plugins/window-state/Cargo.toml +++ b/plugins/window-state/Cargo.toml @@ -15,4 +15,5 @@ serde_json.workspace = true tauri.workspace = true log.workspace = true thiserror.workspace = true -bincode = "1.3" \ No newline at end of file +bincode = "1.3" +bitflags = "1" \ No newline at end of file diff --git a/plugins/window-state/src/lib.rs b/plugins/window-state/src/lib.rs index 05157317..d9775f7a 100644 --- a/plugins/window-state/src/lib.rs +++ b/plugins/window-state/src/lib.rs @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT +use bitflags::bitflags; use serde::{Deserialize, Serialize}; use tauri::{ plugin::{Builder as PluginBuilder, TauriPlugin}, @@ -30,25 +31,25 @@ pub enum Error { Bincode(#[from] Box), } -/// Defines how the window visibility should be restored. -#[derive(Debug, Copy, Clone, Eq, PartialEq)] -pub enum ShowMode { - /// The window will always be shown, regardless of what the last stored state was. - Always, - /// The window will be automatically shown if the last stored state for visibility was `true`. - LastSaved, - /// The window will not be automatically shown by this plugin. - Never, +pub type Result = std::result::Result; + +bitflags! { + pub struct StateFlags: u32 { + const SIZE = 1 << 0; + const POSITION = 1 << 1; + const MAXIMIZED = 1 << 2; + const VISIBLE = 1 << 3; + const DECORATIONS = 1 << 4; + const FULLSCREEN = 1 << 5; + } } -impl Default for ShowMode { +impl Default for StateFlags { fn default() -> Self { - Self::LastSaved + Self::all() } } -pub type Result = std::result::Result; - #[derive(Debug, Default, Deserialize, Serialize)] struct WindowMetadata { width: f64, @@ -86,50 +87,86 @@ impl AppHandleExt for tauri::AppHandle { } pub trait WindowExt { - fn restore_state(&self, show_mode: ShowMode) -> tauri::Result<()>; + fn restore_state(&self, flags: StateFlags) -> tauri::Result<()>; } impl WindowExt for Window { - fn restore_state(&self, show_mode: ShowMode) -> tauri::Result<()> { + fn restore_state(&self, flags: StateFlags) -> tauri::Result<()> { let cache = self.state::(); let mut c = cache.0.lock().unwrap(); let mut should_show = true; + if let Some(state) = c.get(self.label()) { - self.set_decorations(state.decorated)?; - - self.set_size(LogicalSize { - width: state.width, - height: state.height, - })?; - - // restore position to saved value if saved monitor exists - // otherwise, let the OS decide where to place the window - for m in self.available_monitors()? { - if m.contains((state.x, state.y).into()) { - self.set_position(PhysicalPosition { - x: state.x, - y: state.y, - })?; + if flags.contains(StateFlags::DECORATIONS) { + self.set_decorations(state.decorated)?; + } + + if flags.contains(StateFlags::SIZE) { + self.set_size(LogicalSize { + width: state.width, + height: state.height, + })?; + } + + if flags.contains(StateFlags::POSITION) { + // restore position to saved value if saved monitor exists + // otherwise, let the OS decide where to place the window + for m in self.available_monitors()? { + if m.contains((state.x, state.y).into()) { + self.set_position(PhysicalPosition { + x: state.x, + y: state.y, + })?; + } } } - if state.maximized { + if flags.contains(StateFlags::MAXIMIZED) && state.maximized { self.maximize()?; } - self.set_fullscreen(state.fullscreen)?; + + if flags.contains(StateFlags::FULLSCREEN) { + self.set_fullscreen(state.fullscreen)?; + } should_show = state.visible; } else { - let scale_factor = self - .current_monitor()? - .map(|m| m.scale_factor()) - .unwrap_or(1.); - let LogicalSize { width, height } = self.inner_size()?.to_logical(scale_factor); - let PhysicalPosition { x, y } = self.outer_position()?; - let maximized = self.is_maximized().unwrap_or(false); - let visible = self.is_visible().unwrap_or(true); - let decorated = self.is_decorated().unwrap_or(true); - let fullscreen = self.is_fullscreen().unwrap_or(false); + let LogicalSize { width, height } = match flags.contains(StateFlags::SIZE) { + true => { + let scale_factor = self + .current_monitor()? + .map(|m| m.scale_factor()) + .unwrap_or(1.); + self.inner_size()?.to_logical(scale_factor) + } + false => (0, 0).into(), + }; + + let PhysicalPosition { x, y } = match flags.contains(StateFlags::POSITION) { + true => self.outer_position()?, + false => (0, 0).into(), + }; + + let maximized = match flags.contains(StateFlags::MAXIMIZED) { + true => self.is_maximized().unwrap_or(false), + false => false, + }; + + let visible = match flags.contains(StateFlags::VISIBLE) { + true => self.is_visible().unwrap_or(true), + false => true, + }; + + let decorated = match flags.contains(StateFlags::DECORATIONS) { + true => self.is_visible().unwrap_or(true), + false => true, + }; + + let fullscreen = match flags.contains(StateFlags::FULLSCREEN) { + true => self.is_fullscreen().unwrap_or(false), + false => false, + }; + c.insert( self.label().into(), WindowMetadata { @@ -145,7 +182,7 @@ impl WindowExt for Window { ); } - if show_mode == ShowMode::Always || (show_mode == ShowMode::LastSaved && should_show) { + if flags.contains(StateFlags::VISIBLE) && should_show { self.show()?; self.set_focus()?; } @@ -156,17 +193,15 @@ impl WindowExt for Window { #[derive(Default)] pub struct Builder { - show_mode: ShowMode, denylist: HashSet, skip_initial_state: HashSet, + state_flags: StateFlags, } impl Builder { - /// Sets how the window visibility should be restored. - /// - /// The default is [`ShowMode::LastSaved`] - pub fn with_show_mode(mut self, show_mode: ShowMode) -> Self { - self.show_mode = show_mode; + /// Sets the state flags to control what state gets restored and saved. + pub fn with_state_flags(mut self, flags: StateFlags) -> Self { + self.state_flags = flags; self } @@ -212,59 +247,84 @@ impl Builder { } if !self.skip_initial_state.contains(window.label()) { - let _ = window.restore_state(self.show_mode); + let _ = window.restore_state(self.state_flags); } let cache = window.state::(); let cache = cache.0.clone(); let label = window.label().to_string(); let window_clone = window.clone(); + let flags = self.state_flags.clone(); window.on_window_event(move |e| match e { WindowEvent::Moved(position) => { let mut c = cache.lock().unwrap(); if let Some(state) = c.get_mut(&label) { - let is_maximized = window_clone.is_maximized().unwrap_or(false); - state.maximized = is_maximized; - - if let Some(monitor) = window_clone.current_monitor().unwrap() { - let monitor_position = monitor.position(); - // save only window positions that are inside the current monitor - if position.x > monitor_position.x - && position.y > monitor_position.y - && !is_maximized - { - state.x = position.x; - state.y = position.y; - }; - }; + if flags.intersects(StateFlags::MAXIMIZED | StateFlags::POSITION) { + let is_maximized = window_clone.is_maximized().unwrap_or(false); + + if flags.contains(StateFlags::MAXIMIZED) { + state.maximized = is_maximized; + } + + if flags.contains(StateFlags::POSITION) { + if let Some(monitor) = window_clone.current_monitor().unwrap() { + let monitor_position = monitor.position(); + // save only window positions that are inside the current monitor + if position.x > monitor_position.x + && position.y > monitor_position.y + && !is_maximized + { + state.x = position.x; + state.y = position.y; + } + } + } + } } } WindowEvent::Resized(size) => { - let scale_factor = window_clone - .current_monitor() - .ok() - .map(|m| m.map(|m| m.scale_factor()).unwrap_or(1.)) - .unwrap_or(1.); - let size = size.to_logical(scale_factor); let mut c = cache.lock().unwrap(); if let Some(state) = c.get_mut(&label) { - let is_maximized = window_clone.is_maximized().unwrap_or(false); - let is_fullscreen = window_clone.is_fullscreen().unwrap_or(false); - state.decorated = window_clone.is_decorated().unwrap_or(true); - state.maximized = is_maximized; - state.fullscreen = is_fullscreen; - - // It doesn't make sense to save a window with 0 height or width - if size.width > 0. && size.height > 0. && !is_maximized { - state.width = size.width; - state.height = size.height; + let is_maximized = + match flags.intersects(StateFlags::MAXIMIZED | StateFlags::SIZE) { + true => window_clone.is_maximized().unwrap_or(false), + false => false, + }; + + if flags.contains(StateFlags::MAXIMIZED) { + state.maximized = is_maximized; + } + + if flags.contains(StateFlags::FULLSCREEN) { + state.fullscreen = window_clone.is_fullscreen().unwrap_or(false); + } + + if flags.contains(StateFlags::DECORATIONS) { + state.decorated = window_clone.is_decorated().unwrap_or(true); + } + + if flags.contains(StateFlags::SIZE) { + let scale_factor = window_clone + .current_monitor() + .ok() + .map(|m| m.map(|m| m.scale_factor()).unwrap_or(1.)) + .unwrap_or(1.); + let size = size.to_logical(scale_factor); + + // It doesn't make sense to save a window with 0 height or width + if size.width > 0. && size.height > 0. && !is_maximized { + state.width = size.width; + state.height = size.height; + } } } } WindowEvent::CloseRequested { .. } => { let mut c = cache.lock().unwrap(); if let Some(state) = c.get_mut(&label) { - state.visible = window_clone.is_visible().unwrap_or(true); + if flags.contains(StateFlags::VISIBLE) { + state.visible = window_clone.is_visible().unwrap_or(true); + } } } _ => {} From 0abe028e88b0d8bb455adc29792e6553072f6a3d Mon Sep 17 00:00:00 2001 From: amrbashir Date: Mon, 23 Jan 2023 19:48:36 +0200 Subject: [PATCH 10/27] clippy --- plugins/window-state/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/window-state/src/lib.rs b/plugins/window-state/src/lib.rs index d9775f7a..16959453 100644 --- a/plugins/window-state/src/lib.rs +++ b/plugins/window-state/src/lib.rs @@ -254,7 +254,7 @@ impl Builder { let cache = cache.0.clone(); let label = window.label().to_string(); let window_clone = window.clone(); - let flags = self.state_flags.clone(); + let flags = self.state_flags; window.on_window_event(move |e| match e { WindowEvent::Moved(position) => { let mut c = cache.lock().unwrap(); From c41a1d072a42afe3195e036a3a929ad3b7b40b40 Mon Sep 17 00:00:00 2001 From: Amr Bashir Date: Mon, 23 Jan 2023 21:56:09 +0200 Subject: [PATCH 11/27] Restore Cargo.lock --- Cargo.lock | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e433e4ba..be0a39ba 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -235,7 +235,7 @@ checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ "hermit-abi 0.1.19", "libc", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -610,7 +610,7 @@ checksum = "f4ffc801dacf156c5854b9df4f425a626539c3a6ef7893cc0c5084a23f0b6c59" dependencies = [ "atty", "lazy_static", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -2458,7 +2458,7 @@ checksum = "f346ff70e7dbfd675fe90590b92d59ef2de15a8779ae305ebcbfd3f0caf59be4" dependencies = [ "autocfg", "bitflags", - "cfg-if", + "cfg-if 1.0.0", "libc", "memoffset", "pin-utils", @@ -3032,7 +3032,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22122d5ec4f9fe1b3916419b76be1e80bcb93f618d071d2edf841b137b2a2bd6" dependencies = [ "autocfg", - "cfg-if", + "cfg-if 1.0.0", "libc", "log", "wepoll-ffi", @@ -4435,7 +4435,6 @@ name = "tauri-plugin-window-state" version = "0.1.0" dependencies = [ "bincode", - "bitflags", "log", "serde", "serde_json", @@ -4870,7 +4869,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce65604324d3cce9b966701489fbd0cf318cb1f7bd9dd07ac9a4ee6fb791930d" dependencies = [ "tempfile", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -5599,7 +5598,7 @@ dependencies = [ "static_assertions", "tracing", "uds_windows", - "winapi", + "winapi 0.3.9", "zbus_macros", "zbus_names", "zvariant", From 1930a1aa8497a3acf6616134305d9c79456f2242 Mon Sep 17 00:00:00 2001 From: amrbashir Date: Mon, 23 Jan 2023 22:24:36 +0200 Subject: [PATCH 12/27] cleanup & defer saving state until `ClosedRequest` --- plugins/window-state/src/lib.rs | 215 ++++++++++++++------------------ 1 file changed, 96 insertions(+), 119 deletions(-) diff --git a/plugins/window-state/src/lib.rs b/plugins/window-state/src/lib.rs index 16959453..fc436b0d 100644 --- a/plugins/window-state/src/lib.rs +++ b/plugins/window-state/src/lib.rs @@ -51,7 +51,7 @@ impl Default for StateFlags { } #[derive(Debug, Default, Deserialize, Serialize)] -struct WindowMetadata { +struct WindowState { width: f64, height: f64, x: i32, @@ -62,7 +62,7 @@ struct WindowMetadata { fullscreen: bool, } -struct WindowStateCache(Arc>>); +struct WindowStateCache(Arc>>); pub trait AppHandleExt { fn save_window_state(&self) -> Result<()>; } @@ -131,55 +131,41 @@ impl WindowExt for Window { should_show = state.visible; } else { - let LogicalSize { width, height } = match flags.contains(StateFlags::SIZE) { - true => { - let scale_factor = self - .current_monitor()? - .map(|m| m.scale_factor()) - .unwrap_or(1.); - self.inner_size()?.to_logical(scale_factor) - } - false => (0, 0).into(), - }; - - let PhysicalPosition { x, y } = match flags.contains(StateFlags::POSITION) { - true => self.outer_position()?, - false => (0, 0).into(), - }; - - let maximized = match flags.contains(StateFlags::MAXIMIZED) { - true => self.is_maximized().unwrap_or(false), - false => false, - }; - - let visible = match flags.contains(StateFlags::VISIBLE) { - true => self.is_visible().unwrap_or(true), - false => true, - }; - - let decorated = match flags.contains(StateFlags::DECORATIONS) { - true => self.is_visible().unwrap_or(true), - false => true, - }; - - let fullscreen = match flags.contains(StateFlags::FULLSCREEN) { - true => self.is_fullscreen().unwrap_or(false), - false => false, - }; - - c.insert( - self.label().into(), - WindowMetadata { - width, - height, - x, - y, - maximized, - visible, - decorated, - fullscreen, - }, - ); + let mut metadata = WindowState::default(); + + if flags.contains(StateFlags::SIZE) { + let scale_factor = self + .current_monitor()? + .map(|m| m.scale_factor()) + .unwrap_or(1.); + let size = self.inner_size()?.to_logical(scale_factor); + metadata.width = size.width; + metadata.height = size.height; + } + + if flags.contains(StateFlags::POSITION) { + let pos = self.outer_position()?; + metadata.x = pos.x; + metadata.y = pos.y; + } + + if flags.contains(StateFlags::MAXIMIZED) { + metadata.maximized = self.is_maximized()?; + } + + if flags.contains(StateFlags::VISIBLE) { + metadata.visible = self.is_visible()?; + } + + if flags.contains(StateFlags::DECORATIONS) { + metadata.visible = self.is_visible()?; + } + + if flags.contains(StateFlags::FULLSCREEN) { + metadata.fullscreen = self.is_fullscreen()?; + } + + c.insert(self.label().into(), metadata); } if flags.contains(StateFlags::VISIBLE) && should_show { @@ -191,6 +177,62 @@ impl WindowExt for Window { } } +trait WindowExtInternal { + fn update_state(&self, state: &mut WindowState, flags: StateFlags) -> tauri::Result<()>; +} + +impl WindowExtInternal for Window { + fn update_state(&self, state: &mut WindowState, flags: StateFlags) -> tauri::Result<()> { + let is_maximized = match flags.intersects(StateFlags::MAXIMIZED | StateFlags::SIZE) { + true => self.is_maximized()?, + false => false, + }; + + if flags.contains(StateFlags::MAXIMIZED) { + state.maximized = is_maximized; + } + + if flags.contains(StateFlags::FULLSCREEN) { + state.fullscreen = self.is_fullscreen()?; + } + + if flags.contains(StateFlags::DECORATIONS) { + state.decorated = self.is_decorated()?; + } + + if flags.contains(StateFlags::VISIBLE) { + state.visible = self.is_visible()?; + } + + if flags.contains(StateFlags::SIZE) { + let scale_factor = self + .current_monitor()? + .map(|m| m.scale_factor()) + .unwrap_or(1.); + let size = self.inner_size()?.to_logical(scale_factor); + + // It doesn't make sense to save a self with 0 height or width + if size.width > 0. && size.height > 0. && !is_maximized { + state.width = size.width; + state.height = size.height; + } + } + + if flags.contains(StateFlags::POSITION) { + let position = self.inner_position()?; + if let Ok(Some(monitor)) = self.current_monitor() { + // save only window positions that are inside the current monitor + if monitor.contains(position) && !is_maximized { + state.x = position.x; + state.y = position.y; + } + } + } + + Ok(()) + } +} + #[derive(Default)] pub struct Builder { denylist: HashSet, @@ -221,7 +263,7 @@ impl Builder { pub fn build(self) -> TauriPlugin { PluginBuilder::new("window-state") .setup(|app| { - let cache: Arc>> = if let Some(app_dir) = + let cache: Arc>> = if let Some(app_dir) = app.path_resolver().app_config_dir() { let state_path = app_dir.join(STATE_FILENAME); @@ -256,75 +298,10 @@ impl Builder { let window_clone = window.clone(); let flags = self.state_flags; window.on_window_event(move |e| match e { - WindowEvent::Moved(position) => { - let mut c = cache.lock().unwrap(); - if let Some(state) = c.get_mut(&label) { - if flags.intersects(StateFlags::MAXIMIZED | StateFlags::POSITION) { - let is_maximized = window_clone.is_maximized().unwrap_or(false); - - if flags.contains(StateFlags::MAXIMIZED) { - state.maximized = is_maximized; - } - - if flags.contains(StateFlags::POSITION) { - if let Some(monitor) = window_clone.current_monitor().unwrap() { - let monitor_position = monitor.position(); - // save only window positions that are inside the current monitor - if position.x > monitor_position.x - && position.y > monitor_position.y - && !is_maximized - { - state.x = position.x; - state.y = position.y; - } - } - } - } - } - } - WindowEvent::Resized(size) => { - let mut c = cache.lock().unwrap(); - if let Some(state) = c.get_mut(&label) { - let is_maximized = - match flags.intersects(StateFlags::MAXIMIZED | StateFlags::SIZE) { - true => window_clone.is_maximized().unwrap_or(false), - false => false, - }; - - if flags.contains(StateFlags::MAXIMIZED) { - state.maximized = is_maximized; - } - - if flags.contains(StateFlags::FULLSCREEN) { - state.fullscreen = window_clone.is_fullscreen().unwrap_or(false); - } - - if flags.contains(StateFlags::DECORATIONS) { - state.decorated = window_clone.is_decorated().unwrap_or(true); - } - - if flags.contains(StateFlags::SIZE) { - let scale_factor = window_clone - .current_monitor() - .ok() - .map(|m| m.map(|m| m.scale_factor()).unwrap_or(1.)) - .unwrap_or(1.); - let size = size.to_logical(scale_factor); - - // It doesn't make sense to save a window with 0 height or width - if size.width > 0. && size.height > 0. && !is_maximized { - state.width = size.width; - state.height = size.height; - } - } - } - } WindowEvent::CloseRequested { .. } => { let mut c = cache.lock().unwrap(); - if let Some(state) = c.get_mut(&label) { - if flags.contains(StateFlags::VISIBLE) { - state.visible = window_clone.is_visible().unwrap_or(true); - } + if let Some(mut state) = c.get_mut(&label) { + let _ = window_clone.update_state(&mut state, flags); } } _ => {} From b02c7e15f94129893eef900f7a6f49641d305ef0 Mon Sep 17 00:00:00 2001 From: amrbashir Date: Mon, 23 Jan 2023 22:33:29 +0200 Subject: [PATCH 13/27] clippy lints --- plugins/single-instance/src/platform_impl/windows.rs | 4 ++-- plugins/window-state/src/lib.rs | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/plugins/single-instance/src/platform_impl/windows.rs b/plugins/single-instance/src/platform_impl/windows.rs index a4eadab4..c4fd7af7 100644 --- a/plugins/single-instance/src/platform_impl/windows.rs +++ b/plugins/single-instance/src/platform_impl/windows.rs @@ -113,10 +113,10 @@ unsafe extern "system" fn single_instance_window_proc( let cds_ptr = lparam as *const COPYDATASTRUCT; if (*cds_ptr).dwData == WMCOPYDATA_SINGLE_INSTANCE_DATA { let data = CStr::from_ptr((*cds_ptr).lpData as _).to_string_lossy(); - let mut s = data.split("|"); + let mut s = data.split('|'); let cwd = s.next().unwrap(); let args = s.into_iter().map(|s| s.to_string()).collect(); - callback(&app_handle, args, cwd.to_string()); + callback(app_handle, args, cwd.to_string()); } 1 } diff --git a/plugins/window-state/src/lib.rs b/plugins/window-state/src/lib.rs index fc436b0d..200cf9d7 100644 --- a/plugins/window-state/src/lib.rs +++ b/plugins/window-state/src/lib.rs @@ -297,14 +297,13 @@ impl Builder { let label = window.label().to_string(); let window_clone = window.clone(); let flags = self.state_flags; - window.on_window_event(move |e| match e { - WindowEvent::CloseRequested { .. } => { + window.on_window_event(move |e| { + if let WindowEvent::CloseRequested { .. } = e { let mut c = cache.lock().unwrap(); - if let Some(mut state) = c.get_mut(&label) { - let _ = window_clone.update_state(&mut state, flags); + if let Some(state) = c.get_mut(&label) { + let _ = window_clone.update_state(state, flags); } } - _ => {} }); }) .on_event(|app, event| { From 4c6255d34f951affb6395f4960dc659c0d5a8ae5 Mon Sep 17 00:00:00 2001 From: Amr Bashir Date: Wed, 25 Jan 2023 19:09:14 +0200 Subject: [PATCH 14/27] fix(window-state): update state before saving (#111) * fix(windows-state): update state before saving regression introduced in #104 * update readme * don't panic on non-existing windows * Restore Cargo.lock --- plugins/window-state/README.md | 8 ++++---- plugins/window-state/src/lib.rs | 17 ++++++++++++----- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/plugins/window-state/README.md b/plugins/window-state/README.md index de309e73..aa9aa865 100644 --- a/plugins/window-state/README.md +++ b/plugins/window-state/README.md @@ -39,19 +39,19 @@ Afterwards all windows will remember their state when the app is being closed an Optionally you can also tell the plugin to save the state of all open window to disk my using the `save_window_state()` method exposed by the `AppHandleExt` trait: ```rust -use tauri_plugin_window_state::AppHandleExt; +use tauri_plugin_window_state::{AppHandleExt, StateFlags}; // `tauri::AppHandle` now has the following additional method -app.save_window_state(); // will save the state of all open windows to disk +app.save_window_state(StateFlags::all()); // will save the state of all open windows to disk ``` To manually restore a windows state from disk you can call the `restore_state()` method exposed by the `WindowExt` trait: ```rust -use tauri_plugin_window_state::{WindowExt, ShowMode}; +use tauri_plugin_window_state::{WindowExt, StateFlags}; // all `Window` types now have the following additional method -window.restore_state(ShowMode::LastSaved); // will restore the windows state from disk +window.restore_state(StateFlags::all()); // will restore the windows state from disk ``` ## Contributing diff --git a/plugins/window-state/src/lib.rs b/plugins/window-state/src/lib.rs index 200cf9d7..2c82c1a3 100644 --- a/plugins/window-state/src/lib.rs +++ b/plugins/window-state/src/lib.rs @@ -64,15 +64,21 @@ struct WindowState { struct WindowStateCache(Arc>>); pub trait AppHandleExt { - fn save_window_state(&self) -> Result<()>; + fn save_window_state(&self, flags: StateFlags) -> Result<()>; } impl AppHandleExt for tauri::AppHandle { - fn save_window_state(&self) -> Result<()> { + fn save_window_state(&self, flags: StateFlags) -> Result<()> { if let Some(app_dir) = self.path_resolver().app_config_dir() { let state_path = app_dir.join(STATE_FILENAME); let cache = self.state::(); - let state = cache.0.lock().unwrap(); + let mut state = cache.0.lock().unwrap(); + for (label, s) in state.iter_mut() { + if let Some(window) = self.get_window(label) { + window.update_state(s, flags)?; + } + } + create_dir_all(&app_dir) .map_err(Error::Io) .and_then(|_| File::create(state_path).map_err(Into::into)) @@ -261,6 +267,7 @@ impl Builder { } pub fn build(self) -> TauriPlugin { + let flags = self.state_flags; PluginBuilder::new("window-state") .setup(|app| { let cache: Arc>> = if let Some(app_dir) = @@ -306,9 +313,9 @@ impl Builder { } }); }) - .on_event(|app, event| { + .on_event(move |app, event| { if let RunEvent::Exit = event { - let _ = app.save_window_state(); + let _ = app.save_window_state(flags); } }) .build() From ba81e865b2169a3c9c17477db27b3bd3d554e4b6 Mon Sep 17 00:00:00 2001 From: Fabian-Lars Date: Thu, 26 Jan 2023 11:53:41 +0100 Subject: [PATCH 15/27] feat(sql): Handle `JSON` columns as `TEXT` columns and return content as string, closes #112 (#113) --- plugins/sql/src/plugin.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/sql/src/plugin.rs b/plugins/sql/src/plugin.rs index 48d2e241..e7deb885 100644 --- a/plugins/sql/src/plugin.rs +++ b/plugins/sql/src/plugin.rs @@ -251,7 +251,7 @@ async fn select( JsonValue::Null } else { match info.name() { - "VARCHAR" | "STRING" | "TEXT" | "DATETIME" => { + "VARCHAR" | "STRING" | "TEXT" | "DATETIME" | "JSON" => { if let Ok(s) = row.try_get(i) { JsonValue::String(s) } else { From 7cfea6be3f2d119601d37171bb01c9118a3e53d2 Mon Sep 17 00:00:00 2001 From: Fabian-Lars Date: Sun, 29 Jan 2023 10:00:38 +0100 Subject: [PATCH 16/27] Update renovate.json (#110) --- renovate.json | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/renovate.json b/renovate.json index 4dac52b1..a7360f17 100644 --- a/renovate.json +++ b/renovate.json @@ -1,4 +1,12 @@ { "extends": ["config:base"], - "enabledManagers": ["cargo", "npm"] + "enabledManagers": ["cargo", "npm"], + "packageRules": [ + { + "description": "Disable node/pnpm version updates", + "matchPackageNames": ["node", "pnpm"], + "matchDepTypes": ["engines", "packageManager"], + "enabled": false + } + ] } From 526f1fcb8518e87e719a45db43614f4dcd8e3065 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 29 Jan 2023 10:01:56 +0100 Subject: [PATCH 17/27] chore(deps): update dependency eslint-config-standard-with-typescript to v33 (#115) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- package.json | 2 +- pnpm-lock.yaml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 56ec54f6..704e0a45 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "@typescript-eslint/parser": "^5.46.1", "eslint": "^8.0.1", "eslint-config-prettier": "^8.5.0", - "eslint-config-standard-with-typescript": "^31.0.0", + "eslint-config-standard-with-typescript": "^33.0.0", "eslint-plugin-import": "^2.25.2", "eslint-plugin-n": "^15.0.0", "eslint-plugin-promise": "^6.0.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8a5e7f63..4b570b32 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,7 +11,7 @@ importers: '@typescript-eslint/parser': ^5.46.1 eslint: ^8.0.1 eslint-config-prettier: ^8.5.0 - eslint-config-standard-with-typescript: ^31.0.0 + eslint-config-standard-with-typescript: ^33.0.0 eslint-plugin-import: ^2.25.2 eslint-plugin-n: ^15.0.0 eslint-plugin-promise: ^6.0.0 @@ -26,7 +26,7 @@ importers: '@typescript-eslint/parser': 5.46.1_ha6vam6werchizxrnqvarmz2zu eslint: 8.29.0 eslint-config-prettier: 8.5.0_eslint@8.29.0 - eslint-config-standard-with-typescript: 31.0.0_f7skxvi3ubnnb5utlsc5vholvm + eslint-config-standard-with-typescript: 33.0.0_f7skxvi3ubnnb5utlsc5vholvm eslint-plugin-import: 2.26.0_z7hwuz3w5sq2sbhy7d4iqrnsvq eslint-plugin-n: 15.6.0_eslint@8.29.0 eslint-plugin-promise: 6.1.1_eslint@8.29.0 @@ -1218,8 +1218,8 @@ packages: eslint: 8.29.0 dev: true - /eslint-config-standard-with-typescript/31.0.0_f7skxvi3ubnnb5utlsc5vholvm: - resolution: {integrity: sha512-FLTrcJR62gPPPFwwverxwDTcQDb4HOCfDqmELZgNMSbh1M/Ui36X47a9ZANeo3iuPhMOfvrfuShChW9chdasnA==} + /eslint-config-standard-with-typescript/33.0.0_f7skxvi3ubnnb5utlsc5vholvm: + resolution: {integrity: sha512-HOLmCMF91yYizfEms00jkmEoKvCCEIUOO6ArGZ9BNYL8yczF23fz/orsG6pN84f97cfo8c0kdREHzEO+uMA2zw==} peerDependencies: '@typescript-eslint/eslint-plugin': ^5.0.0 eslint: ^8.0.1 From 61bdf04bc80f5cc1b65c00e028e682c43787e358 Mon Sep 17 00:00:00 2001 From: Bryan Lee <38807139+liby@users.noreply.github.com> Date: Mon, 30 Jan 2023 17:43:57 +0800 Subject: [PATCH 18/27] docs: fix typo (#117) --- plugins/window-state/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/window-state/README.md b/plugins/window-state/README.md index aa9aa865..de86ae9e 100644 --- a/plugins/window-state/README.md +++ b/plugins/window-state/README.md @@ -1,6 +1,6 @@ ![plugin-window-state](banner.png) -Save window positions and sizse and restore them when the app is reopened. +Save window positions and sizes and restore them when the app is reopened. ## Install From 2e515abba73e04e2de035b64b8fd10f820f9954e Mon Sep 17 00:00:00 2001 From: Jonas Kruckenberg Date: Wed, 1 Feb 2023 10:28:36 +0100 Subject: [PATCH 19/27] fix: Bump MSRV to 1.64 (#119) Bumps the MSRV to 1.64 since that's the version that introduced the workspace inheritance we are using here. --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index fc6c8ed9..94a7e79d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,4 +14,4 @@ thiserror = "1" edition = "2021" authors = [ "Tauri Programme within The Commons Conservancy" ] license = "Apache-2.0 OR MIT" -rust-version = "1.59" \ No newline at end of file +rust-version = "1.64" From 4bb200aac57eea9b20542063469482c216578b9d Mon Sep 17 00:00:00 2001 From: Fabian-Lars Date: Wed, 1 Feb 2023 11:27:33 +0100 Subject: [PATCH 20/27] fix: apply clippy suggestions (#120) * fix: apply clippy suggestions * fmt * clippy for linux targets --- Cargo.lock | 352 ++++++++++-------- plugins/authenticator/src/auth.rs | 8 +- plugins/authenticator/src/u2f.rs | 2 +- plugins/fs-watch/src/lib.rs | 4 +- plugins/localhost/src/lib.rs | 4 +- plugins/log/src/lib.rs | 2 +- .../src/platform_impl/linux.rs | 4 +- .../src/platform_impl/windows.rs | 6 +- 8 files changed, 212 insertions(+), 170 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index be0a39ba..75568883 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -168,9 +168,9 @@ dependencies = [ [[package]] name = "async-recursion" -version = "1.0.0" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cda8f4bcc10624c4e85bc66b3f452cca98cfa5ca002dc83a16aad2367641bea" +checksum = "3b015a331cc64ebd1774ba119538573603427eaace0a1950c423ab971f903796" dependencies = [ "proc-macro2", "quote", @@ -185,9 +185,9 @@ checksum = "7a40729d2133846d9ed0ea60a8b9541bccddab49cd30f0715a1da672fe9a2524" [[package]] name = "async-trait" -version = "0.1.61" +version = "0.1.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "705339e0e4a9690e2908d2b3d049d85682cf19fbd5782494498fbf7003a6a282" +checksum = "1cd7fce9ba8c3c042128ce72d8b2ddbf3a05747efb67ea0313c635e10bda47a2" dependencies = [ "proc-macro2", "quote", @@ -235,7 +235,7 @@ checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ "hermit-abi 0.1.19", "libc", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -368,9 +368,9 @@ dependencies = [ [[package]] name = "brotli-decompressor" -version = "2.3.2" +version = "2.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59ad2d4653bf5ca36ae797b1f4bb4dbddb60ce49ca4aed8a2ce4829f60425b80" +checksum = "4b6561fd3f895a11e8f72af2cb7d22e08366bebc2b6b57f7744c4bda27034744" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", @@ -388,9 +388,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.11.1" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba" +checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" [[package]] name = "byte-unit" @@ -404,9 +404,9 @@ dependencies = [ [[package]] name = "bytemuck" -version = "1.12.3" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aaa3a8d9a1ca92e282c96a32d6511b695d7d994d1d102ba85d279f9b2756947f" +checksum = "c041d3eab048880cb0b86b256447da3f18859a163c3b8d8893f4e6368abe6393" [[package]] name = "byteorder" @@ -426,9 +426,9 @@ dependencies = [ [[package]] name = "bytes" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c" +checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" [[package]] name = "cairo-rs" @@ -456,9 +456,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.78" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d" +checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" [[package]] name = "cesu8" @@ -610,7 +610,7 @@ checksum = "f4ffc801dacf156c5854b9df4f425a626539c3a6ef7893cc0c5084a23f0b6c59" dependencies = [ "atty", "lazy_static", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -619,15 +619,15 @@ version = "4.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4" dependencies = [ - "bytes 1.3.0", + "bytes 1.4.0", "memchr", ] [[package]] name = "concurrent-queue" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd7bef69dc86e3c610e4e7aed41035e2a7ed12e72dd7530f61327a6579a4390b" +checksum = "c278839b831783b70278b14df4d45e1beb1aad306c07bb796637de9a0e323e8e" dependencies = [ "crossbeam-utils", ] @@ -702,9 +702,9 @@ dependencies = [ [[package]] name = "crc" -version = "3.0.0" +version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53757d12b596c16c78b83458d732a5d1a17ab3f53f2f7412f6fb57cc8a140ab3" +checksum = "86ec7a15cbe22e59248fc7eadb1907dab5ba09372595da4d73dd805ed4417dfe" dependencies = [ "crc-catalog", ] @@ -840,9 +840,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.86" +version = "1.0.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51d1075c37807dcf850c379432f0df05ba52cc30f279c5cfc43cc221ce7f8579" +checksum = "322296e2f2e5af4270b54df9e85a02ff037e271af20ba3e7fe1575515dc840b8" dependencies = [ "cc", "cxxbridge-flags", @@ -852,9 +852,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.86" +version = "1.0.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5044281f61b27bc598f2f6647d480aed48d2bf52d6eb0b627d84c0361b17aa70" +checksum = "017a1385b05d631e7875b1f151c9f012d37b53491e2a87f65bff5c262b2111d8" dependencies = [ "cc", "codespan-reporting", @@ -867,15 +867,15 @@ dependencies = [ [[package]] name = "cxxbridge-flags" -version = "1.0.86" +version = "1.0.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61b50bc93ba22c27b0d31128d2d130a0a6b3d267ae27ef7e4fae2167dfe8781c" +checksum = "c26bbb078acf09bc1ecda02d4223f03bdd28bd4874edcb0379138efc499ce971" [[package]] name = "cxxbridge-macro" -version = "1.0.86" +version = "1.0.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e61fda7e62115119469c7b3591fd913ecca96fb766cfd3f2e2502ab7bc87a5" +checksum = "357f40d1f06a24b60ae1fe122542c1fb05d28d32acb2aed064e84bc2ad1e252e" dependencies = [ "proc-macro2", "quote", @@ -1072,9 +1072,9 @@ dependencies = [ [[package]] name = "either" -version = "1.8.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" +checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" [[package]] name = "embed_plist" @@ -1232,9 +1232,9 @@ dependencies = [ [[package]] name = "futures" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38390104763dc37a5145a53c29c63c1290b5d316d6086ec32c293f6736051bb0" +checksum = "13e2792b0ff0340399d58445b88fd9770e3489eff258a4cbc1523418f12abf84" dependencies = [ "futures-channel", "futures-core", @@ -1247,9 +1247,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed" +checksum = "2e5317663a9089767a1ec00a487df42e0ca174b61b4483213ac24448e4664df5" dependencies = [ "futures-core", "futures-sink", @@ -1257,15 +1257,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac" +checksum = "ec90ff4d0fe1f57d600049061dc6bb68ed03c7d2fbd697274c41805dcb3f8608" [[package]] name = "futures-executor" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7acc85df6714c176ab5edf386123fafe217be88c0840ec11f199441134a074e2" +checksum = "e8de0a35a6ab97ec8869e32a2473f4b1324459e14c29275d14b10cb1fd19b50e" dependencies = [ "futures-core", "futures-task", @@ -1285,9 +1285,9 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb" +checksum = "bfb8371b6fb2aeb2d280374607aeabfc99d95c72edfe51692e42d3d7f0d08531" [[package]] name = "futures-lite" @@ -1306,9 +1306,9 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d" +checksum = "95a73af87da33b5acf53acfebdc339fe592ecf5357ac7c0a7734ab9d8c876a70" dependencies = [ "proc-macro2", "quote", @@ -1317,21 +1317,21 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9" +checksum = "f310820bb3e8cfd46c80db4d7fb8353e15dfff853a127158425f31e0be6c8364" [[package]] name = "futures-task" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea" +checksum = "dcf79a1bf610b10f42aea489289c5a2c478a786509693b80cd39c44ccd936366" [[package]] name = "futures-util" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6" +checksum = "9c1d6de3acfef38d2be4b1f543f553131788603495be83da675e180c8d6b7bd1" dependencies = [ "futures-channel", "futures-core", @@ -1649,7 +1649,7 @@ version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f9f29bc9dda355256b2916cf526ab02ce0aeaaaf2bad60d65ef3f12f11dd0f4" dependencies = [ - "bytes 1.3.0", + "bytes 1.4.0", "fnv", "futures-core", "futures-sink", @@ -1760,7 +1760,7 @@ version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" dependencies = [ - "bytes 1.3.0", + "bytes 1.4.0", "fnv", "itoa 1.0.5", ] @@ -1771,7 +1771,7 @@ version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" dependencies = [ - "bytes 1.3.0", + "bytes 1.4.0", "http", "pin-project-lite", ] @@ -1800,7 +1800,7 @@ version = "0.14.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "034711faac9d2166cb1baf1a2fb0b60b1f277f8492fd72176c17f3515e1abd3c" dependencies = [ - "bytes 1.3.0", + "bytes 1.4.0", "futures-channel", "futures-core", "futures-util", @@ -1824,7 +1824,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ - "bytes 1.3.0", + "bytes 1.4.0", "hyper", "native-tls", "tokio", @@ -1883,10 +1883,11 @@ dependencies = [ [[package]] name = "ignore" -version = "0.4.19" +version = "0.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a05705bc64e0b66a806c3740bd6578ea66051b157ec42dc219c785cbf185aef3" +checksum = "713f1b139373f96a2e0ce3ac931cd01ee973c3c5dd7c40c0c2efe96ad2b6751d" dependencies = [ + "crossbeam-utils", "globset", "lazy_static", "log", @@ -2325,9 +2326,9 @@ dependencies = [ [[package]] name = "matches" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" +checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" [[package]] name = "md-5" @@ -2458,7 +2459,7 @@ checksum = "f346ff70e7dbfd675fe90590b92d59ef2de15a8779ae305ebcbfd3f0caf59be4" dependencies = [ "autocfg", "bitflags", - "cfg-if 1.0.0", + "cfg-if", "libc", "memoffset", "pin-utils", @@ -2472,19 +2473,28 @@ checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" [[package]] name = "nom" -version = "7.1.2" +version = "7.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5507769c4919c998e69e49c839d9dc6e693ede4cc4290d6ad8b41d4f09c548c" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" dependencies = [ "memchr", "minimal-lexical", ] +[[package]] +name = "nom8" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae01545c9c7fc4486ab7debaf2aad7003ac19431791868fb2e8066df97fad2f8" +dependencies = [ + "memchr", +] + [[package]] name = "notify" -version = "5.0.0" +version = "5.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed2c66da08abae1c024c01d635253e402341b4060a12e99b31c7594063bf490a" +checksum = "58ea850aa68a06e48fdb069c0ec44d0d64c8dbffa49bf3b6f7f0a901fdea1ba9" dependencies = [ "bitflags", "crossbeam-channel", @@ -2496,7 +2506,7 @@ dependencies = [ "mio", "serde", "walkdir", - "winapi", + "windows-sys", ] [[package]] @@ -2602,18 +2612,18 @@ dependencies = [ [[package]] name = "num_enum" -version = "0.5.7" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf5395665662ef45796a4ff5486c5d41d29e0c09640af4c5f17fd94ee2c119c9" +checksum = "8d829733185c1ca374f17e52b762f24f535ec625d2cc1f070e34c8a9068f341b" dependencies = [ "num_enum_derive", ] [[package]] name = "num_enum_derive" -version = "0.5.7" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b0498641e53dd6ac1a4f22547548caa6864cc4933784319cd1775271c5a46ce" +checksum = "2be1598bf1c313dcdd12092e3f1920f463462525a21b7b4e11b4168353d0123e" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2708,9 +2718,9 @@ dependencies = [ [[package]] name = "ordered-stream" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4eb9ba3f3e42dbdd3b7b122de5ca169c81e93d561eb900da3a8c99bcfcf381a" +checksum = "360a24bdacdb7801a1a6af8500392864791c130ebe8bd9a063158cab00040c90" dependencies = [ "futures-core", "pin-project-lite", @@ -2833,9 +2843,9 @@ checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" [[package]] name = "pest" -version = "2.5.3" +version = "2.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4257b4a04d91f7e9e6290be5d3da4804dd5784fafde3a497d73eb2b4a158c30a" +checksum = "4ab62d2fa33726dbe6321cc97ef96d8cde531e3eeaf858a058de53a8a6d40d8f" dependencies = [ "thiserror", "ucd-trie", @@ -3001,16 +3011,16 @@ checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" [[package]] name = "plist" -version = "1.3.1" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd39bc6cdc9355ad1dc5eeedefee696bb35c34caf21768741e81826c0bbd7225" +checksum = "5329b8f106a176ab0dce4aae5da86bfcb139bb74fb00882859e03745011f3635" dependencies = [ "base64 0.13.1", "indexmap", "line-wrap", + "quick-xml", "serde", "time 0.3.17", - "xml-rs", ] [[package]] @@ -3032,7 +3042,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22122d5ec4f9fe1b3916419b76be1e80bcb93f618d071d2edf841b137b2a2bd6" dependencies = [ "autocfg", - "cfg-if 1.0.0", + "cfg-if", "libc", "log", "wepoll-ffi", @@ -3076,13 +3086,12 @@ checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" [[package]] name = "proc-macro-crate" -version = "1.2.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eda0fc3b0fb7c975631757e14d9049da17374063edb6ebbcbc54d880d4fe94e9" +checksum = "66618389e4ec1c7afe67d51a9bf34ff9236480f8d51e7489b7d5ab0303c13f34" dependencies = [ "once_cell", - "thiserror", - "toml", + "toml_edit", ] [[package]] @@ -3117,9 +3126,9 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" [[package]] name = "proc-macro2" -version = "1.0.49" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5" +checksum = "6ef7d57beacfaf2d8aee5937dab7b7f28de3cb8b1828479bb5de2a7106f2bae2" dependencies = [ "unicode-ident", ] @@ -3130,6 +3139,15 @@ version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" +[[package]] +name = "quick-xml" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f50b1c63b38611e7d4d7f68b82d3ad0cc71a2ad2e7f61fc10f1328d917c93cd" +dependencies = [ + "memchr", +] + [[package]] name = "quote" version = "1.0.23" @@ -3235,7 +3253,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6435842fc2fea44b528719eb8c32203bbc1bb2f5b619fbe0c0a3d8350fd8d2a8" dependencies = [ - "bytes 1.3.0", + "bytes 1.4.0", "futures", "pin-project-lite", ] @@ -3297,12 +3315,12 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.13" +version = "0.11.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68cc60575865c7831548863cc02356512e3f1dc2f3f82cb837d7fc4cc8f3c97c" +checksum = "21eed90ec8570952d53b772ecf8f206aa1ec9a3d76b2521c56c42973f2d91ee9" dependencies = [ - "base64 0.13.1", - "bytes 1.3.0", + "base64 0.21.0", + "bytes 1.4.0", "encoding_rs", "futures-core", "futures-util", @@ -3329,6 +3347,7 @@ dependencies = [ "url", "wasm-bindgen", "wasm-bindgen-futures", + "wasm-streams", "web-sys", "winreg", ] @@ -3406,9 +3425,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.20.7" +version = "0.20.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "539a2bfe908f471bfa933876bd1eb6a19cf2176d375f82ef7f99530a40e48c2c" +checksum = "fff78fc74d175294f4e83b28343315ffcfb114b156f0185e9741cb5570f50e2f" dependencies = [ "log", "ring", @@ -3503,9 +3522,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.7.0" +version = "2.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bc1bb97804af6631813c55739f771071e0f2ed33ee20b68c86ec505d906356c" +checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254" dependencies = [ "bitflags", "core-foundation", @@ -3516,9 +3535,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.6.1" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0160a13a177a45bfb43ce71c01580998474f556ad854dcbca936dd2841a5c556" +checksum = "31c9bb296072e961fcbd8853511dd39c2d8be2deb1e17c6860b1d30732b323b4" dependencies = [ "core-foundation-sys", "libc", @@ -3809,9 +3828,9 @@ dependencies = [ [[package]] name = "sqlformat" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f87e292b4291f154971a43c3774364e2cbcaec599d3f5bf6fa9d122885dbc38a" +checksum = "0c12bc9199d1db8234678b7051747c07f517cdcf019262d1847b94ec8b1aee3e" dependencies = [ "itertools", "nom", @@ -3839,7 +3858,7 @@ dependencies = [ "base64 0.13.1", "bitflags", "byteorder", - "bytes 1.3.0", + "bytes 1.4.0", "crc", "crossbeam-queue", "digest 0.10.6", @@ -4137,7 +4156,7 @@ dependencies = [ "scopeguard", "serde", "unicode-segmentation", - "uuid 1.2.2", + "uuid 1.3.0", "windows 0.39.0", "windows-implement", "x11-dl", @@ -4156,9 +4175,9 @@ dependencies = [ [[package]] name = "tauri" -version = "1.2.3" +version = "1.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b48820ee3bb6a5031a83b2b6e11f8630bdc5a2f68cb841ab8ebc7a15a916679" +checksum = "fe7e0f1d535e7cbbbab43c82be4fc992b84f9156c16c160955617e0260ebc449" dependencies = [ "anyhow", "cocoa", @@ -4193,7 +4212,7 @@ dependencies = [ "thiserror", "tokio", "url", - "uuid 1.2.2", + "uuid 1.3.0", "webkit2gtk", "webview2-com", "windows 0.39.0", @@ -4220,7 +4239,7 @@ dependencies = [ "tauri-utils", "thiserror", "time 0.3.17", - "uuid 1.2.2", + "uuid 1.3.0", "walkdir", ] @@ -4435,6 +4454,7 @@ name = "tauri-plugin-window-state" version = "0.1.0" dependencies = [ "bincode", + "bitflags", "log", "serde", "serde_json", @@ -4457,7 +4477,7 @@ dependencies = [ "serde_json", "tauri-utils", "thiserror", - "uuid 1.2.2", + "uuid 1.3.0", "webview2-com", "windows 0.39.0", ] @@ -4475,7 +4495,7 @@ dependencies = [ "raw-window-handle", "tauri-runtime", "tauri-utils", - "uuid 1.2.2", + "uuid 1.3.0", "webkit2gtk", "webview2-com", "windows 0.39.0", @@ -4537,9 +4557,9 @@ dependencies = [ [[package]] name = "termcolor" -version = "1.1.3" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" +checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" dependencies = [ "winapi-util", ] @@ -4646,12 +4666,12 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.24.1" +version = "1.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d9f76183f91ecfb55e1d7d5602bd1d979e38a3a522fe900241cf195624d67ae" +checksum = "c8e00990ebabbe4c14c08aca901caed183ecd5c09562a12c824bb53d3c3fd3af" dependencies = [ "autocfg", - "bytes 1.3.0", + "bytes 1.4.0", "libc", "memchr", "mio", @@ -4713,7 +4733,7 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bb2e075f03b3d66d8d8785356224ba688d2906a371015e225beeb65ca92c740" dependencies = [ - "bytes 1.3.0", + "bytes 1.4.0", "futures-core", "futures-sink", "pin-project-lite", @@ -4723,13 +4743,30 @@ dependencies = [ [[package]] name = "toml" -version = "0.5.10" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1333c76748e868a4d9d1017b5ab53171dfd095f70c712fdb4653a406547f598f" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" dependencies = [ "serde", ] +[[package]] +name = "toml_datetime" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4553f467ac8e3d374bc9a177a26801e5d0f9b211aa1673fb137a403afd1c9cf5" + +[[package]] +name = "toml_edit" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56c59d8dd7d0dcbc6428bf7aa2f0e823e26e43b3c9aca15bbc9475d23e5fa12b" +dependencies = [ + "indexmap", + "nom8", + "toml_datetime", +] + [[package]] name = "tower-service" version = "0.3.2" @@ -4821,7 +4858,7 @@ checksum = "30ee6ab729cd4cf0fd55218530c4522ed30b7b6081752839b68fcec8d0960788" dependencies = [ "base64 0.13.1", "byteorder", - "bytes 1.3.0", + "bytes 1.4.0", "http", "httparse", "log", @@ -4869,14 +4906,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce65604324d3cce9b966701489fbd0cf318cb1f7bd9dd07ac9a4ee6fb791930d" dependencies = [ "tempfile", - "winapi 0.3.9", + "winapi", ] [[package]] name = "unicode-bidi" -version = "0.3.8" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" +checksum = "d54675592c1dbefd78cbd98db9bacd89886e1ca50692a0692baefffdeb92dd58" [[package]] name = "unicode-ident" @@ -4895,9 +4932,9 @@ dependencies = [ [[package]] name = "unicode-segmentation" -version = "1.10.0" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fdbf052a0783de01e944a6ce7a8cb939e295b1e7be835a1112c3b9a7f047a5a" +checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" [[package]] name = "unicode-width" @@ -4965,9 +5002,9 @@ checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" [[package]] name = "uuid" -version = "1.2.2" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "422ee0de9031b5b948b97a8fc04e3aa35230001a722ddd27943e0be31564ce4c" +checksum = "1674845326ee10d37ca60470760d4288a6f80f304007d92e5c53bab78c9cfd79" dependencies = [ "getrandom 0.2.8", ] @@ -5132,6 +5169,19 @@ version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" +[[package]] +name = "wasm-streams" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bbae3363c08332cadccd13b67db371814cd214c2524020932f0804b8cf7c078" +dependencies = [ + "futures-util", + "js-sys", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + [[package]] name = "web-sys" version = "0.3.60" @@ -5356,12 +5406,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" dependencies = [ "windows_aarch64_gnullvm", - "windows_aarch64_msvc 0.42.0", - "windows_i686_gnu 0.42.0", - "windows_i686_msvc 0.42.0", - "windows_x86_64_gnu 0.42.0", + "windows_aarch64_msvc 0.42.1", + "windows_i686_gnu 0.42.1", + "windows_i686_msvc 0.42.1", + "windows_x86_64_gnu 0.42.1", "windows_x86_64_gnullvm", - "windows_x86_64_msvc 0.42.0", + "windows_x86_64_msvc 0.42.1", ] [[package]] @@ -5372,9 +5422,9 @@ checksum = "f838de2fe15fe6bac988e74b798f26499a8b21a9d97edec321e79b28d1d7f597" [[package]] name = "windows_aarch64_gnullvm" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" +checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" [[package]] name = "windows_aarch64_msvc" @@ -5390,9 +5440,9 @@ checksum = "ec7711666096bd4096ffa835238905bb33fb87267910e154b18b44eaabb340f2" [[package]] name = "windows_aarch64_msvc" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" +checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" [[package]] name = "windows_i686_gnu" @@ -5408,9 +5458,9 @@ checksum = "763fc57100a5f7042e3057e7e8d9bdd7860d330070251a73d003563a3bb49e1b" [[package]] name = "windows_i686_gnu" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" +checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" [[package]] name = "windows_i686_msvc" @@ -5426,9 +5476,9 @@ checksum = "7bc7cbfe58828921e10a9f446fcaaf649204dcfe6c1ddd712c5eebae6bda1106" [[package]] name = "windows_i686_msvc" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" +checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" [[package]] name = "windows_x86_64_gnu" @@ -5444,15 +5494,15 @@ checksum = "6868c165637d653ae1e8dc4d82c25d4f97dd6605eaa8d784b5c6e0ab2a252b65" [[package]] name = "windows_x86_64_gnu" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" +checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" [[package]] name = "windows_x86_64_gnullvm" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" +checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" [[package]] name = "windows_x86_64_msvc" @@ -5468,9 +5518,9 @@ checksum = "5e4d40883ae9cae962787ca76ba76390ffa29214667a111db9e0a1ad8377e809" [[package]] name = "windows_x86_64_msvc" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" +checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" [[package]] name = "winreg" @@ -5521,9 +5571,9 @@ dependencies = [ [[package]] name = "x11" -version = "2.20.1" +version = "2.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2638d5b9c17ac40575fb54bb461a4b1d2a8d1b4ffcc4ff237d254ec59ddeb82" +checksum = "502da5464ccd04011667b11c435cb992822c2c0dbde1770c988480d312a0db2e" dependencies = [ "libc", "pkg-config", @@ -5531,12 +5581,12 @@ dependencies = [ [[package]] name = "x11-dl" -version = "2.20.1" +version = "2.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1536d6965a5d4e573c7ef73a2c15ebcd0b2de3347bdf526c34c297c00ac40f0" +checksum = "38735924fedd5314a6e548792904ed8c6de6636285cb9fec04d5b1db85c1516f" dependencies = [ - "lazy_static", "libc", + "once_cell", "pkg-config", ] @@ -5560,17 +5610,11 @@ dependencies = [ "libc", ] -[[package]] -name = "xml-rs" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2d7d3948613f75c98fd9328cfdcc45acc4d360655289d0a7d4ec931392200a3" - [[package]] name = "zbus" -version = "3.7.0" +version = "3.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "379d587c0ccb632d1179cf44082653f682842f0535f0fdfaefffc34849cc855e" +checksum = "23eaeb1859a3cd5c5f780b101dfe626bf250a5f34873c3c0226d6d9f7a4d107c" dependencies = [ "async-broadcast", "async-executor", @@ -5598,7 +5642,7 @@ dependencies = [ "static_assertions", "tracing", "uds_windows", - "winapi 0.3.9", + "winapi", "zbus_macros", "zbus_names", "zvariant", @@ -5606,9 +5650,9 @@ dependencies = [ [[package]] name = "zbus_macros" -version = "3.7.0" +version = "3.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66492a2e90c0df7190583eccb8424aa12eb7ff06edea415a4fff6688fae18cf8" +checksum = "e83c1c6d669caa4773ebe8cb2ebea2a8d0c6ea27fc6c5c8916c7308cbf1db3b1" dependencies = [ "proc-macro-crate", "proc-macro2", diff --git a/plugins/authenticator/src/auth.rs b/plugins/authenticator/src/auth.rs index 3241ef72..d7508478 100644 --- a/plugins/authenticator/src/auth.rs +++ b/plugins/authenticator/src/auth.rs @@ -154,7 +154,7 @@ pub fn sign( let sig = encode_config(sign_data, URL_SAFE_NO_PAD); - println!("Sign result: {}", sig); + println!("Sign result: {sig}"); println!( "Key handle used: {}", encode_config(&handle_used, URL_SAFE_NO_PAD) @@ -173,10 +173,8 @@ pub fn sign( } fn format_client_data(application: &str, challenge: &str) -> (Vec, Vec, String) { - let d = format!( - r#"{{"challenge": "{}", "version": "U2F_V2", "appId": "{}"}}"#, - challenge, application - ); + let d = + format!(r#"{{"challenge": "{challenge}", "version": "U2F_V2", "appId": "{application}"}}"#); let mut challenge = Sha256::new(); challenge.update(d.as_bytes()); let chall_bytes = challenge.finalize().to_vec(); diff --git a/plugins/authenticator/src/u2f.rs b/plugins/authenticator/src/u2f.rs index 80eb9497..026917ca 100644 --- a/plugins/authenticator/src/u2f.rs +++ b/plugins/authenticator/src/u2f.rs @@ -16,7 +16,7 @@ pub fn make_challenge(app_id: &str, challenge_bytes: Vec) -> Challenge { let utc: DateTime = Utc::now(); Challenge { challenge: encode_config(challenge_bytes, URL_SAFE_NO_PAD), - timestamp: format!("{:?}", utc), + timestamp: format!("{utc:?}"), app_id: app_id.to_string(), } } diff --git a/plugins/fs-watch/src/lib.rs b/plugins/fs-watch/src/lib.rs index c022b253..3ff8457b 100644 --- a/plugins/fs-watch/src/lib.rs +++ b/plugins/fs-watch/src/lib.rs @@ -46,7 +46,7 @@ enum WatcherKind { fn watch_raw(window: Window, rx: Receiver>, id: Id) { spawn(move || { - let event_name = format!("watcher://raw-event/{}", id); + let event_name = format!("watcher://raw-event/{id}"); while let Ok(event) = rx.recv() { if let Ok(event) = event { // TODO: Should errors be emitted too? @@ -58,7 +58,7 @@ fn watch_raw(window: Window, rx: Receiver>, fn watch_debounced(window: Window, rx: Receiver, id: Id) { spawn(move || { - let event_name = format!("watcher://debounced-event/{}", id); + let event_name = format!("watcher://debounced-event/{id}"); while let Ok(event) = rx.recv() { if let Ok(event) = event { // TODO: Should errors be emitted too? diff --git a/plugins/localhost/src/lib.rs b/plugins/localhost/src/lib.rs index b358956c..4a11a84e 100644 --- a/plugins/localhost/src/lib.rs +++ b/plugins/localhost/src/lib.rs @@ -62,8 +62,8 @@ impl Builder { .setup(move |app| { let asset_resolver = app.asset_resolver(); std::thread::spawn(move || { - let server = Server::http(&format!("localhost:{}", port)) - .expect("Unable to spawn server"); + let server = + Server::http(&format!("localhost:{port}")).expect("Unable to spawn server"); for req in server.incoming_requests() { let path = req .url() diff --git a/plugins/log/src/lib.rs b/plugins/log/src/lib.rs index cf25db2d..2ab8ced9 100644 --- a/plugins/log/src/lib.rs +++ b/plugins/log/src/lib.rs @@ -308,7 +308,7 @@ fn get_log_file_path( rotation_strategy: &RotationStrategy, max_file_size: u128, ) -> plugin::Result { - let path = dir.as_ref().join(format!("{}.log", app_name)); + let path = dir.as_ref().join(format!("{app_name}.log")); if path.exists() { let log_size = File::open(&path)?.metadata()?.len() as u128; diff --git a/plugins/single-instance/src/platform_impl/linux.rs b/plugins/single-instance/src/platform_impl/linux.rs index bfefcc66..513526d4 100644 --- a/plugins/single-instance/src/platform_impl/linux.rs +++ b/plugins/single-instance/src/platform_impl/linux.rs @@ -38,8 +38,8 @@ pub fn init(f: Box>) -> TauriPlugin { callback: f, app_handle: app.clone(), }; - let dbus_name = format!("org.{}.SingleInstance", id); - let dbus_path = format!("/org/{}/SingleInstance", id); + let dbus_name = format!("org.{id}.SingleInstance"); + let dbus_path = format!("/org/{id}/SingleInstance"); match ConnectionBuilder::session() .unwrap() diff --git a/plugins/single-instance/src/platform_impl/windows.rs b/plugins/single-instance/src/platform_impl/windows.rs index c4fd7af7..5919d3e1 100644 --- a/plugins/single-instance/src/platform_impl/windows.rs +++ b/plugins/single-instance/src/platform_impl/windows.rs @@ -31,9 +31,9 @@ pub fn init(f: Box>) -> TauriPlugin { .setup(|app| { let id = &app.config().tauri.bundle.identifier; - let class_name = encode_wide(format!("{}-sic", id)); - let window_name = encode_wide(format!("{}-siw", id)); - let mutex_name = encode_wide(format!("{}-sim", id)); + let class_name = encode_wide(format!("{id}-sic")); + let window_name = encode_wide(format!("{id}-siw")); + let mutex_name = encode_wide(format!("{id}-sim")); let hmutex = unsafe { CreateMutexW(std::ptr::null(), true.into(), mutex_name.as_ptr()) }; From 72b5c490e6f2403f4540d43e555a01739a104e9d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 1 Feb 2023 11:29:20 +0100 Subject: [PATCH 21/27] chore(deps): update dependency @rollup/plugin-terser to ^0.4.0 (#106) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- package.json | 2 +- pnpm-lock.yaml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 704e0a45..cf521245 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ }, "devDependencies": { "@rollup/plugin-node-resolve": "^15.0.1", - "@rollup/plugin-terser": "^0.3.0", + "@rollup/plugin-terser": "^0.4.0", "@rollup/plugin-typescript": "^11.0.0", "@typescript-eslint/eslint-plugin": "^5.0.0", "@typescript-eslint/parser": "^5.46.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4b570b32..2ad11ee2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5,7 +5,7 @@ importers: .: specifiers: '@rollup/plugin-node-resolve': ^15.0.1 - '@rollup/plugin-terser': ^0.3.0 + '@rollup/plugin-terser': ^0.4.0 '@rollup/plugin-typescript': ^11.0.0 '@typescript-eslint/eslint-plugin': ^5.0.0 '@typescript-eslint/parser': ^5.46.1 @@ -20,7 +20,7 @@ importers: typescript: ^4.9.4 devDependencies: '@rollup/plugin-node-resolve': 15.0.1_rollup@3.7.4 - '@rollup/plugin-terser': 0.3.0_rollup@3.7.4 + '@rollup/plugin-terser': 0.4.0_rollup@3.7.4 '@rollup/plugin-typescript': 11.0.0_fhibmf72xnv5tve6nwed265eae '@typescript-eslint/eslint-plugin': 5.46.1_imrg37k3svwu377c6q7gkarwmi '@typescript-eslint/parser': 5.46.1_ha6vam6werchizxrnqvarmz2zu @@ -479,8 +479,8 @@ packages: rollup: 3.7.4 dev: true - /@rollup/plugin-terser/0.3.0_rollup@3.7.4: - resolution: {integrity: sha512-mYTkNW9KjOscS/3QWU5LfOKsR3/fAAVDaqcAe2TZ7ng6pN46f+C7FOZbITuIW/neA+PhcjoKl7yMyB3XcmA4gw==} + /@rollup/plugin-terser/0.4.0_rollup@3.7.4: + resolution: {integrity: sha512-Ipcf3LPNerey1q9ZMjiaWHlNPEHNU/B5/uh9zXLltfEQ1lVSLLeZSgAtTPWGyw8Ip1guOeq+mDtdOlEj/wNxQw==} engines: {node: '>=14.0.0'} peerDependencies: rollup: ^2.x || ^3.x From 3cfa9af85953c970c2e3ce47f5c5795f3633e096 Mon Sep 17 00:00:00 2001 From: Fabian-Lars Date: Wed, 1 Feb 2023 11:34:54 +0100 Subject: [PATCH 22/27] fix(fs-watch): use less specific `notify` version --- plugins/fs-watch/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/fs-watch/Cargo.toml b/plugins/fs-watch/Cargo.toml index b8f648a9..f939dd2b 100644 --- a/plugins/fs-watch/Cargo.toml +++ b/plugins/fs-watch/Cargo.toml @@ -15,5 +15,5 @@ serde_json.workspace = true tauri.workspace = true log.workspace = true thiserror.workspace = true -notify = { version = "5.0" , features = ["serde"] } +notify = { version = "5" , features = ["serde"] } notify-debouncer-mini = { version = "0.2.1" , features = ["serde"] } From bf1106a0a5e178ce38ecde56751ba037307a7ae8 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 1 Feb 2023 11:35:11 +0100 Subject: [PATCH 23/27] chore(deps): update dependency eslint-config-standard-with-typescript to v34 (#121) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- package.json | 2 +- pnpm-lock.yaml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index cf521245..9ad65f84 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "@typescript-eslint/parser": "^5.46.1", "eslint": "^8.0.1", "eslint-config-prettier": "^8.5.0", - "eslint-config-standard-with-typescript": "^33.0.0", + "eslint-config-standard-with-typescript": "^34.0.0", "eslint-plugin-import": "^2.25.2", "eslint-plugin-n": "^15.0.0", "eslint-plugin-promise": "^6.0.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2ad11ee2..a8fb00f2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,7 +11,7 @@ importers: '@typescript-eslint/parser': ^5.46.1 eslint: ^8.0.1 eslint-config-prettier: ^8.5.0 - eslint-config-standard-with-typescript: ^33.0.0 + eslint-config-standard-with-typescript: ^34.0.0 eslint-plugin-import: ^2.25.2 eslint-plugin-n: ^15.0.0 eslint-plugin-promise: ^6.0.0 @@ -26,7 +26,7 @@ importers: '@typescript-eslint/parser': 5.46.1_ha6vam6werchizxrnqvarmz2zu eslint: 8.29.0 eslint-config-prettier: 8.5.0_eslint@8.29.0 - eslint-config-standard-with-typescript: 33.0.0_f7skxvi3ubnnb5utlsc5vholvm + eslint-config-standard-with-typescript: 34.0.0_f7skxvi3ubnnb5utlsc5vholvm eslint-plugin-import: 2.26.0_z7hwuz3w5sq2sbhy7d4iqrnsvq eslint-plugin-n: 15.6.0_eslint@8.29.0 eslint-plugin-promise: 6.1.1_eslint@8.29.0 @@ -1218,8 +1218,8 @@ packages: eslint: 8.29.0 dev: true - /eslint-config-standard-with-typescript/33.0.0_f7skxvi3ubnnb5utlsc5vholvm: - resolution: {integrity: sha512-HOLmCMF91yYizfEms00jkmEoKvCCEIUOO6ArGZ9BNYL8yczF23fz/orsG6pN84f97cfo8c0kdREHzEO+uMA2zw==} + /eslint-config-standard-with-typescript/34.0.0_f7skxvi3ubnnb5utlsc5vholvm: + resolution: {integrity: sha512-zhCsI4/A0rJ1ma8sf3RLXYc0gc7yPmdTWRVXMh9dtqeUx3yBQyALH0wosHhk1uQ9QyItynLdNOtcHKNw8G7lQw==} peerDependencies: '@typescript-eslint/eslint-plugin': ^5.0.0 eslint: ^8.0.1 From c348eb31ea6eefea919f46cce188434e2edba346 Mon Sep 17 00:00:00 2001 From: Fabian-Lars Date: Wed, 15 Feb 2023 13:06:43 +0100 Subject: [PATCH 24/27] feat(upload): Add function to download files (#89) --- Cargo.lock | 2 +- plugins/upload/Cargo.toml | 2 +- plugins/upload/guest-js/index.ts | 35 ++++++++++++++++++++--- plugins/upload/src/lib.rs | 48 ++++++++++++++++++++++++++++++-- 4 files changed, 78 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 75568883..ebd4ec1a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4422,7 +4422,7 @@ dependencies = [ name = "tauri-plugin-upload" version = "0.1.0" dependencies = [ - "futures", + "futures-util", "log", "read-progress-stream", "reqwest", diff --git a/plugins/upload/Cargo.toml b/plugins/upload/Cargo.toml index 26ec517e..985645d6 100644 --- a/plugins/upload/Cargo.toml +++ b/plugins/upload/Cargo.toml @@ -18,5 +18,5 @@ thiserror.workspace = true tokio = { version = "1", features = [ "fs" ] } tokio-util = { version = "0.7", features = [ "codec" ] } reqwest = { version = "0.11", features = [ "json", "stream" ] } -futures = "0.3" +futures-util = "0.3" read-progress-stream = "1.0.0" \ No newline at end of file diff --git a/plugins/upload/guest-js/index.ts b/plugins/upload/guest-js/index.ts index 88f5202e..7b4a94c7 100644 --- a/plugins/upload/guest-js/index.ts +++ b/plugins/upload/guest-js/index.ts @@ -11,12 +11,12 @@ type ProgressHandler = (progress: number, total: number) => void; const handlers: Map = new Map(); let listening = false; -async function listenToUploadEventIfNeeded(): Promise { +async function listenToEventIfNeeded(event: string): Promise { if (listening) { return await Promise.resolve(); } return await appWindow - .listen("upload://progress", ({ payload }) => { + .listen(event, ({ payload }) => { const handler = handlers.get(payload.id); if (handler != null) { handler(payload.progress, payload.total); @@ -27,7 +27,7 @@ async function listenToUploadEventIfNeeded(): Promise { }); } -export default async function upload( +async function upload( url: string, filePath: string, progressHandler?: ProgressHandler, @@ -41,7 +41,7 @@ export default async function upload( handlers.set(id, progressHandler); } - await listenToUploadEventIfNeeded(); + await listenToEventIfNeeded("upload://progress"); await invoke("plugin:upload|upload", { id, @@ -50,3 +50,30 @@ export default async function upload( headers: headers ?? {}, }); } + +async function download( + url: string, + filePath: string, + progressHandler?: ProgressHandler, + headers?: Map +): Promise { + const ids = new Uint32Array(1); + window.crypto.getRandomValues(ids); + const id = ids[0]; + + if (progressHandler != null) { + handlers.set(id, progressHandler); + } + + await listenToEventIfNeeded("download://progress"); + + await invoke("plugin:upload|upload", { + id, + url, + filePath, + headers: headers ?? {}, + }); +} + +export default upload; +export { download, upload }; diff --git a/plugins/upload/src/lib.rs b/plugins/upload/src/lib.rs index a83a87ff..f57683c6 100644 --- a/plugins/upload/src/lib.rs +++ b/plugins/upload/src/lib.rs @@ -2,14 +2,14 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -use futures::TryStreamExt; +use futures_util::TryStreamExt; use serde::{ser::Serializer, Serialize}; use tauri::{ command, plugin::{Builder as PluginBuilder, TauriPlugin}, Runtime, Window, }; -use tokio::fs::File; +use tokio::{fs::File, io::AsyncWriteExt}; use tokio_util::codec::{BytesCodec, FramedRead}; use read_progress_stream::ReadProgressStream; @@ -24,6 +24,8 @@ pub enum Error { Io(#[from] std::io::Error), #[error(transparent)] Request(#[from] reqwest::Error), + #[error("{0}")] + ContentLength(String), } impl Serialize for Error { @@ -42,6 +44,46 @@ struct ProgressPayload { total: u64, } +#[command] +async fn download( + window: Window, + id: u32, + url: &str, + file_path: &str, + headers: HashMap, +) -> Result { + let client = reqwest::Client::new(); + + let mut request = client.get(url); + // Loop trought the headers keys and values + // and add them to the request object. + for (key, value) in headers { + request = request.header(&key, value); + } + + let response = request.send().await?; + let total = response.content_length().ok_or_else(|| { + Error::ContentLength(format!("Failed to get content length from '{}'", url)) + })?; + + let mut file = File::create(file_path).await?; + let mut stream = response.bytes_stream(); + + while let Some(chunk) = stream.try_next().await? { + file.write_all(&chunk).await?; + let _ = window.emit( + "download://progress", + ProgressPayload { + id, + progress: chunk.len() as u64, + total, + }, + ); + } + + Ok(id) +} + #[command] async fn upload( window: Window, @@ -88,6 +130,6 @@ fn file_to_body(id: u32, window: Window, file: File) -> reqwest:: pub fn init() -> TauriPlugin { PluginBuilder::new("upload") - .invoke_handler(tauri::generate_handler![upload]) + .invoke_handler(tauri::generate_handler![download, upload]) .build() } From d18bc1ea603882484ca0a05b11f2434d02e41c3d Mon Sep 17 00:00:00 2001 From: Fabian-Lars Date: Wed, 15 Feb 2023 13:07:21 +0100 Subject: [PATCH 25/27] fix(sql): derive datatype from value, not colomn (#118) --- plugins/sql/src/plugin.rs | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/plugins/sql/src/plugin.rs b/plugins/sql/src/plugin.rs index e7deb885..c33e81e6 100644 --- a/plugins/sql/src/plugin.rs +++ b/plugins/sql/src/plugin.rs @@ -10,7 +10,7 @@ use sqlx::{ migrate::{ MigrateDatabase, Migration as SqlxMigration, MigrationSource, MigrationType, Migrator, }, - Column, Pool, Row, TypeInfo, + Column, Pool, Row, TypeInfo, ValueRef, }; use tauri::{ command, @@ -44,6 +44,8 @@ pub enum Error { Migration(#[from] sqlx::migrate::MigrateError), #[error("database {0} not loaded")] DatabaseNotLoaded(String), + #[error("unsupported datatype: {0}")] + UnsupportedDatatype(String), } impl Serialize for Error { @@ -246,12 +248,16 @@ async fn select( for row in rows { let mut value = HashMap::default(); for (i, column) in row.columns().iter().enumerate() { - let info = column.type_info(); - let v = if info.is_null() { + let v = row.try_get_raw(i)?; + + let v = if v.is_null() { JsonValue::Null } else { - match info.name() { - "VARCHAR" | "STRING" | "TEXT" | "DATETIME" | "JSON" => { + // TODO: postgresql's JSON type + match v.type_info().name() { + "VARCHAR" | "STRING" | "TEXT" | "TINYTEXT" | "LONGTEXT" | "NVARCHAR" + | "BIGVARCHAR" | "CHAR" | "BIGCHAR" | "NCHAR" | "DATETIME" | "DATE" + | "TIME" | "YEAR" | "TIMESTAMP" => { if let Ok(s) = row.try_get(i) { JsonValue::String(s) } else { @@ -266,22 +272,25 @@ async fn select( JsonValue::Bool(x.to_lowercase() == "true") } } - "INT" | "NUMBER" | "INTEGER" | "BIGINT" | "INT8" => { + "INT" | "NUMBER" | "INTEGER" | "BIGINT" | "INT2" | "INT4" | "INT8" + | "NUMERIC" | "TINYINT" | "SMALLINT" | "MEDIUMINT" | "TINYINT UNSINGED" + | "SMALLINT UNSINGED" | "INT UNSINGED" | "MEDIUMINT UNSINGED" + | "BIGINT UNSINGED" => { if let Ok(n) = row.try_get::(i) { JsonValue::Number(n.into()) } else { JsonValue::Null } } - "REAL" => { + "REAL" | "FLOAT" | "DOUBLE" | "FLOAT4" | "FLOAT8" => { if let Ok(n) = row.try_get::(i) { JsonValue::from(n) } else { JsonValue::Null } } - // "JSON" => JsonValue::Object(row.get(i)), - "BLOB" => { + "BLOB" | "TINYBLOB" | "MEDIUMBLOB" | "LONGBLOB" | "BINARY" | "VARBINARY" + | "BYTEA" => { if let Ok(n) = row.try_get::, usize>(i) { JsonValue::Array( n.into_iter().map(|n| JsonValue::Number(n.into())).collect(), @@ -290,13 +299,16 @@ async fn select( JsonValue::Null } } - _ => JsonValue::Null, + _ => return Err(Error::UnsupportedDatatype(v.type_info().name().to_string())), } }; + value.insert(column.name().to_string(), v); } + values.push(value); } + Ok(values) } From 2e090c90cd28a5d4aea4018b5f7741916545f77a Mon Sep 17 00:00:00 2001 From: Fabian-Lars Date: Wed, 15 Feb 2023 14:32:17 +0100 Subject: [PATCH 26/27] chore: Add MSRV to all readmes (#255) * chore: Add MSRV to all readmes * fix single-instance support matrix * wording * wording * typo --- README.md | 5 ++++- plugins/authenticator/README.md | 2 ++ plugins/autostart/README.md | 2 ++ plugins/fs-extra/README.md | 2 ++ plugins/fs-watch/README.md | 2 ++ plugins/localhost/README.md | 2 ++ plugins/log/README.md | 2 ++ plugins/persisted-scope/README.md | 2 ++ plugins/positioner/README.md | 2 ++ plugins/single-instance/README.md | 2 ++ plugins/sql/README.md | 2 ++ plugins/store/README.md | 2 ++ plugins/stronghold/README.md | 2 ++ plugins/upload/README.md | 2 ++ plugins/websocket/README.md | 2 ++ plugins/window-state/README.md | 2 ++ shared/template/README.md | 2 ++ 17 files changed, 36 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 57583af9..cc7541ae 100644 --- a/README.md +++ b/README.md @@ -10,9 +10,12 @@ | [log](plugins/log) | Configurable logging. | ✅ | ✅ | ✅ | ✅ | ✅ | | [persisted-scope](plugins/persisted-scope) | Persist runtime scope changes on the filesystem. | ✅ | ✅ | ✅ | ? | ? | | [positioner](plugins/positioner) | Move windows to common locations. | ✅ | ✅ | ✅ | ? | ? | +| [single-instance](plugins/single-instance) | Ensure a single instance of your tauri app is running. | ✅ | ? | ✅ | ? | ? | | [sql](plugins/sql) | Interface with SQL databases. | ✅ | ✅ | ✅ | ? | ? | | [store](plugins/store) | Persistent key value storage. | ✅ | ✅ | ✅ | ? | ? | | [stronghold](plugins/stronghold) | Encrypted, secure database. | ✅ | ✅ | ✅ | ? | ? | | [upload](plugins/upload) | Tauri plugin for file uploads through HTTP. | ✅ | ✅ | ✅ | ? | ? | -| [websocket](plugins/websocket) | | ✅ | ✅ | ✅ | ? | ? | +| [websocket](plugins/websocket) | Open a WebSocket connection using a Rust client in JS. | ✅ | ✅ | ✅ | ? | ? | | [window-state](plugins/window-state) | Persist window sizes and positions. | ✅ | ✅ | ✅ | ? | ? | + +_This repo and all plugins require a Rust version of at least **1.64**_ diff --git a/plugins/authenticator/README.md b/plugins/authenticator/README.md index 884d81b9..0e700f6a 100644 --- a/plugins/authenticator/README.md +++ b/plugins/authenticator/README.md @@ -4,6 +4,8 @@ Use hardware security-keys in your Tauri App. ## Install +_This plugin requires a Rust version of at least **1.64**_ + There are three general methods of installation that we can recommend. 1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked) diff --git a/plugins/autostart/README.md b/plugins/autostart/README.md index 78859423..419907c3 100644 --- a/plugins/autostart/README.md +++ b/plugins/autostart/README.md @@ -4,6 +4,8 @@ Automatically launch your application at startup. Supports Windows, Mac (via App ## Install +_This plugin requires a Rust version of at least **1.64**_ + There are three general methods of installation that we can recommend. 1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked) diff --git a/plugins/fs-extra/README.md b/plugins/fs-extra/README.md index 6ea6ea1c..98d311fe 100644 --- a/plugins/fs-extra/README.md +++ b/plugins/fs-extra/README.md @@ -4,6 +4,8 @@ Additional file system methods not included in the core API. ## Install +_This plugin requires a Rust version of at least **1.64**_ + There are three general methods of installation that we can recommend. 1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked) diff --git a/plugins/fs-watch/README.md b/plugins/fs-watch/README.md index 26ee5bfc..8162d1fe 100644 --- a/plugins/fs-watch/README.md +++ b/plugins/fs-watch/README.md @@ -4,6 +4,8 @@ Watch files and directories for changes using [notify](https://github.com/notify ## Install +_This plugin requires a Rust version of at least **1.64**_ + There are three general methods of installation that we can recommend. 1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked) diff --git a/plugins/localhost/README.md b/plugins/localhost/README.md index 23b07577..50665f66 100644 --- a/plugins/localhost/README.md +++ b/plugins/localhost/README.md @@ -6,6 +6,8 @@ Expose your apps assets through a localhost server instead of the default custom ## Install +_This plugin requires a Rust version of at least **1.64**_ + There are three general methods of installation that we can recommend. 1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked) diff --git a/plugins/log/README.md b/plugins/log/README.md index f49c2c7b..fca43611 100644 --- a/plugins/log/README.md +++ b/plugins/log/README.md @@ -4,6 +4,8 @@ Configurable logging for your Tauri app. ## Install +_This plugin requires a Rust version of at least **1.64**_ + There are three general methods of installation that we can recommend. 1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked) diff --git a/plugins/persisted-scope/README.md b/plugins/persisted-scope/README.md index 43dd5909..26888b59 100644 --- a/plugins/persisted-scope/README.md +++ b/plugins/persisted-scope/README.md @@ -4,6 +4,8 @@ Save filesystem and asset scopes and restore them when the app is reopened. ## Install +_This plugin requires a Rust version of at least **1.64**_ + There are three general methods of installation that we can recommend. 1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked) diff --git a/plugins/positioner/README.md b/plugins/positioner/README.md index 54332ddc..ebac8500 100644 --- a/plugins/positioner/README.md +++ b/plugins/positioner/README.md @@ -6,6 +6,8 @@ This plugin is a port of [electron-positioner](https://github.com/jenslind/elect ## Install +_This plugin requires a Rust version of at least **1.64**_ + There are three general methods of installation that we can recommend. 1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked) diff --git a/plugins/single-instance/README.md b/plugins/single-instance/README.md index 75d985e9..1efbba90 100644 --- a/plugins/single-instance/README.md +++ b/plugins/single-instance/README.md @@ -4,6 +4,8 @@ Ensure a single instance of your tauri app is running. ## Install +_This plugin requires a Rust version of at least **1.64**_ + There are three general methods of installation that we can recommend. 1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked) diff --git a/plugins/sql/README.md b/plugins/sql/README.md index 6b034f7c..7ec807b1 100644 --- a/plugins/sql/README.md +++ b/plugins/sql/README.md @@ -4,6 +4,8 @@ Interface with SQL databases through [sqlx](https://github.com/launchbadge/sqlx) ## Install +_This plugin requires a Rust version of at least **1.64**_ + There are three general methods of installation that we can recommend. 1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked) diff --git a/plugins/store/README.md b/plugins/store/README.md index 0e1eb29a..3c3f7c7e 100644 --- a/plugins/store/README.md +++ b/plugins/store/README.md @@ -4,6 +4,8 @@ Simple, persistent key-value store. ## Install +_This plugin requires a Rust version of at least **1.64**_ + There are three general methods of installation that we can recommend. 1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked) diff --git a/plugins/stronghold/README.md b/plugins/stronghold/README.md index bc79b46c..2b5b2790 100644 --- a/plugins/stronghold/README.md +++ b/plugins/stronghold/README.md @@ -4,6 +4,8 @@ Store secrets and keys using the [IOTA Stronghold](https://github.com/iotaledger ## Install +_This plugin requires a Rust version of at least **1.64**_ + There are three general methods of installation that we can recommend. 1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked) diff --git a/plugins/upload/README.md b/plugins/upload/README.md index 1168a362..cd24a9d5 100644 --- a/plugins/upload/README.md +++ b/plugins/upload/README.md @@ -4,6 +4,8 @@ Upload files from disk to a remote server over HTTP. ## Install +_This plugin requires a Rust version of at least **1.64**_ + There are three general methods of installation that we can recommend. 1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked) diff --git a/plugins/websocket/README.md b/plugins/websocket/README.md index 954a650f..96c5c324 100644 --- a/plugins/websocket/README.md +++ b/plugins/websocket/README.md @@ -4,6 +4,8 @@ ## Install +_This plugin requires a Rust version of at least **1.64**_ + There are three general methods of installation that we can recommend. 1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked) diff --git a/plugins/window-state/README.md b/plugins/window-state/README.md index de86ae9e..303d54a5 100644 --- a/plugins/window-state/README.md +++ b/plugins/window-state/README.md @@ -4,6 +4,8 @@ Save window positions and sizes and restore them when the app is reopened. ## Install +_This plugin requires a Rust version of at least **1.64**_ + There are three general methods of installation that we can recommend. 1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked) diff --git a/shared/template/README.md b/shared/template/README.md index 0a059e4f..ed5545a2 100644 --- a/shared/template/README.md +++ b/shared/template/README.md @@ -4,6 +4,8 @@ ## Install +_This plugin requires a Rust version of at least **1.64**_ + There are three general methods of installation that we can recommend. 1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked) From e203b4f68f139e83d282af2f33461eb360956db2 Mon Sep 17 00:00:00 2001 From: Mohamad Date: Wed, 15 Feb 2023 17:28:36 +0330 Subject: [PATCH 27/27] fix(autostart): fix auto start choosing wrong app path on macOS (#125) * Update lib.rs * Update lib.rs * Update lib.rs --------- Co-authored-by: Fabian-Lars --- plugins/autostart/src/lib.rs | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/plugins/autostart/src/lib.rs b/plugins/autostart/src/lib.rs index 509e6b3f..91dcfa27 100644 --- a/plugins/autostart/src/lib.rs +++ b/plugins/autostart/src/lib.rs @@ -3,6 +3,7 @@ // SPDX-License-Identifier: MIT use auto_launch::{AutoLaunch, AutoLaunchBuilder}; +use log::info; use serde::{ser::Serializer, Serialize}; use tauri::{ command, @@ -98,7 +99,6 @@ pub fn init( .invoke_handler(tauri::generate_handler![enable, disable, is_enabled]) .setup(move |app| { let mut builder = AutoLaunchBuilder::new(); - builder.set_app_name(&app.package_info().name); if let Some(args) = args { builder.set_args(&args); @@ -110,7 +110,26 @@ pub fn init( #[cfg(windows)] builder.set_app_path(¤t_exe.display().to_string()); #[cfg(target_os = "macos")] - builder.set_app_path(¤t_exe.canonicalize()?.display().to_string()); + { + // on macOS, current_exe gives path to /Applications/Example.app/MacOS/Example + // but this results in seeing a Unix Executable in macOS login items + // It must be: /Applications/Example.app + // If it didn't find exactly a single occurance of .app, it will default to + // exe path to not break it. + let exe_path = current_exe.canonicalize()?.display().to_string(); + let parts: Vec<&str> = exe_path.split(".app/").collect(); + let app_path = if parts.len() == 2 { + format!( + "{}{}", + parts.get(0).unwrap().to_string(), + ".app" + ) + } else { + exe_path + }; + info!("auto_start path {}", &app_path); + builder.set_app_path(&app_path); + } #[cfg(target_os = "linux")] if let Some(appimage) = app .env()