Add comprehensive unit tests for Security, UserModel, and Validation utilities
- Implemented SecurityTest to validate token generation, CSRF protection, input sanitization, and rate limiting. - Created UserModelTest to ensure correct database operations for user management, including creation, updating, banning, and fetching active users. - Developed ValidationTest to verify input validation and sanitization for user IDs, nicknames, messages, and API requests. - Introduced Security and Validation utility classes with methods for secure token generation, input sanitization, and comprehensive validation rules.
This commit is contained in:
parent
5692874b10
commit
41cd7a4fd8
32 changed files with 5796 additions and 368 deletions
|
|
@ -680,48 +680,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
// Initialize event listeners
|
||||
function initializeEventListeners() {
|
||||
// Keyboard shortcuts
|
||||
DOMUtils.addEvent(document, 'keydown', handleKeyboardShortcuts);
|
||||
|
||||
// Window resize for mobile responsiveness
|
||||
DOMUtils.addEvent(window, 'resize', handleWindowResize);
|
||||
|
||||
// Page visibility for notification clearing
|
||||
DOMUtils.addEvent(document, 'visibilitychange', handleVisibilityChange);
|
||||
|
||||
// Touch gesture support for mobile
|
||||
const videoSection = document.getElementById('videoSection');
|
||||
if (videoSection) {
|
||||
// Swipe gestures on video area for chat toggle
|
||||
DOMUtils.addEvent(videoSection, 'touchstart', handleTouchStart, { passive: true });
|
||||
DOMUtils.addEvent(videoSection, 'touchmove', handleTouchMove, { passive: true });
|
||||
DOMUtils.addEvent(videoSection, 'touchend', handleTouchEnd, { passive: true });
|
||||
|
||||
// Double-tap on video for fullscreen
|
||||
DOMUtils.addEvent(videoSection, 'touchend', handleVideoDoubleTap);
|
||||
}
|
||||
|
||||
// Pull-to-refresh on the whole document (only on mobile)
|
||||
DOMUtils.addEvent(document, 'touchstart', handlePullToRefreshTouchStart, { passive: true });
|
||||
DOMUtils.addEvent(document, 'touchmove', handlePullToRefreshTouchMove, { passive: false });
|
||||
DOMUtils.addEvent(document, 'touchend', handlePullToRefreshTouchEnd, { passive: true });
|
||||
|
||||
// Mobile navigation buttons
|
||||
const mobileNav = document.getElementById('mobileNav');
|
||||
if (mobileNav) {
|
||||
mobileNav.addEventListener('click', function(event) {
|
||||
const button = event.target.closest('.mobile-nav-btn');
|
||||
if (button && button.dataset.action) {
|
||||
event.preventDefault();
|
||||
handleMobileNavAction(button.dataset.action);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
AppLogger.log('UI controls event listeners initialized');
|
||||
}
|
||||
|
||||
// HTML escape utility function
|
||||
function escapeHtml(text) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue