From b190a0252e43f42dfd7062cf10ef966e73153238 Mon Sep 17 00:00:00 2001 From: Tlntin Date: Thu, 1 Dec 2022 15:30:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=9E=E9=80=80wry=E7=89=88=E6=9C=AC,?= =?UTF-8?q?=E6=9A=82=E6=97=B6=E5=8F=96=E6=B6=88Linux/Windows=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E8=AF=B7=E6=B1=82=E5=A4=B4,=E9=98=B2?= =?UTF-8?q?=E6=AD=A2=E5=BF=AB=E6=8D=B7=E9=94=AE=E5=A4=B1=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src-tauri/Cargo.lock | 128 ++++++++++++++++++++++++++++++++++++------ src-tauri/Cargo.toml | 2 +- src-tauri/src/main.rs | 16 +++--- 3 files changed, 122 insertions(+), 24 deletions(-) diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 4acdcae..9cc86ca 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -49,7 +49,7 @@ dependencies = [ "tauri-build", "tauri-utils", "webbrowser", - "wry", + "wry 0.21.1", ] [[package]] @@ -1289,6 +1289,20 @@ dependencies = [ "system-deps 5.0.0", ] +[[package]] +name = "jni" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6df18c2e3db7e453d3c6ac5b3e9d5182664d28788126d39b91f2d1e22b017ec" +dependencies = [ + "cesu8", + "combine", + "jni-sys", + "log", + "thiserror", + "walkdir", +] + [[package]] name = "jni" version = "0.20.0" @@ -1772,12 +1786,12 @@ dependencies = [ [[package]] name = "os_pipe" -version = "1.1.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dceb7e43f59c35ee1548045b2c72945a5a3bb6ce6d6f07cdc13dc8f6bc4930a" +checksum = "c6a252f1f8c11e84b3ab59d7a488e48e4478a93937e027076638c49536204639" dependencies = [ "libc", - "winapi", + "windows-sys 0.42.0", ] [[package]] @@ -1823,9 +1837,9 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dc9e0dc2adc1c69d09143aff38d3d30c5c3f0df0dad82e6d25547af174ebec0" +checksum = "7ff9f3fef3968a3ec5945535ed654cb38ff72d7495a25619e2247fb15a2ed9ba" dependencies = [ "cfg-if", "libc", @@ -2441,18 +2455,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.147" +version = "1.0.148" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965" +checksum = "e53f64bb4ba0191d6d0676e1b141ca55047d83b74f5607e6d8eb88126c52c2dc" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.147" +version = "1.0.148" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852" +checksum = "a55492425aa53521babf6137309e7d34c20bbfbbfcfe2c7f3a047fd1f6b92c0c" dependencies = [ "proc-macro2", "quote", @@ -2705,9 +2719,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.103" +version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d" +checksum = "4ae548ec36cf198c0ef7710d3c230987c2d6d7bd98ad6edc0274462724c585ce" dependencies = [ "proc-macro2", "quote", @@ -2740,6 +2754,52 @@ dependencies = [ "version-compare 0.1.1", ] +[[package]] +name = "tao" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43336f5d1793543ba96e2a1e75f3a5c7dcd592743be06a0ab3a190f4fcb4b934" +dependencies = [ + "bitflags", + "cairo-rs", + "cc", + "cocoa", + "core-foundation", + "core-graphics", + "crossbeam-channel", + "dispatch", + "gdk", + "gdk-pixbuf", + "gdk-sys", + "gdkx11-sys", + "gio", + "glib", + "glib-sys", + "gtk", + "image", + "instant", + "jni 0.19.0", + "lazy_static", + "libc", + "log", + "ndk", + "ndk-context", + "ndk-sys", + "objc", + "once_cell", + "parking_lot", + "paste", + "png", + "raw-window-handle", + "scopeguard", + "serde", + "unicode-segmentation", + "uuid 1.2.2", + "windows 0.39.0", + "windows-implement", + "x11-dl", +] + [[package]] name = "tao" version = "0.15.6" @@ -2764,7 +2824,7 @@ dependencies = [ "gtk", "image", "instant", - "jni", + "jni 0.20.0", "lazy_static", "libc", "log", @@ -2943,7 +3003,7 @@ dependencies = [ "webkit2gtk", "webview2-com", "windows 0.39.0", - "wry", + "wry 0.22.5", ] [[package]] @@ -3407,7 +3467,7 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a0cc7962b5aaa0dfcebaeef0161eec6edf5f4606c12e6777fd7d392f52033a5" dependencies = [ - "jni", + "jni 0.20.0", "ndk-context", "objc", "raw-window-handle", @@ -3816,6 +3876,42 @@ dependencies = [ "toml", ] +[[package]] +name = "wry" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff5c1352b4266fdf92c63479d2f58ab4cd29dc4e78fbc1b62011ed1227926945" +dependencies = [ + "base64", + "block", + "cocoa", + "core-graphics", + "crossbeam-channel", + "gdk", + "gio", + "glib", + "gtk", + "html5ever", + "http", + "kuchiki", + "libc", + "log", + "objc", + "objc_id", + "once_cell", + "serde", + "serde_json", + "sha2", + "tao 0.14.0", + "thiserror", + "url", + "webkit2gtk", + "webkit2gtk-sys", + "webview2-com", + "windows 0.39.0", + "windows-implement", +] + [[package]] name = "wry" version = "0.22.5" @@ -3844,7 +3940,7 @@ dependencies = [ "serde_json", "sha2", "soup2", - "tao", + "tao 0.15.6", "thiserror", "url", "webkit2gtk", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 248c405..b64ef54 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -21,7 +21,7 @@ tauri = { version = "1.2.1", features = ["api-all"] } image = "0.24.5" tauri-utils = "1.2.1" webbrowser = "0.8.2" -wry = "0.22.5" +wry = "0.21.1" [features] # by default Tauri runs in production mode diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 9dee51f..26c6263 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -157,6 +157,8 @@ fn main() -> wry::Result<()> { }; // 用于欺骗部分页面对于浏览器的强检测 + + #[cfg(target_os = "macos")] let user_agent_string = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.1 Safari/605.1.15"; #[cfg(target_os = "macos")] @@ -167,18 +169,18 @@ fn main() -> wry::Result<()> { .with_devtools(cfg!(feature = "devtools")) .with_initialization_script(include_str!("pake.js")) .with_ipc_handler(handler) - .with_back_forward_navigation_gestures(true) + // .with_back_forward_navigation_gestures(true) .build()?; #[cfg(target_os = "windows")] let webview = WebViewBuilder::new(window)? - .with_user_agent(user_agent_string) - .with_accept_first_mouse(true) + // .with_user_agent(user_agent_string) + // .with_accept_first_mouse(true) .with_url(&url.to_string())? .with_devtools(cfg!(feature = "devtools")) .with_initialization_script(include_str!("pake.js")) .with_ipc_handler(handler) - .with_back_forward_navigation_gestures(true) + // .with_back_forward_navigation_gestures(true) .build()?; // 自定义cookie文件夹,仅用于Linux // Custom Cookie folder, only for Linux @@ -193,14 +195,14 @@ fn main() -> wry::Result<()> { let mut web_content = WebContext::new(Some(data_path)); #[cfg(target_os = "linux")] let webview = WebViewBuilder::new(window)? - .with_user_agent(user_agent_string) - .with_accept_first_mouse(true) + // .with_user_agent(user_agent_string) + // .with_accept_first_mouse(true) .with_url(&url.to_string())? .with_devtools(cfg!(feature = "devtools")) .with_initialization_script(include_str!("pake.js")) .with_ipc_handler(handler) .with_web_context(&mut web_content) - .with_back_forward_navigation_gestures(true) + // .with_back_forward_navigation_gestures(true) .build()?; #[cfg(feature = "devtools")]