fix: Server->Client Sync + File Locking repariert

Server->Client Sync:
- Server sendet Timestamps ohne Timezone (2026-04-11T12:49:24.735436)
- parse_from_rfc3339 braucht Timezone -> schlug still fehl
- Client dachte IMMER er sei neuer -> Upload statt Download
- Fix: parse_server_time() akzeptiert beides (mit/ohne Timezone)
- Probiert RFC3339, dann NaiveDateTime mit Microseconds, dann ohne

File Locking:
- open_cloud_file nutzte API-Clone vom SyncEngine (evtl. alter Token)
- Jetzt direkt state.api (immer aktueller Token nach Refresh)
- Lock wird zuverlaessig gesetzt beim Oeffnen von .cloud Dateien

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Stefan Hacker
2026-04-12 02:05:10 +02:00
parent a445256d86
commit b3da50e6ce
2 changed files with 22 additions and 8 deletions
+2 -4
View File
@@ -230,10 +230,8 @@ async fn run_sync_now(state: State<'_, AppState>) -> Result<Vec<String>, String>
#[tauri::command]
async fn open_cloud_file(state: State<'_, AppState>, cloud_path: String) -> Result<String, String> {
let engine = {
let guard = state.sync_engine.lock().unwrap();
guard.as_ref().ok_or("Sync nicht gestartet")?.api.clone()
};
let engine = state.api.lock().unwrap().clone()
.ok_or("Nicht eingeloggt")?;
let path = PathBuf::from(&cloud_path);
let content = std::fs::read_to_string(&path).map_err(|e| e.to_string())?;