Add digital catalog with shareable flipbook and ktg.montzar.ir deploy files.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-19 14:37:49 +03:30
co-authored by Cursor
commit a8374e7d6c
54 changed files with 8462 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
export type RateLimiter = {
check: (ip: string) => boolean;
};
export function createRateLimiter(
limit: number,
windowMs: number,
now: () => number = () => Date.now(),
): RateLimiter {
const hits = new Map<string, number[]>();
return {
check(ip: string) {
const t = now();
const recent = (hits.get(ip) ?? []).filter((ts) => t - ts < windowMs);
if (recent.length >= limit) {
hits.set(ip, recent);
return false;
}
recent.push(t);
hits.set(ip, recent);
return true;
},
};
}