From 33bbbc6c052137d4483dd5d953cc0469ca40bd61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?1024=E5=B0=8F=E7=A5=9E?= <15670339118@163.com> Date: Wed, 6 Nov 2024 21:00:41 +0800 Subject: [PATCH 01/10] main window inject js --- src-tauri/src/main.rs | 11 +++++++++++ src/pages/edit.vue | 2 ++ 2 files changed, 13 insertions(+) diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 6002e0e4..45473782 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -19,6 +19,17 @@ fn main() { .add_native_item(MenuItem::Quit), ); tauri::Builder::default() + .setup(|app| { + let _window = tauri::WindowBuilder::new( + app, + "PakePlus", + tauri::WindowUrl::App("https://juejin.cn/".into()), + ) + .initialization_script("console.log('Hello from initialization script!');") + .title("PakePlus") + .build()?; + Ok(()) + }) .menu(Menu::new().add_submenu(edit_menu)) .invoke_handler(tauri::generate_handler![ command::pake::open_window, diff --git a/src/pages/edit.vue b/src/pages/edit.vue index 2480108f..937099e9 100644 --- a/src/pages/edit.vue +++ b/src/pages/edit.vue @@ -36,6 +36,8 @@ > {{ t('relHistore') }} + + {{ t('delProject') }} From f64014fe93eda1103305da0616578793996a7bc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?1024=E5=B0=8F=E7=A5=9E?= <15670339118@163.com> Date: Wed, 6 Nov 2024 21:54:48 +0800 Subject: [PATCH 02/10] window add custom js --- src-tauri/Cargo.lock | 763 +++++++++++++++++---------- src-tauri/src/extension/component.js | 149 ++++++ src-tauri/src/extension/custom.js | 19 + src-tauri/src/main.rs | 5 +- 4 files changed, 656 insertions(+), 280 deletions(-) create mode 100644 src-tauri/src/extension/component.js create mode 100644 src-tauri/src/extension/custom.js diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index ef1ca6be..bcaf768c 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -4,19 +4,13 @@ version = 3 [[package]] name = "addr2line" -version = "0.22.0" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" dependencies = [ "gimli", ] -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - [[package]] name = "adler2" version = "2.0.0" @@ -64,19 +58,19 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.87" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10f00e1f6e58a40e807377c75c6a7f97bf9044fab57816f2414e6f5f4499d7b8" +checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775" [[package]] name = "arboard" -version = "3.4.0" +version = "3.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb4009533e8ff8f1450a5bcbc30f4242a1d34442221f72314bea1f5dc9c7f89" +checksum = "df099ccb16cd014ff054ac1bf392c67feeef57164b05c42f037cd40f5d4357f4" dependencies = [ "clipboard-win", "core-graphics 0.23.2", - "image 0.25.2", + "image 0.25.5", "log", "objc2", "objc2-app-kit", @@ -113,23 +107,23 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "backtrace" -version = "0.3.73" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" dependencies = [ "addr2line", - "cc", "cfg-if", "libc", - "miniz_oxide 0.7.4", + "miniz_oxide", "object", "rustc-demangle", + "windows-targets 0.52.6", ] [[package]] @@ -225,9 +219,9 @@ checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] name = "bytemuck" -version = "1.18.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94bbb0ad554ad961ddc5da507a12a29b14e4ae5bda06b19f575a3e6079d2e2ae" +checksum = "8334215b81e418a0a7bdb8ef0849474f40bb10c8b71f1c4ed315cff49f32494d" [[package]] name = "byteorder" @@ -243,9 +237,9 @@ checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495" [[package]] name = "bytes" -version = "1.7.1" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" +checksum = "9ac0150caa2ae65ca5bd83f25c7de183dea78d4d366469f148435e2acfbad0da" dependencies = [ "serde", ] @@ -286,9 +280,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.18" +version = "1.1.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62ac837cdb5cb22e10a256099b4fc502b1dfe560cb282963a974d7abd80e476" +checksum = "baee610e9452a8f6f0a1b6194ec09ff9e2d85dea54432acdae41aa0761c95d70" dependencies = [ "shlex", ] @@ -356,9 +350,9 @@ dependencies = [ [[package]] name = "clipboard-win" -version = "5.3.1" +version = "5.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79f4473f5144e20d9aceaf2972478f06ddf687831eafeeb434fbaf0acc4144ad" +checksum = "15efe7a882b08f34e38556b14f2fb3daa98769d06c7f0c1b076dfd0d983bc892" dependencies = [ "error-code", ] @@ -554,7 +548,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331" dependencies = [ "quote", - "syn 2.0.77", + "syn 2.0.87", ] [[package]] @@ -564,7 +558,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edb49164822f3ee45b17acd4a208cfc1251410cf0cad9a833234c9890774dd9f" dependencies = [ "quote", - "syn 2.0.77", + "syn 2.0.87", ] [[package]] @@ -588,7 +582,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.77", + "syn 2.0.87", ] [[package]] @@ -599,7 +593,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", - "syn 2.0.77", + "syn 2.0.87", ] [[package]] @@ -620,7 +614,7 @@ checksum = "d150dea618e920167e5973d70ae6ece4385b7164e0d799fe7c122dd0a5d912ad" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.87", ] [[package]] @@ -633,7 +627,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version", - "syn 2.0.77", + "syn 2.0.87", ] [[package]] @@ -673,6 +667,17 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] + [[package]] name = "dlib" version = "0.5.2" @@ -711,9 +716,9 @@ checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" [[package]] name = "embed-resource" -version = "2.4.3" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4edcacde9351c33139a41e3c97eb2334351a81a2791bebb0b243df837128f602" +checksum = "f4e24052d7be71f0efb50c201557f6fe7d237cfd5a64fd5bcd7fd8fe32dbbffa" dependencies = [ "cc", "memchr", @@ -731,9 +736,9 @@ checksum = "4ef6b89e5b37196644d8796de5268852ff179b44e96276cf4290264843743bb7" [[package]] name = "encoding_rs" -version = "0.8.34" +version = "0.8.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" +checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" dependencies = [ "cfg-if", ] @@ -756,9 +761,9 @@ dependencies = [ [[package]] name = "error-code" -version = "3.2.0" +version = "3.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0474425d51df81997e2f90a21591180b38eccf27292d755f3e30750225c175b" +checksum = "a5d9305ccc6942a704f4335694ecd3de2ea531b114ac2d51f5f843750787a92f" [[package]] name = "fastrand" @@ -768,9 +773,9 @@ checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" [[package]] name = "fdeflate" -version = "0.3.4" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f9bfee30e4dedf0ab8b422f03af778d9612b63f502710fc500a334ebe2de645" +checksum = "07c6f4c64c1d33a3111c4466f7365ebdcc37c5bd1ea0d62aae2e3d722aacbedb" dependencies = [ "simd-adler32", ] @@ -805,12 +810,12 @@ checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" [[package]] name = "flate2" -version = "1.0.33" +version = "1.0.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "324a1be68054ef05ad64b861cc9eaf1d623d2d8cb25b4bf2cb9cdd902b4bf253" +checksum = "a1b589b4dc103969ad3cf85c950899926ec64300a1a46d76c03a6072957036f0" dependencies = [ "crc32fast", - "miniz_oxide 0.8.0", + "miniz_oxide", ] [[package]] @@ -855,7 +860,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.87", ] [[package]] @@ -891,24 +896,24 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", ] [[package]] name = "futures-core" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-executor" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" dependencies = [ "futures-core", "futures-task", @@ -917,38 +922,38 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-macro" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.87", ] [[package]] name = "futures-sink" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" [[package]] name = "futures-task" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" [[package]] name = "futures-util" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-core", "futures-io", @@ -1113,9 +1118,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.29.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "gio" @@ -1200,15 +1205,15 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "globset" -version = "0.4.14" +version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57da3b9b5b85bd66f31093f8c408b90a74431672542466497dcbdfdc02034be1" +checksum = "15f1ce686646e7f1e19bf7d5533fe443a45dbfb990e00629110797578b42fb19" dependencies = [ "aho-corasick", "bstr", "log", - "regex-automata 0.4.7", - "regex-syntax 0.8.4", + "regex-automata 0.4.8", + "regex-syntax 0.8.5", ] [[package]] @@ -1289,7 +1294,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap 2.5.0", + "indexmap 2.6.0", "slab", "tokio", "tokio-util", @@ -1304,9 +1309,9 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "hashbrown" -version = "0.14.5" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +checksum = "3a9bfc1af68b1726ea47d3d5109de126281def866b33970e10fbab11b5dafab3" [[package]] name = "heck" @@ -1341,15 +1346,6 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" -[[package]] -name = "home" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" -dependencies = [ - "windows-sys 0.52.0", -] - [[package]] name = "html5ever" version = "0.26.0" @@ -1394,9 +1390,9 @@ checksum = "21dec9db110f5f872ed9699c3ecf50cf16f423502706ba5c72462e28d3157573" [[package]] name = "httparse" -version = "1.9.4" +version = "1.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" +checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946" [[package]] name = "httpdate" @@ -1406,9 +1402,9 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "hyper" -version = "0.14.30" +version = "0.14.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a152ddd61dfaec7273fe8419ab357f33aee0d914c5f4efbf0d96fa749eea5ec9" +checksum = "8c08302e8fa335b151b788c775ff56e7a03ae64ff85c548ee820fecb70356e85" dependencies = [ "bytes", "futures-channel", @@ -1443,9 +1439,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.60" +version = "0.1.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" +checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -1474,6 +1470,124 @@ dependencies = [ "png", ] +[[package]] +name = "icu_collections" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locid" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locid_transform" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_locid_transform_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locid_transform_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" + +[[package]] +name = "icu_normalizer" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" + +[[package]] +name = "icu_properties" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locid_transform", + "icu_properties_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" + +[[package]] +name = "icu_provider" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_provider_macros", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_provider_macros" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] + [[package]] name = "ident_case" version = "1.0.1" @@ -1482,25 +1596,36 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "idna" -version = "0.5.0" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" dependencies = [ - "unicode-bidi", - "unicode-normalization", + "icu_normalizer", + "icu_properties", ] [[package]] name = "ignore" -version = "0.4.22" +version = "0.4.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b46810df39e66e925525d6e38ce1e7f6e1d208f72dc39757880fcb66e2c58af1" +checksum = "6d89fd380afde86567dfba715db065673989d6253f42b88179abd3eae47bda4b" dependencies = [ "crossbeam-deque", "globset", "log", "memchr", - "regex-automata 0.4.7", + "regex-automata 0.4.8", "same-file", "walkdir", "winapi-util", @@ -1520,9 +1645,9 @@ dependencies = [ [[package]] name = "image" -version = "0.25.2" +version = "0.25.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99314c8a2152b8ddb211f924cdae532d8c5e4c8bb54728e12fff1b0cd5963a10" +checksum = "cd6f44aed642f18953a158afeb30206f4d50da59fbc66ecb53c66488de73563b" dependencies = [ "bytemuck", "byteorder-lite", @@ -1544,12 +1669,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5" +checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" dependencies = [ "equivalent", - "hashbrown 0.14.5", + "hashbrown 0.15.1", "serde", ] @@ -1573,9 +1698,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.10.0" +version = "2.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "187674a687eed5fe42285b40c6291f9a01517d415fad1c3cbc6a9f778af7fcd4" +checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" [[package]] name = "itoa" @@ -1640,9 +1765,9 @@ checksum = "f5d4a7da358eff58addd2877a45865158f0d78c911d43a5784ceb7bbf52833b0" [[package]] name = "js-sys" -version = "0.3.70" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" +checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" dependencies = [ "wasm-bindgen", ] @@ -1691,18 +1816,18 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.158" +version = "0.2.161" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" +checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1" [[package]] name = "libloading" -version = "0.8.3" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c2a198fb6b0eada2a8df47933734e6d35d350665a33a3593d7164fa52c75c19" +checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ "cfg-if", - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] @@ -1722,6 +1847,12 @@ version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +[[package]] +name = "litemap" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "643cb0b8d4fcc284004d5fd0d67ccf61dfffadb7f75e1e71bc420f4688a3a704" + [[package]] name = "lock_api" version = "0.4.12" @@ -1824,16 +1955,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" -[[package]] -name = "miniz_oxide" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" -dependencies = [ - "adler", - "simd-adler32", -] - [[package]] name = "miniz_oxide" version = "0.8.0" @@ -1841,6 +1962,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" dependencies = [ "adler2", + "simd-adler32", ] [[package]] @@ -2120,18 +2242,18 @@ dependencies = [ [[package]] name = "object" -version = "0.36.4" +version = "0.36.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "084f1a5821ac4c651660a94a7153d27ac9d8a53736203f58b31945ded098070a" +checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.19.0" +version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "open" @@ -2145,9 +2267,9 @@ dependencies = [ [[package]] name = "openssl" -version = "0.10.66" +version = "0.10.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1" +checksum = "6174bc48f102d208783c2c84bf931bb75927a617866870de8a4ea85597f871f5" dependencies = [ "bitflags 2.6.0", "cfg-if", @@ -2166,7 +2288,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.87", ] [[package]] @@ -2177,9 +2299,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.103" +version = "0.9.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6" +checksum = "45abf306cbf99debc8195b66b7346498d7b10c210de50418b5ccd7ceba08c741" dependencies = [ "cc", "libc", @@ -2189,9 +2311,9 @@ dependencies = [ [[package]] name = "os_info" -version = "3.8.0" +version = "3.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52a07930afc1bd77ac9e1101dc18d3fc4986c6568e939c31d1c26657eb0ccbf5" +checksum = "ae99c7fa6dd38c7cafe1ec085e804f8f555a2f8659b0dbe03f1f9963a9b51092" dependencies = [ "log", "serde", @@ -2200,12 +2322,12 @@ dependencies = [ [[package]] name = "os_pipe" -version = "1.1.5" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57119c3b893986491ec9aa85056780d3a0f3cf4da7cc09dd3650dbd6c6738fb9" +checksum = "5ffd2b0a5634335b135d5728d84c5e0fd726954b87111f7506a61c502280d982" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -2275,9 +2397,9 @@ dependencies = [ [[package]] name = "pathdiff" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" +checksum = "d61c5ce1153ab5b689d0c074c4e7fc613e942dfb7dd9eea5ab202d2ad91fe361" [[package]] name = "percent-encoding" @@ -2292,7 +2414,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" dependencies = [ "fixedbitset", - "indexmap 2.5.0", + "indexmap 2.6.0", ] [[package]] @@ -2399,7 +2521,7 @@ dependencies = [ "phf_shared 0.11.2", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.87", ] [[package]] @@ -2431,9 +2553,9 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" +checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" [[package]] name = "pin-utils" @@ -2443,9 +2565,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" +checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "plist" @@ -2454,7 +2576,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42cf17e9a1800f5f396bc67d193dc9411b59012a5876445ef450d449881e1016" dependencies = [ "base64 0.22.1", - "indexmap 2.5.0", + "indexmap 2.6.0", "quick-xml 0.32.0", "serde", "time", @@ -2462,15 +2584,15 @@ dependencies = [ [[package]] name = "png" -version = "0.17.13" +version = "0.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06e4b0d3d1312775e782c86c91a111aa1f910cbb65e1337f9975b5f9a554b5e1" +checksum = "52f9d46a34a05a6a57566bc2bfae066ef07585a6e3fa30fbbdff5936380623f0" dependencies = [ "bitflags 1.3.2", "crc32fast", "fdeflate", "flate2", - "miniz_oxide 0.7.4", + "miniz_oxide", ] [[package]] @@ -2536,27 +2658,27 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" dependencies = [ "unicode-ident", ] [[package]] name = "quick-xml" -version = "0.31.0" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1004a344b30a54e2ee58d66a71b32d2db2feb0a31f9a2d302bf0536f15de2a33" +checksum = "1d3a6e5838b60e0e8fa7a43f22ade549a37d61f8bdbe636d0d7816191de969c2" dependencies = [ "memchr", ] [[package]] name = "quick-xml" -version = "0.32.0" +version = "0.36.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d3a6e5838b60e0e8fa7a43f22ade549a37d61f8bdbe636d0d7816191de969c2" +checksum = "f7649a7b4df05aed9ea7ec6f628c67c9953a43869b8bc50929569b2999d443fe" dependencies = [ "memchr", ] @@ -2659,9 +2781,9 @@ checksum = "f2ff9a1f06a88b01621b7ae906ef0211290d1c8a168a15542486a8f61c0833b9" [[package]] name = "redox_syscall" -version = "0.5.3" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" +checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" dependencies = [ "bitflags 2.6.0", ] @@ -2679,14 +2801,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.6" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.7", - "regex-syntax 0.8.4", + "regex-automata 0.4.8", + "regex-syntax 0.8.5", ] [[package]] @@ -2700,13 +2822,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.4", + "regex-syntax 0.8.5", ] [[package]] @@ -2717,9 +2839,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "reqwest" @@ -2804,9 +2926,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.36" +version = "0.38.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f55e80d50763938498dd5ebb18647174e0c76dc38c5505294bb224624f30f36" +checksum = "375116bee2be9ed569afe2154ea6a99dfdffd257f533f187498c2a8f5feaf4ee" dependencies = [ "bitflags 2.6.0", "errno", @@ -2826,9 +2948,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" +checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" [[package]] name = "ryu" @@ -2847,9 +2969,9 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.24" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9aaafd5a2b6e3d657ff009d82fbd630b6bd54dd4eb06f21693925cdf80f9b8b" +checksum = "01227be5826fa0690321a2ba6c5cd57a19cf3f6a09e76973b58e61de6ab9d1c1" dependencies = [ "windows-sys 0.59.0", ] @@ -2881,9 +3003,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.11.1" +version = "2.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75da29fe9b9b08fe9d6b22b5b4bcbc75d8db3aa31e639aa56bb62e9d46bfceaf" +checksum = "ea4a292869320c0272d7bc55a5a6aafaff59b4f63404a003887b679a2e05b4b6" dependencies = [ "core-foundation-sys", "libc", @@ -2920,31 +3042,31 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.210" +version = "1.0.214" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" +checksum = "f55c3193aca71c12ad7890f1785d2b73e1b9f63a0bbc353c08ef26fe03fc56b5" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.210" +version = "1.0.214" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" +checksum = "de523f781f095e28fa605cdce0f8307e451cc0fd14e2eb4cd2e98a355b147766" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.87", ] [[package]] name = "serde_json" -version = "1.0.128" +version = "1.0.132" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" +checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03" dependencies = [ - "indexmap 2.5.0", + "indexmap 2.6.0", "itoa 1.0.11", "memchr", "ryu", @@ -2959,14 +3081,14 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.87", ] [[package]] name = "serde_spanned" -version = "0.6.7" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb5b1b31579f3811bf615c144393417496f152e12ac8b7663bf664f4a815306d" +checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" dependencies = [ "serde", ] @@ -2985,15 +3107,15 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.9.0" +version = "3.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69cecfa94848272156ea67b2b1a53f20fc7bc638c4a46d2f8abde08f05f4b857" +checksum = "8e28bdad6db2b8340e449f7108f020b3b092e8583a9e3fb82713e1d4e71fe817" dependencies = [ "base64 0.22.1", "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.5.0", + "indexmap 2.6.0", "serde", "serde_derive", "serde_json", @@ -3003,14 +3125,14 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.9.0" +version = "3.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8fee4991ef4f274617a51ad4af30519438dacb2f56ac773b08a1922ff743350" +checksum = "9d846214a9854ef724f3da161b426242d8de7c1fc7de2f89bb1efcb154dca79d" dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.87", ] [[package]] @@ -3032,7 +3154,7 @@ checksum = "772ee033c0916d670af7860b6e1ef7d658a4629a6d0b4c8c3e67f09b3765b75d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.87", ] [[package]] @@ -3196,9 +3318,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.77" +version = "2.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" +checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" dependencies = [ "proc-macro2", "quote", @@ -3211,11 +3333,22 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" +[[package]] +name = "synstructure" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] + [[package]] name = "sys-locale" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e801cf239ecd6ccd71f03d270d67dd53d13e90aab208bf4b8fe4ad957ea949b0" +checksum = "8eab9a99a024a169fe8a903cf9d4a3b3601109bcc13bd9e3c6fff259138626c4" dependencies = [ "libc", ] @@ -3322,14 +3455,14 @@ checksum = "f4e16beb8b2ac17db28eab8bca40e62dbfbb34c0fcdc6d9826b11b7b5d047dfd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.87", ] [[package]] name = "tar" -version = "0.4.41" +version = "0.4.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb797dad5fb5b76fcf519e702f4a589483b5ef06567f160c392832c1f5e44909" +checksum = "c65998313f8e17d0d553d28f91a0df93e4dbbbf770279c7bc21ca0f09ea1a1f6" dependencies = [ "filetime", "libc", @@ -3344,9 +3477,9 @@ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" [[package]] name = "tauri" -version = "1.7.2" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e33e3ba00a3b05eb6c57ef135781717d33728b48acf914bb05629e74d897d29" +checksum = "1bf327e247698d3f39af8aa99401c9708384290d1f5c544bf5d251d44c2fea22" dependencies = [ "anyhow", "bytes", @@ -3365,11 +3498,13 @@ dependencies = [ "http", "ignore", "indexmap 1.9.3", + "log", "objc", "once_cell", "open", "os_info", "percent-encoding", + "plist", "rand 0.8.5", "raw-window-handle", "regex", @@ -3399,9 +3534,9 @@ dependencies = [ [[package]] name = "tauri-build" -version = "1.5.4" +version = "1.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5fb5a90a64241ddb7217d3210d844149070a911e87e8a107a707a1d4973f164" +checksum = "586f3e677f940c8bb4f70c52eda05dc59b79e61543f1182de83516810bb8e35d" dependencies = [ "anyhow", "cargo_toml", @@ -3540,9 +3675,9 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.12.0" +version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64" +checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" dependencies = [ "cfg-if", "fastrand", @@ -3570,22 +3705,22 @@ checksum = "8eaa81235c7058867fa8c0e7314f33dcce9c215f535d1913822a2b3f5e289f3c" [[package]] name = "thiserror" -version = "1.0.63" +version = "1.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" +checksum = "02dd99dc800bbb97186339685293e1cc5d9df1f8fae2d0aecd9ff1c77efea892" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.63" +version = "1.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" +checksum = "a7c61ec9a6f64d2793d8a45faba21efbe3ced62a886d44c36a009b2b519b4c7e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.87", ] [[package]] @@ -3641,25 +3776,20 @@ dependencies = [ ] [[package]] -name = "tinyvec" -version = "1.8.0" +name = "tinystr" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" +checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" dependencies = [ - "tinyvec_macros", + "displaydoc", + "zerovec", ] -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - [[package]] name = "tokio" -version = "1.40.0" +version = "1.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" +checksum = "145f3413504347a2be84393cc8a7d2fb4d863b375909ea59f2158261aa258bbb" dependencies = [ "backtrace", "bytes", @@ -3723,7 +3853,7 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.22.20", + "toml_edit 0.22.22", ] [[package]] @@ -3741,7 +3871,7 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.5.0", + "indexmap 2.6.0", "serde", "serde_spanned", "toml_datetime", @@ -3750,15 +3880,15 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.22.20" +version = "0.22.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" +checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" dependencies = [ - "indexmap 2.5.0", + "indexmap 2.6.0", "serde", "serde_spanned", "toml_datetime", - "winnow 0.6.18", + "winnow 0.6.20", ] [[package]] @@ -3786,7 +3916,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.87", ] [[package]] @@ -3830,12 +3960,11 @@ dependencies = [ [[package]] name = "tree_magic_mini" -version = "3.1.5" +version = "3.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "469a727cac55b41448315cc10427c069c618ac59bb6a4480283fcd811749bdc2" +checksum = "aac5e8971f245c3389a5a76e648bfc80803ae066a1243a75db0064d7c1129d63" dependencies = [ "fnv", - "home", "memchr", "nom", "once_cell", @@ -3854,38 +3983,23 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" -[[package]] -name = "unicode-bidi" -version = "0.3.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" - [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" - -[[package]] -name = "unicode-normalization" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" -dependencies = [ - "tinyvec", -] +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unicode-segmentation" -version = "1.11.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" +checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" [[package]] name = "url" -version = "2.5.2" +version = "2.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" +checksum = "8d157f1b96d14500ffdc1f10ba712e780825526c03d9a49b4d0324b0d9113ada" dependencies = [ "form_urlencoded", "idna", @@ -3899,11 +4013,23 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" +[[package]] +name = "utf16_iter" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + [[package]] name = "uuid" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314" +checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a" dependencies = [ "getrandom 0.2.15", ] @@ -3991,9 +4117,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" +checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" dependencies = [ "cfg-if", "once_cell", @@ -4002,24 +4128,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" +checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.87", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.43" +version = "0.4.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61e9300f63a621e96ed275155c108eb6f843b6a26d053f122ab69724559dc8ed" +checksum = "cc7ec4f8827a71586374db3e87abdb5a2bb3a15afed140221307c3ec06b1f63b" dependencies = [ "cfg-if", "js-sys", @@ -4029,9 +4155,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" +checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4039,28 +4165,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" +checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.87", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" +checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" [[package]] name = "wasm-streams" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b65dc4c90b63b118468cf747d8bf3566c1913ef60be765b5730ead9e0a3ba129" +checksum = "15053d8d85c7eccdbefef60f06769760a563c7f0a9d6902a13d35c7800b0ad65" dependencies = [ "futures-util", "js-sys", @@ -4071,9 +4197,9 @@ dependencies = [ [[package]] name = "wayland-backend" -version = "0.3.4" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34e9e6b6d4a2bb4e7e69433e0b35c7923b95d4dc8503a84d25ec917a4bbfdf07" +checksum = "056535ced7a150d45159d3a8dc30f91a2e2d588ca0b23f70e56033622b8016f6" dependencies = [ "cc", "downcast-rs", @@ -4085,9 +4211,9 @@ dependencies = [ [[package]] name = "wayland-client" -version = "0.31.3" +version = "0.31.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e63801c85358a431f986cffa74ba9599ff571fc5774ac113ed3b490c19a1133" +checksum = "b66249d3fc69f76fd74c82cc319300faa554e9d865dab1f7cd66cc20db10b280" dependencies = [ "bitflags 2.6.0", "rustix", @@ -4122,20 +4248,20 @@ dependencies = [ [[package]] name = "wayland-scanner" -version = "0.31.2" +version = "0.31.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67da50b9f80159dec0ea4c11c13e24ef9e7574bd6ce24b01860a175010cea565" +checksum = "597f2001b2e5fc1121e3d5b9791d3e78f05ba6bfa4641053846248e3a13661c3" dependencies = [ "proc-macro2", - "quick-xml 0.31.0", + "quick-xml 0.36.2", "quote", ] [[package]] name = "wayland-sys" -version = "0.31.2" +version = "0.31.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "105b1842da6554f91526c14a2a2172897b7f745a805d62af4ce698706be79c12" +checksum = "efa8ac0d8e8ed3e3b5c9fc92c7881406a268e11555abe36493efabe649a29e09" dependencies = [ "dlib", "log", @@ -4144,9 +4270,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.70" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0" +checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112" dependencies = [ "js-sys", "wasm-bindgen", @@ -4636,9 +4762,9 @@ dependencies = [ [[package]] name = "winnow" -version = "0.6.18" +version = "0.6.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" +checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" dependencies = [ "memchr", ] @@ -4683,6 +4809,18 @@ dependencies = [ "wayland-protocols-wlr", ] +[[package]] +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" + [[package]] name = "wry" version = "0.24.11" @@ -4770,6 +4908,30 @@ dependencies = [ "rustix", ] +[[package]] +name = "yoke" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c5b1314b079b0930c31e3af543d8ee1757b1951ae1e1565ec704403a7240ca5" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28cc31741b18cb6f1d5ff12f5b7523e3d6eb0852bbbad19d73905511d9849b95" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", + "synstructure", +] + [[package]] name = "zerocopy" version = "0.7.35" @@ -4788,5 +4950,48 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.87", +] + +[[package]] +name = "zerofrom" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ec111ce797d0e0784a1116d0ddcdbea84322cd79e5d5ad173daeba4f93ab55" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ea7b4a3637ea8669cedf0f1fd5c286a17f3de97b8dd5a70a6c167a1730e63a5" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", + "synstructure", +] + +[[package]] +name = "zerovec" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", ] diff --git a/src-tauri/src/extension/component.js b/src-tauri/src/extension/component.js new file mode 100644 index 00000000..86e3a4bb --- /dev/null +++ b/src-tauri/src/extension/component.js @@ -0,0 +1,149 @@ +document.addEventListener('DOMContentLoaded', () => { + // Create a modal + const modalHtml = ` +
+
+
+ + + + +
+
+
+ `; + + const modalStyle = ` + .pake-modal { + display: none; + position: fixed; + z-index: 1000; + left: 0; + top: 0; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.4); + } + + .pake-modal-container { + display: flex; + align-items: center; + justify-content: center; + width: 100%; + height: 100%; + } + + .pake-modal-content { + background-color: #fff; + padding: 20px; + border-radius: 10px; + width: 80%; + max-width: 400px; + font-size:14px; + box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.08); + } + + .pake-modal-content label { + display: block; + color: #11182B; + margin-bottom: 12px; + font-weight: bold; + } + + .pake-modal-content input[type="text"] { + width: 90%; + padding: 8px; + border: 1px solid #ccc; + border-radius: 4px; + font-size: 14px; + margin-bottom: 12px; + outline: none; + } + + .pake-modal-content button { + background: #11182B; + color: #FFF; + padding: 6px 14px; + border-radius: 4px; + cursor: pointer; + margin-right: 4px; + font-size:14px; + border: 1px solid #11182B; + } + + #pakeUrlClose{ + background: #fff; + color: #11182B; + } + + #pakeUrlInput { + min-width: 320px; + text-align: left; + min-height: 30px; + } + `; + + const modalDiv = document.createElement('div'); + modalDiv.innerHTML = modalHtml; + document.body.appendChild(modalDiv); + + const modalStyleElement = document.createElement('style'); + modalStyleElement.innerText = modalStyle; + document.head.appendChild(modalStyleElement); + + const urlModal = document.getElementById('pakeUrlModal'); + const urlInput = document.getElementById('pakeUrlInput'); + const urlSubmit = document.getElementById('pakeUrlSubmit'); + const urlClose = document.getElementById('pakeUrlClose'); + + urlSubmit.onclick = function() { + const url = urlInput.value; + if (url) { + window.location.href = url; + } + }; + + urlClose.onclick = function() { + urlModal.style.display = 'none'; + }; + + urlInput.addEventListener('keydown', function(event) { + if (event.key === 'Enter') { + const url = urlInput.value; + if (url) { + window.location.href = url; + } + } + }); + + document.addEventListener('keydown', function(event) { + if (event.key === 'Escape' && urlModal.style.display === 'block') { + urlModal.style.display = 'none'; + } + }); + + window.showUrlModal = function() { + urlModal.style.display = 'block'; + urlInput.focus(); + }; + + // Toast + function pakeToast(msg) { + const m = document.createElement('div'); + m.innerHTML = msg; + m.style.cssText = + 'max-width:60%;min-width: 80px;padding:0 12px;height: 32px;color: rgb(255, 255, 255);line-height: 32px;text-align: center;border-radius: 8px;position: fixed; bottom:24px;right: 28px;z-index: 999999;background: rgba(0, 0, 0,.8);font-size: 13px;'; + document.body.appendChild(m); + setTimeout(function() { + const d = 0.5; + m.style.transition = 'transform ' + d + 's ease-in, opacity ' + d + 's ease-in'; + m.style.opacity = '0'; + setTimeout(function() { + document.body.removeChild(m); + }, d * 1000); + }, 3000); + } + + window.pakeToast = pakeToast; + +}); diff --git a/src-tauri/src/extension/custom.js b/src-tauri/src/extension/custom.js new file mode 100644 index 00000000..a200f372 --- /dev/null +++ b/src-tauri/src/extension/custom.js @@ -0,0 +1,19 @@ +/* + * This file serves as a collection point for external JS and CSS dependencies. + * It amalgamates these external resources for easier injection into the application. + * Additionally, you can directly include any script files in this file + * that you wish to attach to the application. + */ +document.addEventListener('DOMContentLoaded', () => { + // 获取所有带 target="_blank" 的链接 + const links = document.querySelectorAll('a[target="_blank"]') + + // 遍历并修改 target 属性 + links.forEach((link) => { + link.setAttribute('target', '_self') + }) + + console.log( + 'All target="_blank" attributes have been replaced with target="_self".' + ) +}) diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 45473782..6b8bfdc3 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -25,7 +25,10 @@ fn main() { "PakePlus", tauri::WindowUrl::App("https://juejin.cn/".into()), ) - .initialization_script("console.log('Hello from initialization script!');") + .initialization_script(include_str!("./extension/event.js")) + .initialization_script(include_str!("./extension/style.js")) + .initialization_script(include_str!("./extension/component.js")) + .initialization_script(include_str!("./extension/custom.js")) .title("PakePlus") .build()?; Ok(()) From 02f931891f5b0f3fd5c8fe5ef4334e25597f5e03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?1024=E5=B0=8F=E7=A5=9E?= <15670339118@163.com> Date: Wed, 6 Nov 2024 22:38:11 +0800 Subject: [PATCH 03/10] fix window open new tab --- src-tauri/src/extension/custom.js | 25 +++++++++++++++++-------- src-tauri/src/main.rs | 8 ++++---- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/src-tauri/src/extension/custom.js b/src-tauri/src/extension/custom.js index a200f372..c7dc8cde 100644 --- a/src-tauri/src/extension/custom.js +++ b/src-tauri/src/extension/custom.js @@ -5,15 +5,24 @@ * that you wish to attach to the application. */ document.addEventListener('DOMContentLoaded', () => { - // 获取所有带 target="_blank" 的链接 - const links = document.querySelectorAll('a[target="_blank"]') - - // 遍历并修改 target 属性 - links.forEach((link) => { - link.setAttribute('target', '_self') - }) - + // 获取页面的 HTML 内容 + let htmlContent = document.documentElement.innerHTML + // 使用正则表达式替换所有 target="_blank" 为 target="_self" + htmlContent = htmlContent.replace(/target="_blank"/g, 'target="_self"') + // 将修改后的内容重新设置到页面 + document.documentElement.innerHTML = htmlContent console.log( 'All target="_blank" attributes have been replaced with target="_self".' ) }) + +document.addEventListener('DOMContentLoaded', () => { + // 保存原始的 window.open 函数 + const originalWindowOpen = window.open + // 重写 window.open,强制其在当前页面打开 + window.open = function (url, target, features) { + // 将 target 替换为 '_self'(当前页面) + return originalWindowOpen.call(window, url, '_self', features) + } + console.log('window.open has been overridden to open in the current page.') +}) diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 6b8bfdc3..9f7f5d88 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -23,11 +23,11 @@ fn main() { let _window = tauri::WindowBuilder::new( app, "PakePlus", - tauri::WindowUrl::App("https://juejin.cn/".into()), + tauri::WindowUrl::App("https://www.weixin.com/".into()), ) - .initialization_script(include_str!("./extension/event.js")) - .initialization_script(include_str!("./extension/style.js")) - .initialization_script(include_str!("./extension/component.js")) + // .initialization_script(include_str!("./extension/event.js")) + // .initialization_script(include_str!("./extension/style.js")) + // .initialization_script(include_str!("./extension/component.js")) .initialization_script(include_str!("./extension/custom.js")) .title("PakePlus") .build()?; From c86441fc9cbd855ebe53519a393f8ab303eeda6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?1024=E5=B0=8F=E7=A5=9E?= <15670339118@163.com> Date: Wed, 6 Nov 2024 22:42:51 +0800 Subject: [PATCH 04/10] update --- src-tauri/src/main.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 9f7f5d88..09fe0e41 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -25,9 +25,9 @@ fn main() { "PakePlus", tauri::WindowUrl::App("https://www.weixin.com/".into()), ) - // .initialization_script(include_str!("./extension/event.js")) - // .initialization_script(include_str!("./extension/style.js")) - // .initialization_script(include_str!("./extension/component.js")) + .initialization_script(include_str!("./extension/event.js")) + .initialization_script(include_str!("./extension/style.js")) + .initialization_script(include_str!("./extension/component.js")) .initialization_script(include_str!("./extension/custom.js")) .title("PakePlus") .build()?; From 9222c7bf27226f297a39c6349267d6647137cdd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?1024=E5=B0=8F=E7=A5=9E?= <15670339118@163.com> Date: Fri, 8 Nov 2024 13:58:38 +0800 Subject: [PATCH 05/10] fix weburl click a _blank open current page --- src-tauri/src/extension/custom.js | 41 ++++++++++++++++++++++++------- src-tauri/src/main.rs | 8 +++--- 2 files changed, 36 insertions(+), 13 deletions(-) diff --git a/src-tauri/src/extension/custom.js b/src-tauri/src/extension/custom.js index c7dc8cde..19086338 100644 --- a/src-tauri/src/extension/custom.js +++ b/src-tauri/src/extension/custom.js @@ -4,25 +4,48 @@ * Additionally, you can directly include any script files in this file * that you wish to attach to the application. */ + document.addEventListener('DOMContentLoaded', () => { - // 获取页面的 HTML 内容 let htmlContent = document.documentElement.innerHTML - // 使用正则表达式替换所有 target="_blank" 为 target="_self" htmlContent = htmlContent.replace(/target="_blank"/g, 'target="_self"') - // 将修改后的内容重新设置到页面 document.documentElement.innerHTML = htmlContent - console.log( - 'All target="_blank" attributes have been replaced with target="_self".' - ) + console.log('have been replaced with target="_self".') }) document.addEventListener('DOMContentLoaded', () => { - // 保存原始的 window.open 函数 const originalWindowOpen = window.open - // 重写 window.open,强制其在当前页面打开 window.open = function (url, target, features) { - // 将 target 替换为 '_self'(当前页面) return originalWindowOpen.call(window, url, '_self', features) } console.log('window.open has been overridden to open in the current page.') }) + +document.addEventListener('DOMContentLoaded', () => { + const targetNode = document.body + + // 配置观察选项 + const config = { + childList: true, + subtree: true, + } + + const observer = new MutationObserver((mutationsList, observer) => { + let htmlContent = document.documentElement.innerHTML + for (const mutation of mutationsList) { + if ( + mutation.type === 'childList' && + htmlContent.includes('_blank') + ) { + const links = document.querySelectorAll('a[target="_blank"]') + links.forEach((link) => { + link.addEventListener('click', function (event) { + event.preventDefault() + window.location.href = link.href + }) + }) + } + } + }) + + observer.observe(targetNode, config) +}) diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 09fe0e41..777d2930 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -23,11 +23,11 @@ fn main() { let _window = tauri::WindowBuilder::new( app, "PakePlus", - tauri::WindowUrl::App("https://www.weixin.com/".into()), + tauri::WindowUrl::App("https://juejin.cn/".into()), ) - .initialization_script(include_str!("./extension/event.js")) - .initialization_script(include_str!("./extension/style.js")) - .initialization_script(include_str!("./extension/component.js")) + // .initialization_script(include_str!("./extension/event.js")) + // .initialization_script(include_str!("./extension/style.js")) + // .initialization_script(include_str!("./extension/component.js")) .initialization_script(include_str!("./extension/custom.js")) .title("PakePlus") .build()?; From 403940df5abd74f04071c00b7547ffbfeff1952b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?1024=E5=B0=8F=E7=A5=9E?= <15670339118@163.com> Date: Fri, 8 Nov 2024 19:17:32 +0800 Subject: [PATCH 06/10] update --- src-tauri/src/extension/custom.js | 33 ++++++++++++++++++++++--------- src-tauri/src/main.rs | 32 +++++++++++++++++++----------- src-tauri/tauri.conf.json | 11 +++++++++-- 3 files changed, 53 insertions(+), 23 deletions(-) diff --git a/src-tauri/src/extension/custom.js b/src-tauri/src/extension/custom.js index 19086338..4bdb5ddf 100644 --- a/src-tauri/src/extension/custom.js +++ b/src-tauri/src/extension/custom.js @@ -5,12 +5,12 @@ * that you wish to attach to the application. */ -document.addEventListener('DOMContentLoaded', () => { - let htmlContent = document.documentElement.innerHTML - htmlContent = htmlContent.replace(/target="_blank"/g, 'target="_self"') - document.documentElement.innerHTML = htmlContent - console.log('have been replaced with target="_self".') -}) +// document.addEventListener('DOMContentLoaded', () => { +// let htmlContent = document.documentElement.innerHTML +// htmlContent = htmlContent.replace(/target="_blank"/g, 'target="_self"') +// document.documentElement.innerHTML = htmlContent +// console.log('have been replaced with target="_self".') +// }) document.addEventListener('DOMContentLoaded', () => { const originalWindowOpen = window.open @@ -22,15 +22,16 @@ document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => { const targetNode = document.body - // 配置观察选项 const config = { childList: true, subtree: true, } - const observer = new MutationObserver((mutationsList, observer) => { let htmlContent = document.documentElement.innerHTML + console.log( + 'window.open has been overridden to open in the current page.' + ) for (const mutation of mutationsList) { if ( mutation.type === 'childList' && @@ -46,6 +47,20 @@ document.addEventListener('DOMContentLoaded', () => { } } }) - observer.observe(targetNode, config) }) + +window.addEventListener('popstate', function (event) { + console.log('URL has changed due to browser navigation (back or forward).') + this.alert('URL has changed due to browser navigation ') +}) + +window.addEventListener('hashchange', function () { + console.log('URL hash has changed') + this.alert('URL has changed due to browser navigation ') +}) + +window.addEventListener('beforeunload', function (event) { + console.log('Page is about to be unloaded or navigated away from.') + this.alert('URL has changed due to browser navigation ') +}) diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 777d2930..126e466a 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -1,7 +1,7 @@ // Prevents additional console window on Windows in release, DO NOT REMOVE!! #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] -use tauri::{Menu, MenuItem, Submenu}; +use tauri::{Manager, Menu, MenuItem, Submenu}; // 对command单独管理 mod command; @@ -19,18 +19,26 @@ fn main() { .add_native_item(MenuItem::Quit), ); tauri::Builder::default() + // .setup(|app| { + // let _window = tauri::WindowBuilder::new( + // app, + // "PakePlus", + // tauri::WindowUrl::App("https://juejin.cn/".into()), + // ) + // // .initialization_script(include_str!("./extension/event.js")) + // // .initialization_script(include_str!("./extension/style.js")) + // // .initialization_script(include_str!("./extension/component.js")) + // .initialization_script(include_str!("./extension/custom.js")) + // .title("PakePlus") + // .build()?; + // Ok(()) + // }) .setup(|app| { - let _window = tauri::WindowBuilder::new( - app, - "PakePlus", - tauri::WindowUrl::App("https://juejin.cn/".into()), - ) - // .initialization_script(include_str!("./extension/event.js")) - // .initialization_script(include_str!("./extension/style.js")) - // .initialization_script(include_str!("./extension/component.js")) - .initialization_script(include_str!("./extension/custom.js")) - .title("PakePlus") - .build()?; + let main_window = app.get_window("main").unwrap(); + // 在窗口加载时注入脚本 + main_window + .eval(include_str!("./extension/custom.js")) + .unwrap(); Ok(()) }) .menu(Menu::new().add_submenu(edit_menu)) diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index e10f7b27..d7f567dd 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -75,11 +75,18 @@ { "title": "PakePlus", "width": 800, - "height": 600 + "height": 600, + "url": "https://weixin.qq.com/" } ], "security": { - "csp": "default-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src 'self' asset://localhost blob: data: https://asset.localhost; font-src 'self' asset://localhost data:;" + "csp": "default-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src 'self' asset://localhost blob: data: https://asset.localhost; font-src 'self' asset://localhost data:;", + "dangerousRemoteDomainIpcAccess": [ + { + "domain": "*.*", + "windows": ["main"] + } + ] }, "bundle": { "active": true, From 308c69068ed051e9979155e0ad719a8214a15bf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?1024=E5=B0=8F=E7=A5=9E?= <15670339118@163.com> Date: Sat, 9 Nov 2024 11:21:42 +0800 Subject: [PATCH 07/10] upadte --- README.md | 8 ++++++++ src-tauri/src/main.rs | 40 +++++++++++++++++++-------------------- src-tauri/tauri.conf.json | 18 +++++++++++++----- 3 files changed, 41 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index beb78ca9..6ff4c50e 100644 --- a/README.md +++ b/README.md @@ -112,3 +112,11 @@ pnpm run build

+ +## TODO + +1. initialization javascript file; +2. rewrite github action build.yml +3. add tauri window config to view +4. add view control button to page +5. add build android and ios file diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 126e466a..60c69da6 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -1,7 +1,7 @@ // Prevents additional console window on Windows in release, DO NOT REMOVE!! #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] -use tauri::{Manager, Menu, MenuItem, Submenu}; +use tauri::{Menu, MenuItem, Submenu}; // 对command单独管理 mod command; @@ -19,28 +19,28 @@ fn main() { .add_native_item(MenuItem::Quit), ); tauri::Builder::default() - // .setup(|app| { - // let _window = tauri::WindowBuilder::new( - // app, - // "PakePlus", - // tauri::WindowUrl::App("https://juejin.cn/".into()), - // ) - // // .initialization_script(include_str!("./extension/event.js")) - // // .initialization_script(include_str!("./extension/style.js")) - // // .initialization_script(include_str!("./extension/component.js")) - // .initialization_script(include_str!("./extension/custom.js")) - // .title("PakePlus") - // .build()?; - // Ok(()) - // }) .setup(|app| { - let main_window = app.get_window("main").unwrap(); - // 在窗口加载时注入脚本 - main_window - .eval(include_str!("./extension/custom.js")) - .unwrap(); + let _window = tauri::WindowBuilder::new( + app, + "PakePlus", + tauri::WindowUrl::App("https://juejin.cn/".into()), + ) + .initialization_script(include_str!("./extension/custom.js")) + .title("PakePlus") + .build()?; Ok(()) }) + // .setup(|app| { + // let main_window = app.get_window("main").unwrap(); + // // 在窗口加载时注入脚本 + // // main_window + // // .eval(include_str!("./extension/custom.js")) + // // .unwrap(); + // main_window + // .with_webview(|webview| webview.initialization_script("./extension/custom.js")) + // .expect("Failed to set initialization script"); + // Ok(()) + // }) .menu(Menu::new().add_submenu(edit_menu)) .invoke_handler(tauri::generate_handler![ command::pake::open_window, diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index d7f567dd..dfd4c6f3 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -29,7 +29,12 @@ "removeFile": true, "renameFile": true, "exists": true, - "scope": ["$APPDATA/**/*", "$APPDATA/*", "$APPDATA/assets/*"] + "scope": [ + "$APPDATA/**/*", + "$APPDATA/*", + "$APPDATA/assets/*", + "$DOWNLOAD/*" + ] }, "http": { "all": true, @@ -52,7 +57,8 @@ "assetScope": [ "$APPDATA/**/*", "$APPDATA/*", - "$APPDATA/assets/*" + "$APPDATA/assets/*", + "$DOWNLOAD/*" ] }, "shell": { @@ -76,15 +82,17 @@ "title": "PakePlus", "width": 800, "height": 600, - "url": "https://weixin.qq.com/" + "url": "https://juejin.cn/", + "visible": false } ], "security": { "csp": "default-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src 'self' asset://localhost blob: data: https://asset.localhost; font-src 'self' asset://localhost data:;", "dangerousRemoteDomainIpcAccess": [ { - "domain": "*.*", - "windows": ["main"] + "domain": "weread.qq.com", + "windows": ["PakePlus"], + "enableTauriAPI": true } ] }, From 20f44323d0ee09f4dc138f52784ad9a93b577f30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?1024=E5=B0=8F=E7=A5=9E?= <15670339118@163.com> Date: Sat, 9 Nov 2024 12:45:07 +0800 Subject: [PATCH 08/10] update custom js --- src-tauri/data/appmain.rs | 42 +++++++++++++++++++++++++++++++ src-tauri/src/extension/custom.js | 15 ----------- src-tauri/src/main.rs | 11 -------- 3 files changed, 42 insertions(+), 26 deletions(-) create mode 100644 src-tauri/data/appmain.rs diff --git a/src-tauri/data/appmain.rs b/src-tauri/data/appmain.rs new file mode 100644 index 00000000..e29ded0a --- /dev/null +++ b/src-tauri/data/appmain.rs @@ -0,0 +1,42 @@ +// Prevents additional console window on Windows in release, DO NOT REMOVE!! +#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] + +use tauri::{Menu, MenuItem, Submenu}; +// 对command单独管理 +mod command; + +fn main() { + let edit_menu = Submenu::new( + "Edit", + Menu::new() + .add_native_item(MenuItem::Undo) + .add_native_item(MenuItem::Redo) + .add_native_item(MenuItem::Copy) + .add_native_item(MenuItem::Cut) + .add_native_item(MenuItem::Paste) + .add_native_item(MenuItem::SelectAll) + .add_native_item(MenuItem::CloseWindow) + .add_native_item(MenuItem::Quit), + ); + tauri::Builder::default() + .setup(|app| { + let _window = tauri::WindowBuilder::new( + app, + "PakePlus", + tauri::WindowUrl::App("https://juejin.cn/".into()), + ) + .initialization_script(include_str!("./extension/custom.js")) + .title("PakePlus") + .build()?; + Ok(()) + }) + .menu(Menu::new().add_submenu(edit_menu)) + .invoke_handler(tauri::generate_handler![ + command::pake::open_window, + command::pake::update_build_file, + command::pake::update_config_file, + command::pake::update_cargo_file + ]) + .run(tauri::generate_context!()) + .expect("error while running tauri application"); +} diff --git a/src-tauri/src/extension/custom.js b/src-tauri/src/extension/custom.js index 4bdb5ddf..be817621 100644 --- a/src-tauri/src/extension/custom.js +++ b/src-tauri/src/extension/custom.js @@ -49,18 +49,3 @@ document.addEventListener('DOMContentLoaded', () => { }) observer.observe(targetNode, config) }) - -window.addEventListener('popstate', function (event) { - console.log('URL has changed due to browser navigation (back or forward).') - this.alert('URL has changed due to browser navigation ') -}) - -window.addEventListener('hashchange', function () { - console.log('URL hash has changed') - this.alert('URL has changed due to browser navigation ') -}) - -window.addEventListener('beforeunload', function (event) { - console.log('Page is about to be unloaded or navigated away from.') - this.alert('URL has changed due to browser navigation ') -}) diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 60c69da6..e29ded0a 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -30,17 +30,6 @@ fn main() { .build()?; Ok(()) }) - // .setup(|app| { - // let main_window = app.get_window("main").unwrap(); - // // 在窗口加载时注入脚本 - // // main_window - // // .eval(include_str!("./extension/custom.js")) - // // .unwrap(); - // main_window - // .with_webview(|webview| webview.initialization_script("./extension/custom.js")) - // .expect("Failed to set initialization script"); - // Ok(()) - // }) .menu(Menu::new().add_submenu(edit_menu)) .invoke_handler(tauri::generate_handler![ command::pake::open_window, From d3bd187a87a5ef6edf498bd203f94c77fbdd30ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?1024=E5=B0=8F=E7=A5=9E?= <15670339118@163.com> Date: Sat, 9 Nov 2024 21:34:53 +0800 Subject: [PATCH 09/10] update --- src-tauri/data/{appbuild.yml => build.yml} | 0 .../data/{appconfig.json => config.json} | 30 ++++++-------- src-tauri/data/{appmain.rs => main.rs} | 17 +++----- src-tauri/src/command/pake.rs | 34 ++++++++++++++-- src-tauri/src/extension/custom.js | 12 +++--- src-tauri/src/main.rs | 14 +------ src-tauri/tauri.conf.json | 9 ++--- src/apis/github.ts | 6 +-- src/pages/edit.vue | 39 +++++++++++++++++++ src/pages/history.vue | 5 ++- 10 files changed, 106 insertions(+), 60 deletions(-) rename src-tauri/data/{appbuild.yml => build.yml} (100%) rename src-tauri/data/{appconfig.json => config.json} (76%) rename src-tauri/data/{appmain.rs => main.rs} (69%) diff --git a/src-tauri/data/appbuild.yml b/src-tauri/data/build.yml similarity index 100% rename from src-tauri/data/appbuild.yml rename to src-tauri/data/build.yml diff --git a/src-tauri/data/appconfig.json b/src-tauri/data/config.json similarity index 76% rename from src-tauri/data/appconfig.json rename to src-tauri/data/config.json index f25ed358..c424679a 100644 --- a/src-tauri/data/appconfig.json +++ b/src-tauri/data/config.json @@ -1,11 +1,4 @@ { - "build": { - "beforeDevCommand": "pnpm dev", - "beforeBuildCommand": "pnpm build", - "beforeBundleCommand": "pnpm tauri icon", - "devPath": "http://localhost:1420", - "distDir": "../dist" - }, "package": { "productName": "PROJECTNAME", "version": "PROJECTVERSION" @@ -27,7 +20,12 @@ "removeFile": true, "renameFile": true, "exists": true, - "scope": ["$APPDATA/*", "$APPDATA/assets/*"] + "scope": [ + "$APPDATA/*", + "$APPDATA/**/*", + "$APPDATA/assets/*", + "$DOWNLOAD/*" + ] }, "http": { "all": true @@ -43,7 +41,12 @@ "protocol": { "all": true, "asset": true, - "assetScope": ["$APPDATA/*", "$APPDATA/assets/*"] + "assetScope": [ + "$APPDATA/*", + "$APPDATA/**/*", + "$APPDATA/assets/*", + "$DOWNLOAD/*" + ] }, "shell": { "all": false, @@ -61,15 +64,6 @@ "setResizable": true } }, - "windows": [ - { - "title": "PROJECTNAME", - "width": -1, - "height": -2, - "url": "PROJECTURL", - "userAgent": "PROJECTUSERAGENT" - } - ], "security": { "csp": "default-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src 'self' asset://localhost data:; font-src 'self' asset://localhost data:; asset: https://asset.localhost" }, diff --git a/src-tauri/data/appmain.rs b/src-tauri/data/main.rs similarity index 69% rename from src-tauri/data/appmain.rs rename to src-tauri/data/main.rs index e29ded0a..c111b1d2 100644 --- a/src-tauri/data/appmain.rs +++ b/src-tauri/data/main.rs @@ -2,8 +2,6 @@ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] use tauri::{Menu, MenuItem, Submenu}; -// 对command单独管理 -mod command; fn main() { let edit_menu = Submenu::new( @@ -23,20 +21,17 @@ fn main() { let _window = tauri::WindowBuilder::new( app, "PakePlus", - tauri::WindowUrl::App("https://juejin.cn/".into()), + tauri::WindowUrl::App("PROJECTURL".into()), ) - .initialization_script(include_str!("./extension/custom.js")) - .title("PakePlus") + // .initialization_script(include_str!("./extension/custom.js")) + .title("PROJECTNAME") + .inner_size(-1.0, -2.0) + .center() + .user_agent("PROJECTUSERAGENT") .build()?; Ok(()) }) .menu(Menu::new().add_submenu(edit_menu)) - .invoke_handler(tauri::generate_handler![ - command::pake::open_window, - command::pake::update_build_file, - command::pake::update_config_file, - command::pake::update_cargo_file - ]) .run(tauri::generate_context!()) .expect("error while running tauri application"); } diff --git a/src-tauri/src/command/pake.rs b/src-tauri/src/command/pake.rs index be9640cf..63854699 100644 --- a/src-tauri/src/command/pake.rs +++ b/src-tauri/src/command/pake.rs @@ -45,7 +45,7 @@ pub async fn open_window( .title(app_name) .inner_size(width, height) .user_agent(user_agent.as_str()) - .position(200.4, 100.4) + .center() .build() .unwrap(); let theme = docs_window.theme().expect("failed to get theme"); @@ -57,7 +57,7 @@ pub async fn open_window( pub async fn update_build_file(handle: tauri::AppHandle, name: String, body: String) -> String { let resource_path = handle .path_resolver() - .resolve_resource("data/appbuild.yml") + .resolve_resource("data/build.yml") .expect("failed to resolve resource"); let mut build_file = std::fs::File::open(&resource_path).unwrap(); let mut contents = String::new(); @@ -85,7 +85,7 @@ pub async fn update_config_file( ) -> String { let resource_path = handle .path_resolver() - .resolve_resource("data/appconfig.json") + .resolve_resource("data/config.json") .expect("failed to resolve resource"); let mut config_file = std::fs::File::open(&resource_path).unwrap(); let mut contents = String::new(); @@ -142,3 +142,31 @@ pub async fn update_cargo_file( let encoded_contents = BASE64_STANDARD.encode(contents); return encoded_contents; } + +#[tauri::command] +pub async fn update_main_rust( + handle: tauri::AppHandle, + app_url: String, + app_name: String, + user_agent: String, + width: f64, + height: f64, +) -> String { + let resource_path = handle + .path_resolver() + .resolve_resource("data/main.rs") + .expect("failed to resolve resource"); + let mut main_rust = std::fs::File::open(&resource_path).unwrap(); + let mut contents = String::new(); + main_rust.read_to_string(&mut contents).unwrap(); + contents = contents + .replace("PROJECTNAME", app_name.as_str()) + .replace("PROJECTURL", app_url.as_str()) + .replace("PROJECTUSERAGENT", user_agent.as_str()) + .replace("-1", width.to_string().as_str()) + .replace("-2", height.to_string().as_str()); + // println!("Updated config file: {}", contents); + // The new file content, using Base64 encoding + let encoded_contents = BASE64_STANDARD.encode(contents); + return encoded_contents; +} diff --git a/src-tauri/src/extension/custom.js b/src-tauri/src/extension/custom.js index be817621..1461d215 100644 --- a/src-tauri/src/extension/custom.js +++ b/src-tauri/src/extension/custom.js @@ -5,12 +5,12 @@ * that you wish to attach to the application. */ -// document.addEventListener('DOMContentLoaded', () => { -// let htmlContent = document.documentElement.innerHTML -// htmlContent = htmlContent.replace(/target="_blank"/g, 'target="_self"') -// document.documentElement.innerHTML = htmlContent -// console.log('have been replaced with target="_self".') -// }) +document.addEventListener('DOMContentLoaded', () => { + let htmlContent = document.documentElement.innerHTML + htmlContent = htmlContent.replace(/target="_blank"/g, 'target="_self"') + document.documentElement.innerHTML = htmlContent + console.log('have been replaced with target="_self".') +}) document.addEventListener('DOMContentLoaded', () => { const originalWindowOpen = window.open diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index e29ded0a..ea83e007 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -19,23 +19,13 @@ fn main() { .add_native_item(MenuItem::Quit), ); tauri::Builder::default() - .setup(|app| { - let _window = tauri::WindowBuilder::new( - app, - "PakePlus", - tauri::WindowUrl::App("https://juejin.cn/".into()), - ) - .initialization_script(include_str!("./extension/custom.js")) - .title("PakePlus") - .build()?; - Ok(()) - }) .menu(Menu::new().add_submenu(edit_menu)) .invoke_handler(tauri::generate_handler![ command::pake::open_window, command::pake::update_build_file, command::pake::update_config_file, - command::pake::update_cargo_file + command::pake::update_cargo_file, + command::pake::update_main_rust ]) .run(tauri::generate_context!()) .expect("error while running tauri application"); diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index dfd4c6f3..be225af9 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -81,9 +81,7 @@ { "title": "PakePlus", "width": 800, - "height": 600, - "url": "https://juejin.cn/", - "visible": false + "height": 600 } ], "security": { @@ -101,8 +99,9 @@ "targets": "all", "identifier": "com.pakeplus.desktop", "resources": [ - "./data/appbuild.yml", - "./data/appconfig.json", + "./data/build.yml", + "./data/config.json", + "./data/main.rs", "./data/Cargo.toml" ], "icon": [ diff --git a/src/apis/github.ts b/src/apis/github.ts index c71d6657..da22c71d 100644 --- a/src/apis/github.ts +++ b/src/apis/github.ts @@ -105,9 +105,9 @@ export default { }) }, // creat file contents - updateMainRsFile(body: any) { - return http(`/repos/{owner}/{repo}/contents/{path}`, { - method: 'post', + updateMainRsFile(user: string, repo: string, body: any) { + return http(`/repos/${user}/${repo}/contents/src-tauri/src/main.rs`, { + method: 'put', body, }) }, diff --git a/src/pages/edit.vue b/src/pages/edit.vue index 937099e9..e20a76aa 100644 --- a/src/pages/edit.vue +++ b/src/pages/edit.vue @@ -663,6 +663,43 @@ const updateCargoToml = async () => { } } +// update build.yml file content +const updateMainRs = async () => { + // get CargoToml file sha + const shaRes = await getFileSha( + 'src-tauri/src/main.rs', + store.currentProject.name + ) + console.log('get CargoToml file sha', shaRes) + if (shaRes.status === 200 || shaRes.status === 404) { + // get CargoToml file content + const configContent: any = await invoke('update_main_rust', { + appUrl: appForm.url, + appName: appForm.showName, + userAgent: platforms[appForm.platform].userAgent, + width: appForm.width, + height: appForm.height, + }) + const updateRes: any = await githubApi.updateMainRsFile( + store.userInfo.login, + 'PakePlus', + { + message: 'update main rust from pakeplus', + content: configContent, + sha: shaRes.data.sha, + branch: store.currentProject.name, + } + ) + if (updateRes.status === 200) { + console.log('updateRes', updateRes) + } else { + console.log('updateRes error', updateRes) + } + } else { + console.log('getFileSha error', shaRes) + } +} + // del pre publish version const onSubmit = async () => { centerDialogVisible.value = false @@ -673,6 +710,8 @@ const onSubmit = async () => { await updateBuildYml() // update Cargo.toml await updateCargoToml() + // update main rust + await updateMainRs() // update tauri config json const configSha: any = await getFileSha( 'src-tauri/tauri.conf.json', diff --git a/src/pages/history.vue b/src/pages/history.vue index b96b17a5..336705bc 100644 --- a/src/pages/history.vue +++ b/src/pages/history.vue @@ -133,9 +133,10 @@ const getLatestRelease = async () => { } getLoading.value = false } else { + getLoading.value = false console.log('releaseRes error', releaseRes) - // sometime get one assets - setTimeout(getLatestRelease, 1000) + // sometime get one assets, will deep call + // setTimeout(getLatestRelease, 1000) } } From 90a8dc101002e3711b6e0c5f24a609c92f06d2da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?1024=E5=B0=8F=E7=A5=9E?= <15670339118@163.com> Date: Sun, 10 Nov 2024 10:17:11 +0800 Subject: [PATCH 10/10] add --- src-tauri/data/main.rs | 2 +- src-tauri/src/command/pake.rs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src-tauri/data/main.rs b/src-tauri/data/main.rs index c111b1d2..ff2d48cb 100644 --- a/src-tauri/data/main.rs +++ b/src-tauri/data/main.rs @@ -23,7 +23,7 @@ fn main() { "PakePlus", tauri::WindowUrl::App("PROJECTURL".into()), ) - // .initialization_script(include_str!("./extension/custom.js")) + .initialization_script(include_str!("./extension/custom.js")) .title("PROJECTNAME") .inner_size(-1.0, -2.0) .center() diff --git a/src-tauri/src/command/pake.rs b/src-tauri/src/command/pake.rs index 63854699..c4d0fdee 100644 --- a/src-tauri/src/command/pake.rs +++ b/src-tauri/src/command/pake.rs @@ -46,6 +46,7 @@ pub async fn open_window( .inner_size(width, height) .user_agent(user_agent.as_str()) .center() + .initialization_script(include_str!("../extension/custom.js")) .build() .unwrap(); let theme = docs_window.theme().expect("failed to get theme");