CI / Check (push) Has been skipped
CI / Detect Changes (push) Successful in 3s
CI / Deploy Agent (push) Successful in 8m20s
CI / Deploy Dashboard (push) Successful in 3m13s
CI / Deploy Docs (push) Has been skipped
CI / Deploy MCP (push) Successful in 2m7s
31 lines
904 B
Rust
31 lines
904 B
Rust
//! The agent's SSH deploy public key — shown so a read-only deploy key can be
|
|
//! added to private git targets. (The legacy repositories CRUD moved to the
|
|
//! unified onboarding/targets API.)
|
|
|
|
use dioxus::prelude::*;
|
|
|
|
/// Fetch the agent's SSH deploy public key.
|
|
#[server]
|
|
pub async fn fetch_ssh_public_key() -> Result<String, ServerFnError> {
|
|
let resp = super::agent_client::agent_get("/api/v1/settings/ssh-public-key")
|
|
.await?
|
|
.send()
|
|
.await
|
|
.map_err(|e| ServerFnError::new(e.to_string()))?;
|
|
|
|
if !resp.status().is_success() {
|
|
return Err(ServerFnError::new("SSH key not available".to_string()));
|
|
}
|
|
|
|
let body: serde_json::Value = resp
|
|
.json()
|
|
.await
|
|
.map_err(|e| ServerFnError::new(e.to_string()))?;
|
|
|
|
Ok(body
|
|
.get("public_key")
|
|
.and_then(|v| v.as_str())
|
|
.unwrap_or("")
|
|
.to_string())
|
|
}
|