Add per-peer auto-accept, disconnect, copy snip, and add-by-ID
- Auto-accept toggle per trusted peer (keyring.autoAccept); only activates when peer is cryptographically verified — unverified connections always prompt regardless of setting - Disconnect button on connected screen returns to idle with full state reset - Copy snip: copies own peer ID as a flit-peer:<base64> string for sharing out-of-band (no QR needed for initial pairing) - Add peer by ID: paste a raw hex peer ID or flit-peer: snip in Invite new tab to add directly to keyring and connect without QR - Own peer ID always visible at bottom of idle screen - Restructured known-device row for mobile: secondary actions (Auto/Rename/Forget) on top line, Connect full-width below Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,7 @@ export interface TrustedPeer {
|
||||
id: string // hex Ed25519 pubkey
|
||||
label: string
|
||||
addedAt: number
|
||||
autoAccept?: boolean
|
||||
}
|
||||
|
||||
const KEY = 'flit_keyring'
|
||||
@@ -19,6 +20,11 @@ export function addTrusted(id: string, label: string): void {
|
||||
localStorage.setItem(KEY, JSON.stringify(peers))
|
||||
}
|
||||
|
||||
export function setAutoAccept(id: string, value: boolean): void {
|
||||
const peers = listTrusted().map(p => p.id === id ? { ...p, autoAccept: value } : p)
|
||||
localStorage.setItem(KEY, JSON.stringify(peers))
|
||||
}
|
||||
|
||||
export function removeTrusted(id: string): void {
|
||||
localStorage.setItem(KEY, JSON.stringify(listTrusted().filter(p => p.id !== id)))
|
||||
}
|
||||
@@ -26,3 +32,7 @@ export function removeTrusted(id: string): void {
|
||||
export function isTrusted(id: string): boolean {
|
||||
return listTrusted().some(p => p.id === id)
|
||||
}
|
||||
|
||||
export function shouldAutoAccept(id: string): boolean {
|
||||
return listTrusted().some(p => p.id === id && p.autoAccept === true)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user