From e5c3d109919bb277178ac2efe662ad1ede2b3a5c Mon Sep 17 00:00:00 2001 From: BTMuli Date: Tue, 2 Jan 2024 00:58:58 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20=E6=B7=BB=E5=8A=A0=E7=A7=BB?= =?UTF-8?q?=E9=99=A4=E9=81=AE=E7=BD=A9=E5=AD=90=E8=8F=9C=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src-tauri/src/client.rs | 13 ++++++++++++- src/utils/TGClient.ts | 3 +++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src-tauri/src/client.rs b/src-tauri/src/client.rs index 22534fcc..a7b7cdff 100644 --- a/src-tauri/src/client.rs +++ b/src-tauri/src/client.rs @@ -9,7 +9,8 @@ use url::Url; fn create_utils_menu() -> Menu { let retry_bridge = CustomMenuItem::new("retry".to_string(), "重试桥接"); let mock_touch = CustomMenuItem::new("mock_touch".to_string(), "模拟触摸"); - return Menu::new().add_item(retry_bridge).add_item(mock_touch); + let remove_overlay = CustomMenuItem::new("remove_overlay".to_string(), "移除遮罩"); + return Menu::new().add_item(retry_bridge).add_item(mock_touch).add_item(remove_overlay); } // 创建米游社客户端菜单 @@ -133,6 +134,16 @@ pub async fn create_mhy_client(handle: AppHandle, func: String, url: String) { })()"#; window.eval(&execute_js).ok().unwrap(); } + "remove_overlay" => { + let window = handle.get_window("mhy_client").unwrap(); + let execute_js = r#"javascript:(async function(){ + const arg = { + method: 'teyvat_remove', + } + await window.__TAURI__.event.emit('post_mhy_client',JSON.stringify(arg)); + })()"#; + window.eval(&execute_js).ok().unwrap(); + } _ => {} }); } diff --git a/src/utils/TGClient.ts b/src/utils/TGClient.ts index 3b64a66e..34e856a4 100644 --- a/src/utils/TGClient.ts +++ b/src/utils/TGClient.ts @@ -279,6 +279,9 @@ class TGClient { case "teyvat_open": createPost(arg.payload); break; + case "teyvat_remove": + await this.hideOverlay(); + break; case "teyvat_retry": { const executeJS = `javascript:(function(){ window.location.reload();