CH-J Tools透過 SSH 管理伺服器
選單
已發布的原始碼

CH-J Tools

瀏覽特定應用程式版本的目錄與檔案。

下載原始碼 ZIP
CH-J / Server Manager 1704 個檔案
0.1.2-beta 新增時間: · 建置時間:
standby.rs 新增時間: 未記錄日期 1.4 KB · 31 行
程式碼 下載檔案
1//! Settings → Standby Helper (main window only). The helper itself applies the system entries.
2use super::{main_core, CommandResult};
3use crate::core::{app::CoreSlot, error::CoreError, standby};
4use serde_json::{json, Value};
5use tauri::{State, Webview};
7#[tauri::command]
8pub async fn core_standby_get(webview: Webview, slot: State<'_, CoreSlot>) -> CommandResult {
9 let core = main_core(&webview, &slot)?;
10 let data = core.paths.data.clone();
11 tokio::task::spawn_blocking(move || Ok(json!({"settings": standby::load(&data), "status": standby::status(&data)})))
12 .await
13 .map_err(|_| CoreError::plain("Standby helper status failed."))?
16#[tauri::command]
17pub async fn core_standby_set(webview: Webview, slot: State<'_, CoreSlot>, payload: Option<Value>) -> CommandResult {
18 let core = main_core(&webview, &slot)?;
19 let settings = super::payload(payload);
20 let data = core.paths.data.clone();
21 let profiles = if core.vault.is_unlocked() { core.profiles.list().ok() } else { None };
22 let result = tokio::task::spawn_blocking(move || -> Result<Value, CoreError> {
23 let saved = standby::save(&data, &settings)?;
24 standby::sync_servers(&data, profiles.as_deref())?;
25 let status = standby::apply(&data)?;
26 Ok(json!({"settings": saved, "status": status}))
27 })
28 .await
29 .map_err(|_| CoreError::plain("Standby helper update failed."))?;
30 super::logged(&core, "standby:set", result)
SHA-256c1e8f6c47e002bbc397a02ffb6b143189ec8195d17e073741d1957064c4edb8e

CH-J Proprietary Software License 1.14 · 原始碼依 CH-J Proprietary Software License 1.14 提供。公開原始碼不會改變授權條款,也不會授予額外的權利。

壓縮檔 SHA-256ac8fe790f4ba60fc098f8c985fc2656cfcc6cdc21fb34b30e308a2b54e62258f
檔案