feat(remote): persist SPKI pins and machine configs to SQLite

- remote_machines table in sessions.db (id, label, url, token, auto_connect,
  spki_pins as JSON array, created_at, updated_at)
- session/machines.rs: save/load/delete/update_pins CRUD operations
- RemoteManager: set_session_db() + load_from_db() for startup restoration
- All mutations persist: add_machine, remove_machine, add_spki_pin,
  remove_spki_pin, TOFU auto-store — pins survive restart
- 197 cargo tests passing, 0 warnings
This commit is contained in:
Hibryda 2026-03-18 02:18:17 +01:00
parent d1463d4d1e
commit 538a31f85c
4 changed files with 170 additions and 2 deletions

View file

@ -389,7 +389,9 @@ pub fn run() {
let fs_watcher = Arc::new(ProjectFsWatcher::new());
let ctx_db = Arc::new(ctx::CtxDb::new_with_path(config.ctx_db_path.clone()));
let memora_db = Arc::new(memora::MemoraDb::new_with_path(config.memora_db_path.clone()));
let remote_manager = Arc::new(RemoteManager::new());
let mut remote_mgr = RemoteManager::new();
remote_mgr.set_session_db(session_db.clone());
let remote_manager = Arc::new(remote_mgr);
// Initialize FTS5 search database
let search_db_path = config.data_dir.join("agor").join("search.db");
@ -408,6 +410,12 @@ pub fn run() {
let btmsg_db_path = config.btmsg_db_path();
spawn_wal_checkpoint_task(sessions_db_path, btmsg_db_path);
// Load saved remote machines from database before managing state
let rm_clone = remote_manager.clone();
tauri::async_runtime::spawn(async move {
rm_clone.load_from_db().await;
});
app.manage(AppState {
pty_manager,
sidecar_manager,