CH-J Toolsserverhantering över SSH
Menyn
Publicerad källa

CH-J Tools

Bläddra i kataloger och filer för en specifik programutgåva.

Ladda ner källa ZIP
CH-J / Server Manager 1704 filer
0.1.2-beta Tillagd: · Byggd:
standby.rs Tillagd: Datum inte noterat 1,4 KB · 31 linjer
Kod Ladda ner fil
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 · Källan finns under CH-J Proprietary Software License 1.14. Dess tillgänglighet ändrar inte licensvillkoren eller ger ytterligare rättigheter.

Arkiv SHA-256ac8fe790f4ba60fc098f8c985fc2656cfcc6cdc21fb34b30e308a2b54e62258f
Filer