Add realtime Yjs collaboration for cloud-linked files

Claude-Session: https://claude.ai/code/session_01PoLmSR1pFVyHf8i5b1rNWk
This commit is contained in:
2026-07-21 15:55:46 -04:00
parent 566bf1a6cb
commit a16edeb876
9 changed files with 290 additions and 3 deletions
+27
View File
@@ -1062,6 +1062,32 @@ fn cloud_sync_document(
sync::sync_document(&server_url, &token, &app, &store, &path)
}
#[tauri::command]
fn cloud_room_id(
app: AppHandle,
store: State<'_, Store>,
path: String,
file: String,
) -> Result<Option<String>, String> {
if let Some(link) = store.document_link(&path)? {
return Ok(Some(link.document_id));
}
let meta = store.meta(&path)?;
let Some(cloud_project_id) = meta.cloud_project_id else {
return Ok(None);
};
let (server_url, token) = cloud_credentials(&app, &store)?;
let manifest = sync::get_manifest(&server_url, &token, &cloud_project_id)?;
Ok(manifest
.files
.into_iter()
.find(|entry| entry.path == file)
.map(|entry| format!("project:{}:{}", cloud_project_id, entry.id)))
}
#[tauri::command]
fn cloud_resolve_document(
app: AppHandle,
@@ -1425,6 +1451,7 @@ pub fn run() {
cloud_download_document,
cloud_delete_document,
cloud_sync_document,
cloud_room_id,
cloud_resolve_document,
cloud_document_link,
cloud_linked_documents,
+1
View File
@@ -241,6 +241,7 @@ pub fn move_cloud_project(
#[derive(Deserialize)]
pub struct ManifestEntry {
pub id: String,
pub path: String,
pub hash: String,
}