Files
homelable/frontend/src/utils/ipDisplay.ts
T
Pouzor b52bbc6d9f feat(settings): move Hide IP toggle into Settings modal, persist it
Hide-IP was a sidebar button held only in memory, so it reset on reload.
Moved it into the Settings modal Canvas section and persist it to
localStorage (new ipDisplay util); the canvas store now seeds hideIp from
storage and writes through on toggleHideIp/setHideIp. Settings is now also
reachable in standalone (no-backend) builds, with the backend-only status
interval guarded so the modal still works there.

ha-relevant: yes
2026-06-05 11:26:28 +02:00

22 lines
485 B
TypeScript

// Persisted client-side preference for masking IP addresses on the canvas.
// Kept in localStorage (per-user UI preference, not canvas data) so it
// survives a page reload.
const KEY = 'homelable.hideIp'
export function readHideIp(): boolean {
try {
return localStorage.getItem(KEY) === 'true'
} catch {
return false
}
}
export function writeHideIp(value: boolean): void {
try {
localStorage.setItem(KEY, String(value))
} catch {
/* quota / SSR */
}
}