//! Availability of saved servers: read the shared state, ask for a new round. use super::{main_core, CommandResult}; use crate::core::app::CoreSlot; use serde_json::{json, Value}; use tauri::{State, Webview}; #[tauri::command] pub async fn core_availability_list(webview: Webview, slot: State<'_, CoreSlot>) -> CommandResult { let core = main_core(&webview, &slot)?; Ok(if core.vault.is_unlocked() { Value::Array(core.services.availability.snapshot()) } else { json!([]) }) } #[tauri::command] pub async fn core_availability_refresh(webview: Webview, slot: State<'_, CoreSlot>) -> CommandResult { let core = main_core(&webview, &slot)?; core.services.availability.refresh(); Ok(json!({ "refreshing": core.vault.is_unlocked() })) }