Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion cli/src/native/actions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1377,7 +1377,20 @@ async fn handle_snapshot(cmd: &Value, state: &mut DaemonState) -> Result<Value,
snapshot::take_snapshot(&mgr.client, &session_id, &options, &mut state.ref_map).await?;

let url = mgr.get_url().await.unwrap_or_default();
Ok(json!({ "snapshot": tree, "origin": url }))

let refs: serde_json::Map<String, Value> = state
.ref_map
.entries_sorted()
.into_iter()
.map(|(ref_id, entry)| {
let mut obj = serde_json::Map::new();
obj.insert("role".into(), Value::String(entry.role));
obj.insert("name".into(), Value::String(entry.name));
(ref_id, Value::Object(obj))
})
.collect();

Ok(json!({ "snapshot": tree, "origin": url, "refs": refs }))
}

async fn handle_screenshot(cmd: &Value, state: &mut DaemonState) -> Result<Value, String> {
Expand Down
Loading