feat(settings): add weekly restart schedule and server log auto-cleanup

This commit is contained in:
Дмитрий committed 2026-11-20 21:34:23 +05:00
1 parent 41977442e9
commit 4ff190f6d1
10 files changed
+717 -41

No files matched your search

+36
View File
@@ -758,6 +758,15 @@ async fn get_settings(
blocking(move || config::load(&root, scope)).await
}
#[tauri::command]
async fn server_logging_state(
state: State<'_, AppState>,
id: String,
) -> std::result::Result<coa_core::server_logging::ServerLoggingView, UiError> {
let root = path_of(&state, &id)?;
blocking(move || Ok(coa_core::server_logging::state(&root))).await
}
#[tauri::command]
async fn server_logging_preset(
state: State<'_, AppState>,
@@ -772,6 +781,30 @@ async fn server_logging_preset(
}).await
}
#[tauri::command]
async fn server_logging_settings_save(
state: State<'_, AppState>,
id: String,
settings: coa_core::server_logging::LogSettings,
) -> std::result::Result<coa_core::server_logging::ServerLoggingView, UiError> {
let root = path_of(&state, &id)?;
let _guard = BusyGuard::acquire(&state, &id)?;
blocking(move || {
coa_core::server_logging::save_settings(&root, &settings)?;
Ok(coa_core::server_logging::state(&root))
}).await
}
#[tauri::command]
async fn server_logs_clean(
state: State<'_, AppState>,
id: String,
) -> std::result::Result<coa_core::server_logging::CleanLogsReport, UiError> {
let root = path_of(&state, &id)?;
let _guard = BusyGuard::acquire(&state, &id)?;
blocking(move || coa_core::server_logging::clean_logs(&root)).await
}
#[tauri::command]
async fn save_settings(
state: State<'_, AppState>,
@@ -3247,7 +3280,10 @@ pub fn run() {
.plugin(tauri_plugin_updater::Builder::new().build())
.plugin(tauri_plugin_process::init())
.invoke_handler(tauri::generate_handler![
server_logging_state,
server_logging_preset,
server_logging_settings_save,
server_logs_clean,
release_history,
default_install_dir,
game_data_folder,