Fix DB lock error: clear message + instructions, fix passphrase reprompt

Storage:
- Detects sled lock contention, shows actionable error:
  "Database locked by another warzone process"
  with ps command to find the process and rm command to force unlock

TUI:
- Poll loop no longer calls load_seed() (was re-prompting passphrase)
- Seed passed from main.rs to run_tui to poll_loop
- Single passphrase prompt per app launch

Warnings fixed:
- Removed unused `Context` import in tui/app.rs
- Added #[allow(dead_code)] on validate_token (used when auth middleware wired)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Siavash Sameni
2026-03-27 08:24:53 +04:00
parent c8b51fa96b
commit d7b71efdbc
4 changed files with 28 additions and 6 deletions

View File

@@ -172,6 +172,8 @@ async fn verify_challenge(
}
/// Validate a bearer token. Returns the fingerprint if valid.
/// Used by protected endpoints (will be wired in when auth middleware is added).
#[allow(dead_code)]
pub fn validate_token(db: &sled::Tree, token: &str) -> Option<String> {
let data = db.get(token.as_bytes()).ok()??;
let val: serde_json::Value = serde_json::from_slice(&data).ok()?;