feat(dm): add multi-path management and per-contact no-flood toggle

- New `contact_paths` table for storing multiple user-configured paths per contact
- New `no_auto_flood` column on contacts to prevent automatic DIRECT→FLOOD reset
- Path rotation during DM retry: cycles through configured paths before optional flood fallback
- REST API for path CRUD, reorder, reset-to-flood, repeater listing
- Path management UI in Contact Info modal: add/delete/reorder paths, repeater picker with uniqueness warnings, hash size selector (1B/2B/3B)
- "No Flood" per-contact toggle in modal footer

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
MarekWo
2026-03-22 21:20:51 +01:00
parent dd81fbf0b7
commit 8cc67f77d5
6 changed files with 1091 additions and 50 deletions
+13
View File
@@ -115,6 +115,18 @@ CREATE TABLE IF NOT EXISTS paths (
received_at TEXT NOT NULL DEFAULT (datetime('now'))
);
-- User-configured paths for DM retry rotation
CREATE TABLE IF NOT EXISTS contact_paths (
id INTEGER PRIMARY KEY AUTOINCREMENT,
contact_pubkey TEXT NOT NULL REFERENCES contacts(public_key) ON DELETE CASCADE,
path_hex TEXT NOT NULL DEFAULT '', -- raw hex path bytes (e.g. "5e34e761")
hash_size INTEGER NOT NULL DEFAULT 1, -- bytes per hop: 1, 2, or 3
label TEXT NOT NULL DEFAULT '', -- friendly label (e.g. "via Zalesie")
is_primary INTEGER NOT NULL DEFAULT 0, -- 1 = priority/default path
sort_order INTEGER NOT NULL DEFAULT 0, -- lower = tried first during rotation
created_at TEXT NOT NULL DEFAULT (datetime('now'))
);
-- Advertisements (replaces .adverts.jsonl)
CREATE TABLE IF NOT EXISTS advertisements (
id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -174,6 +186,7 @@ CREATE INDEX IF NOT EXISTS idx_acks_code ON acks(expected_ack);
CREATE INDEX IF NOT EXISTS idx_echoes_pkt ON echoes(pkt_payload);
CREATE INDEX IF NOT EXISTS idx_adv_pubkey ON advertisements(public_key, timestamp);
CREATE INDEX IF NOT EXISTS idx_contacts_name ON contacts(name);
CREATE INDEX IF NOT EXISTS idx_cp_contact ON contact_paths(contact_pubkey, sort_order);
-- ============================================================
-- Full-Text Search (FTS5)