diff --git a/Tasks.md b/Tasks.md index dc0977f..f60b9e8 100644 --- a/Tasks.md +++ b/Tasks.md @@ -70,7 +70,6 @@ This document defines the complete project roadmap and task tracking system for | ID | Title | Status | Type | |---|---|---|---| -| [NUT-016](#nut-016) | Implement Shared Auth Token Reuse | Triage | Integration | | [NUT-017](#nut-017) | Implement Multi-Account Switching (GUI + CLI) | Triage | Integration | | [NUT-018](#nut-018) | Implement Packaging for macOS, Windows, Linux | Triage | Chore | | [NUT-019](#nut-019) | Implement Homebrew/Winget/Chocolatey Manifests | Triage | Chore | @@ -93,6 +92,7 @@ This document defines the complete project roadmap and task tracking system for | [NUT-013](#nut-013) | Implement GUI File Queue + Drag-and-Drop | Fixed | Feature | | [NUT-014](#nut-014) | Implement GUI Credential Management UI | Fixed | Feature | | [NUT-015](#nut-015) | Implement GUI Upload Progress Bars | Fixed | Feature | +| [NUT-016](#nut-016) | Implement Shared Auth Token Reuse | Fixed | Integration | | [NUT-021](#nut-021) | Support Headless & SSH Remote Authentication Modes | Fixed | Feature | --- @@ -402,19 +402,19 @@ Add per-file and total progress bars to the GUI. - NUT-013 - + ### Implement Shared Auth Token Reuse **ID:** NUT-016 -**Status:** Triage +**Status:** Fixed **Type:** Integration **Description:** Ensure both CLI and GUI reuse the same credential store and cached tokens. **Requirements:** -- [ ] Shared credential backend -- [ ] Shared token cache -- [ ] Unified config format +- [x] Shared credential backend +- [x] Shared token cache +- [x] Unified config format **Dependencies:** - NUT-006 diff --git a/nextcloud_client/src/credentials.rs b/nextcloud_client/src/credentials.rs index 89174f1..d9a2fa5 100644 --- a/nextcloud_client/src/credentials.rs +++ b/nextcloud_client/src/credentials.rs @@ -345,4 +345,42 @@ mod tests { let deserialized: StoredAccount = serde_json::from_str(&json).unwrap(); assert_eq!(deserialized, account); } + + #[test] + fn test_unified_config_accounts_parsing() { + let json_data = r#"[ + { + "id": "alice@cloud.example.com", + "label": "Work", + "username": "alice", + "server_url": "https://cloud.example.com", + "is_default": true, + "fallback_password": "app-password-token" + }, + { + "id": "bob@personal.nextcloud.com", + "label": "Personal", + "username": "bob", + "server_url": "https://personal.nextcloud.com", + "is_default": false + } + ]"#; + + let accounts: Vec = serde_json::from_str(json_data).unwrap(); + assert_eq!(accounts.len(), 2); + assert_eq!(accounts[0].id, "alice@cloud.example.com"); + assert_eq!(accounts[0].label.as_deref(), Some("Work")); + assert!(accounts[0].is_default); + assert_eq!(accounts[0].fallback_password.as_deref(), Some("app-password-token")); + + assert_eq!(accounts[1].id, "bob@personal.nextcloud.com"); + assert_eq!(accounts[1].label.as_deref(), Some("Personal")); + assert!(!accounts[1].is_default); + assert_eq!(accounts[1].fallback_password, None); + } + + #[test] + fn test_keyring_constants() { + assert_eq!(KEYRING_SERVICE_NAME, "me.majinnaibu.nut"); + } }