From a5232de9ce1c3fcc35a2ec6f80192424e7de07b8 Mon Sep 17 00:00:00 2001 From: CakeAL <1742507190@qq.com> Date: Thu, 18 Jul 2024 23:04:55 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix(app):=20=E7=94=B1=E4=BA=8ETa?= =?UTF-8?q?uri=E6=9C=89bug=EF=BC=8C=E5=B0=86Windows=E8=83=8C=E6=99=AF?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E4=B8=BA=E9=BB=91=E7=99=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 4 ++-- .vscode/launch.json | 2 +- package.json | 2 +- src-tauri/src/commands.rs | 12 +++++++++++ src-tauri/src/main.rs | 24 +++++++++++----------- src-tauri/tauri.conf.json | 2 +- src/App.vue | 38 +++++++++++++++++++++++++---------- 7 files changed, 56 insertions(+), 28 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c1965a1..436e313 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -48,8 +48,8 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - tagName: USTB WiFi Tools v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version. - releaseName: 'App v__VERSION__' + tagName: v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version. + releaseName: 'USTB WiFi Tools v__VERSION__' releaseBody: 'See the assets to download this version and install.' releaseDraft: true prerelease: false diff --git a/.vscode/launch.json b/.vscode/launch.json index 38559eb..955c018 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -2,7 +2,7 @@ // 使用 IntelliSense 了解相关属性。 // 悬停以查看现有属性的描述。 // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", + "version": "0.5.1", "configurations": [ { "type": "lldb", diff --git a/package.json b/package.json index 53f6a52..e4fdd15 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ustb-wifi-tools", "private": true, - "version": "0.5.0", + "version": "0.5.1", "type": "module", "scripts": { "dev": "vite", diff --git a/src-tauri/src/commands.rs b/src-tauri/src/commands.rs index bc61302..1d04d89 100644 --- a/src-tauri/src/commands.rs +++ b/src-tauri/src/commands.rs @@ -355,3 +355,15 @@ pub fn load_setting(app_state: tauri::State<'_, AppState>) -> Result Err(format!("{err}")), } } + +#[tauri::command] +pub fn is_windows() -> Result { + match std::env::consts::OS { + "windows" => { + Ok(true) + } + _ => { + Ok(false) + } + } +} diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index a606496..820e1fc 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -32,7 +32,8 @@ fn main() { get_jsessionid, set_setting, load_setting, - logout + logout, + is_windows ]) .setup(background_init) .run(tauri::generate_context!()) @@ -51,17 +52,16 @@ fn background_init(app: &mut tauri::App) -> Result<(), Box= 22000 { - // window_vibrancy::apply_mica(&win, None).map_err(|err| format!("启动错误: {}", err))?; - // } else { - // window_vibrancy::apply_blur(&win, Some((18, 18, 18, 125))) - // .map_err(|err| format!("启动错误: {}", err))?; - // } - // } + #[cfg(target_os = "windows")] + { + use ustb_wifi_tools::utils::get_windows_build_number; + if get_windows_build_number()? >= 22000 { + window_vibrancy::apply_mica(&win, None).map_err(|err| format!("启动错误: {}", err))?; + } else { + window_vibrancy::apply_blur(&win, Some((18, 18, 18, 125))) + .map_err(|err| format!("启动错误: {}", err))?; + } + } Ok(()) } diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 1d83796..4e7611a 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -7,7 +7,7 @@ }, "package": { "productName": "ustb-wifi-tools", - "version": "0.5.0" + "version": "0.5.1" }, "tauri": { "allowlist": { diff --git a/src/App.vue b/src/App.vue index d769cf8..24f08a4 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,5 +1,5 @@