- Remove executable permissions from configuration files (.editorconfig, .env.example, .gitignore) - Remove executable permissions from documentation files (README.md, LICENSE, SECURITY.md) - Remove executable permissions from web assets (HTML, CSS, JS files) - Remove executable permissions from data files (JSON, SQL, YAML, requirements.txt) - Remove executable permissions from source code files across all apps - Add executable permissions to Python
34 lines
832 B
TypeScript
34 lines
832 B
TypeScript
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);
|
|
}
|