refactor: update dependencies and remove unused code
- Added new dependencies: `adler2`, `crc32fast`, `flate2`, `miniz_oxide`, and `libredox`. - Updated existing dependencies: `tokio-rustls` to version 0.26.4 and `filetime` to version 0.2.27. - Removed the `backup.rs` file as it is no longer needed. - Introduced tests for configuration and credential management. - Enhanced the `identity` module to generate W3C compliant DID documents. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
2a867b32a8
commit
6fee6befed
@@ -42,4 +42,52 @@ impl RpcHandler {
|
||||
update::dismiss_update(&self.config.data_dir).await?;
|
||||
Ok(serde_json::json!({ "ok": true }))
|
||||
}
|
||||
|
||||
/// Download the available update to staging.
|
||||
pub(super) async fn handle_update_download(&self) -> Result<serde_json::Value> {
|
||||
let progress = update::download_update(&self.config.data_dir).await?;
|
||||
Ok(serde_json::json!({
|
||||
"total_bytes": progress.total_bytes,
|
||||
"downloaded_bytes": progress.downloaded_bytes,
|
||||
"components_downloaded": progress.components_downloaded,
|
||||
}))
|
||||
}
|
||||
|
||||
/// Apply the staged update.
|
||||
pub(super) async fn handle_update_apply(&self) -> Result<serde_json::Value> {
|
||||
update::apply_update(&self.config.data_dir).await?;
|
||||
Ok(serde_json::json!({ "applied": true, "restart_required": true }))
|
||||
}
|
||||
|
||||
/// Rollback to the previous version.
|
||||
pub(super) async fn handle_update_rollback(&self) -> Result<serde_json::Value> {
|
||||
update::rollback_update(&self.config.data_dir).await?;
|
||||
Ok(serde_json::json!({ "rolled_back": true, "restart_required": true }))
|
||||
}
|
||||
|
||||
/// Get the current update schedule.
|
||||
pub(super) async fn handle_update_get_schedule(&self) -> Result<serde_json::Value> {
|
||||
let schedule = update::get_schedule(&self.config.data_dir).await?;
|
||||
Ok(serde_json::json!({ "schedule": schedule }))
|
||||
}
|
||||
|
||||
/// Set the update schedule. Params: { schedule: "manual" | "daily_check" | "auto_apply" }
|
||||
pub(super) async fn handle_update_set_schedule(
|
||||
&self,
|
||||
params: &serde_json::Value,
|
||||
) -> Result<serde_json::Value> {
|
||||
let schedule_str = params["schedule"]
|
||||
.as_str()
|
||||
.ok_or_else(|| anyhow::anyhow!("Missing 'schedule' parameter"))?;
|
||||
|
||||
let schedule = match schedule_str {
|
||||
"manual" => update::UpdateSchedule::Manual,
|
||||
"daily_check" => update::UpdateSchedule::DailyCheck,
|
||||
"auto_apply" => update::UpdateSchedule::AutoApply,
|
||||
_ => anyhow::bail!("Invalid schedule: '{}'. Use manual, daily_check, or auto_apply", schedule_str),
|
||||
};
|
||||
|
||||
update::set_schedule(&self.config.data_dir, schedule).await?;
|
||||
Ok(serde_json::json!({ "schedule": schedule }))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user