You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge pull request #10 from CoreSecFrame/feature/file-manager
Refactor and improve code quality
This commit includes several code improvements and refactorings:
Refactored app/core/models.py for log counting:
Introduced a private helper method _count_logs_since in the SystemLog model to consolidate logic for counting logs based on time, level, and security status.
Updated get_error_count_last_24h and get_security_events_count_last_24h to use this new helper method, reducing code duplication.
Made security log retention configurable:
Added a SECURITY_LOG_RETENTION_DAYS configuration variable in app/config.py (defaulting to 90 days, settable via environment variable).
Modified the cleanup_old_logs method in SystemLog to use this configuration value instead of a hardcoded one.
Improved app/core/models.py documentation and readability:
Added a docstring to LogSearchQuery.to_dict().
Ensured dictionary definitions and SQLAlchemy queries in SystemLog methods are formatted for better readability.
Removed some redundant local imports of datetime and timedelta.
Refactored exception handling in app/auth/routes.py:
Introduced a private helper function _handle_auth_exception to standardize logging and flash messages for exceptions occurring during user login and registration.
Updated the login and register routes to use this helper, reducing boilerplate.
Also default terminal path changed to /home/$USER
0 commit comments