refactor: consolidate blockchain explorer into single app and update backup ignore patterns
- Remove standalone explorer-web app (README, HTML, package files) - Add /web endpoint to blockchain-explorer for web interface access - Update .gitignore to exclude application backup archives (*.tar.gz, *.zip) - Add backup documentation files to .gitignore (BACKUP_INDEX.md, README.md) - Consolidate explorer functionality into main blockchain-explorer application
This commit is contained in:
33
apps/marketplace/src/lib/auth.ts
Normal file
33
apps/marketplace/src/lib/auth.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
export interface MarketplaceSession {
|
||||
token: string;
|
||||
expiresAt: number;
|
||||
}
|
||||
|
||||
const STORAGE_KEY = "marketplace-session";
|
||||
|
||||
export function saveSession(session: MarketplaceSession): void {
|
||||
localStorage.setItem(STORAGE_KEY, JSON.stringify(session));
|
||||
}
|
||||
|
||||
export function loadSession(): MarketplaceSession | null {
|
||||
const raw = localStorage.getItem(STORAGE_KEY);
|
||||
if (!raw) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
const data = JSON.parse(raw) as MarketplaceSession;
|
||||
if (typeof data.token === "string" && typeof data.expiresAt === "number") {
|
||||
if (data.expiresAt > Date.now()) {
|
||||
return data;
|
||||
}
|
||||
clearSession();
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn("Failed to parse stored marketplace session", error);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
export function clearSession(): void {
|
||||
localStorage.removeItem(STORAGE_KEY);
|
||||
}
|
||||
Reference in New Issue
Block a user