diff --git a/src-tauri/capabilities/TeyvatGuide.json b/src-tauri/capabilities/TeyvatGuide.json index 974558f3..81854c0a 100644 --- a/src-tauri/capabilities/TeyvatGuide.json +++ b/src-tauri/capabilities/TeyvatGuide.json @@ -52,8 +52,7 @@ { "url": "https://*.miyoushe.com/*" }, { "url": "https://*.mihoyo.com/*" }, { "url": "https://homa.snapgenshin.com/*" }, - { "url": "https://*.hoyoverse.com/*" }, - { "url": "https://*.geetest.com/*" } + { "url": "https://*.hoyoverse.com/*" } ] }, { @@ -61,8 +60,5 @@ "allow": [{ "name": "exec-sh", "cmd": "powershell", "args": true }] } ], - "remote": { - "urls": ["https://*.geetest.com/*"] - }, "platforms": ["windows", "macOS"] } diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index a64c2913..141979e6 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -1,10 +1,11 @@ //! 主模块,用于启动应用 -//! @since Beta v0.9.0 +//! @since Beta v0.7.8 mod client; mod commands; mod plugins; mod utils; +#[cfg(target_os = "windows")] mod yae; use crate::client::create_mhy_client; @@ -12,6 +13,7 @@ use crate::commands::{ create_window, execute_js, get_dir_size, init_app, is_in_admin, run_with_admin, }; use crate::plugins::{build_log_plugin, build_si_plugin}; +#[cfg(target_os = "windows")] use crate::yae::call_yae_dll; use tauri::{generate_context, generate_handler, Builder, Manager, Window, WindowEvent}; diff --git a/src-tauri/src/yae/inject.rs b/src-tauri/src/yae/inject.rs index 6adb9530..e2da7748 100644 --- a/src-tauri/src/yae/inject.rs +++ b/src-tauri/src/yae/inject.rs @@ -1,5 +1,6 @@ //! DLL 注入相关功能 -//! @since Beta v0.9.0 +//! @since Beta v0.7.8 +#![cfg(target_os = "windows")] use std::ffi::OsStr; use std::iter::once; diff --git a/src-tauri/src/yae/mod.rs b/src-tauri/src/yae/mod.rs index 59b25b85..f8709eaf 100644 --- a/src-tauri/src/yae/mod.rs +++ b/src-tauri/src/yae/mod.rs @@ -1,5 +1,6 @@ //! Yae 相关处理 //! @since Beta v0.8.7 +#![cfg(target_os = "windows")] pub mod inject; pub mod proto; @@ -65,11 +66,6 @@ fn read_exact_vec(r: &mut R, len: usize) -> io::Result> { /// 调用 dll #[tauri::command] pub fn call_yae_dll(app_handle: AppHandle, game_path: String) -> Result<(), String> { - #[cfg(not(target_os = "windows"))] - { - return Err("This function is only supported on Windows.".into()); - } - let dll_path = app_handle.path().resource_dir().unwrap().join("resources/YaeAchievementLib.dll"); dbg!(&dll_path); // 0. 创建 YaeAchievementPipe 的 命名管道,获取句柄 diff --git a/src-tauri/src/yae/proto.rs b/src-tauri/src/yae/proto.rs index 0696e660..62ed0d5d 100644 --- a/src-tauri/src/yae/proto.rs +++ b/src-tauri/src/yae/proto.rs @@ -1,5 +1,6 @@ //! Yae 成就信息的 Protobuf 定义 //! @since Beta v0.8.7 +#![cfg(target_os = "windows")] use prost::encoding::{decode_key, WireType}; use prost::DecodeError;