website refactor

This commit is contained in:
2026-01-16 01:00:03 +01:00
parent ce7be39155
commit a98e3e3166
286 changed files with 5522 additions and 5261 deletions

View File

@@ -37,7 +37,7 @@ export interface CacheEntry<T> {
* Simple in-memory cache for API responses
*/
class ResponseCache {
private cache = new Map<string, CacheEntry<any>>();
private cache = new Map<string, CacheEntry<unknown>>();
/**
* Get cached data if not expired
@@ -46,20 +46,20 @@ class ResponseCache {
const entry = this.cache.get(key);
if (!entry) return null;
if (new Date() > entry.expiry) {
if (new globalThis.Date() > entry.expiry) {
this.cache.delete(key);
return null;
}
return entry.data;
return entry.data as T;
}
/**
* Set cached data with expiry
*/
set<T>(key: string, data: T, ttlMs: number = 300000): void {
const now = new Date();
const expiry = new Date(now.getTime() + ttlMs);
const now = new globalThis.Date();
const expiry = new globalThis.Date(now.getTime() + ttlMs);
this.cache.set(key, {
data,
@@ -133,7 +133,7 @@ export async function withGracefulDegradation<T>(
'API unavailable and no fallback provided',
'NETWORK_ERROR',
{
timestamp: new Date().toISOString(),
timestamp: new globalThis.Date().toISOString(),
}
);
}