Files
test/lib/stats.ts
SarTron-NorthBlue bed824059a Initialize Next.js project with essential configurations and components
- Added .gitignore to exclude unnecessary files and directories.
- Created next.config.js for Next.js configuration.
- Set up package.json and package-lock.json with dependencies including Next.js, React, and TypeScript.
- Implemented Tailwind CSS for styling with a dedicated tailwind.config.ts.
- Developed core application structure including layout, pages, and components for header, footer, and various sections (Hero, Services, Pricing, etc.).
- Integrated contact form functionality using nodemailer for email handling.
- Established global styles in globals.css and added animations with Framer Motion.
- Included README.md for project documentation and setup instructions.
2025-11-14 16:15:21 +04:00

46 lines
1.3 KiB
TypeScript

/**
* Utilitaire pour gérer les statistiques de sécurité
* Permet d'incrémenter le compteur de tentatives bloquées
*/
/**
* Déclenche un événement pour incrémenter le compteur de tentatives bloquées
* Cette fonction peut être appelée depuis n'importe où dans l'application
* lorsque une tentative d'intrusion ou d'accès non autorisé est détectée
*/
export function incrementBlockedAttempts() {
if (typeof window !== 'undefined') {
const event = new CustomEvent('blocked-attempt')
window.dispatchEvent(event)
}
}
/**
* Récupère le nombre actuel de tentatives bloquées depuis le localStorage
*/
export function getBlockedAttempts(): number {
if (typeof window !== 'undefined') {
const saved = localStorage.getItem('runlock_blocked_attempts')
if (saved) {
const count = parseInt(saved, 10)
if (!isNaN(count)) {
return count
}
}
}
return 0
}
/**
* Réinitialise le compteur de tentatives bloquées
*/
export function resetBlockedAttempts() {
if (typeof window !== 'undefined') {
localStorage.setItem('runlock_blocked_attempts', '0')
// Déclencher un événement pour mettre à jour l'UI
const event = new CustomEvent('blocked-attempt-reset')
window.dispatchEvent(event)
}
}