[feat] better installer + changelog test version switch + better video config view
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
use crate::steam;
|
||||
use crate::tool::*;
|
||||
use crate::tool::updater::{check_update, download_update, install_update, UpdateInfo};
|
||||
use crate::vdf::preset;
|
||||
use crate::vdf::preset::VideoConfig;
|
||||
use crate::wrap_err;
|
||||
@@ -47,6 +48,11 @@ pub fn kill_game() -> Result<String, String> {
|
||||
Ok(common::kill("cs2.exe"))
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn check_process_running(process_name: &str) -> Result<bool, String> {
|
||||
Ok(common::check_process_running(process_name))
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn kill_steam() -> Result<String, String> {
|
||||
Ok(common::kill("steam.exe"))
|
||||
@@ -255,3 +261,42 @@ pub fn read_vprof_report(console_log_path: &str) -> Result<String, String> {
|
||||
|
||||
Ok(vprof_lines.join("\n"))
|
||||
}
|
||||
|
||||
// 更新相关命令
|
||||
|
||||
/// 检查更新
|
||||
#[tauri::command]
|
||||
pub async fn check_app_update(
|
||||
app: tauri::AppHandle,
|
||||
custom_endpoint: Option<String>,
|
||||
github_repo: Option<String>,
|
||||
) -> Result<Option<UpdateInfo>, String> {
|
||||
let current_version = app.package_info().version.to_string();
|
||||
|
||||
wrap_err!(check_update(
|
||||
custom_endpoint.as_deref(),
|
||||
github_repo.as_deref(),
|
||||
¤t_version
|
||||
).await)
|
||||
}
|
||||
|
||||
/// 下载更新
|
||||
#[tauri::command]
|
||||
pub async fn download_app_update(
|
||||
app: tauri::AppHandle,
|
||||
download_url: String,
|
||||
) -> Result<String, String> {
|
||||
let path = wrap_err!(download_update(
|
||||
&app,
|
||||
&download_url,
|
||||
None // 可以添加进度回调
|
||||
).await)?;
|
||||
|
||||
Ok(path.to_string_lossy().to_string())
|
||||
}
|
||||
|
||||
/// 安装更新
|
||||
#[tauri::command]
|
||||
pub fn install_app_update(installer_path: String) -> Result<(), String> {
|
||||
wrap_err!(install_update(&installer_path))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user