Harden onion boot flow and deepen site surfaces

Add persistent onion key backup and restore, improve startup resilience, and flesh out the major site verticals with richer navigation, search coverage, and operator documentation.

Made-with: Cursor
This commit is contained in:
drjones
2026-04-07 21:35:52 -07:00
parent 52432dccfa
commit 78a071ba02
162 changed files with 21692 additions and 39 deletions

38
lib/storeCreditStorage.ts Normal file
View File

@@ -0,0 +1,38 @@
const USD_KEY = "cyberlux-usd-store-credit";
const TX_KEY = "cyberlux-btc-claimed-txids";
export function loadUsdStoreCredit(): number {
if (typeof window === "undefined") return 0;
try {
const raw = localStorage.getItem(USD_KEY);
if (!raw) return 0;
const n = Number.parseFloat(raw);
return Number.isFinite(n) ? Math.round(n * 100) / 100 : 0;
} catch {
return 0;
}
}
export function saveUsdStoreCredit(usd: number): void {
if (typeof window === "undefined") return;
const safe = Math.max(0, Math.round(usd * 100) / 100);
localStorage.setItem(USD_KEY, String(safe));
}
export function loadClaimedTxids(): string[] {
if (typeof window === "undefined") return [];
try {
const raw = localStorage.getItem(TX_KEY);
if (!raw) return [];
const parsed = JSON.parse(raw) as unknown;
if (!Array.isArray(parsed)) return [];
return parsed.map((x) => String(x)).filter((t) => /^[a-fA-F0-9]{64}$/.test(t));
} catch {
return [];
}
}
export function saveClaimedTxids(txids: string[]): void {
if (typeof window === "undefined") return;
localStorage.setItem(TX_KEY, JSON.stringify([...new Set(txids)]));
}