feat(super-user): auto-activate via subdomain and add persistent cache#256
feat(super-user): auto-activate via subdomain and add persistent cache#256AugustoL wants to merge 3 commits intoopenscan-explorer:release/v1.2.2-afrom
Conversation
Add super user mode auto-activation when accessing via the "super" subdomain (e.g., super.openscan.io). Add a persistent localStorage cache with LRU eviction for blockchain data when in super user mode, with configurable size limit (5-100MB) and a dedicated Settings section. Closes openscan-explorer#240, closes openscan-explorer#242
|
🚀 Preview: https://pr-256--openscan.netlify.app |
Add violet accent glow on navbar and footer borders, a "Super User" badge in the navbar, and violet styling on the active toggle button to provide clear visual feedback when super user mode is enabled.
…o feat/improve-super-user-mode # Conflicts: # src/components/pages/settings/index.tsx
🧪 Persistent Cache — Test ReportPreview: ✅ What works
|
Description
Improves super user mode with two enhancements: auto-activation via the
supersubdomain and a persistent localStorage cache for blockchain data.Related Issue
Closes #240, Closes #242
Type of Change
Changes Made
Issue #240 — Subdomain-based super user activation
supersubdomain entry tosrc/config/subdomains.tssosuper.openscan.iois recognizedSettingsContext.tsx, detectsupersubdomain on init and forceisSuperUser: trueIssue #242 — Persistent storage in super user mode
persistentCacheSizeMBfield toUserSettingstype (default: 10 MB)src/utils/persistentCache.ts— localStorage-based cache with LRU eviction,OPENSCAN_PCACHE_prefix keys, andQuotaExceededErrorhandlingsrc/hooks/usePersistentCache.ts— React hook providinggetCached/setCachedthat are no-ops when super user mode is disabledisSuperUseris trueclearPersistentCache()into the existingclearAllCaches()functionScreenshots (if applicable)
N/A — Settings section only visible when super user mode is active.
Checklist
npm run format:fixandnpm run lint:fixnpm run typecheckwith no errors (pre-existing errors only)npm run test:runAdditional Notes
The
usePersistentCachehook is ready for page-level components (block, tx, address pages) to integrate — they can wrap their data fetches withgetCached/setCachedto persist blockchain data across sessions.