Add dashboard audit log and configuration management

- Implemented dashboard audit logging with InsertAuditLog, GetRecentAuditLogs, GetAuditLogsByIP, and CleanupOldAuditLogs methods.
- Created dashboard configuration management with GetDashboardConfig and SetDashboardConfig methods.
- Added new tables for dashboard_audit_log and dashboard_config in both MySQL and SQLite migrations.
- Updated CMakeLists to include Crow and ASIO for dashboard server functionality.
- Enhanced existing database classes to support new dashboard features, including character, play key, and property management.
- Added new methods for retrieving and managing play keys, properties, and pet names.
- Updated TestSQLDatabase to include stubs for new dashboard-related methods.
- Modified shared and dashboard configuration files for new settings.
This commit is contained in:
Aaron Kimbrell
2026-04-22 11:01:41 -05:00
parent d532a9b063
commit e3467465b4
92 changed files with 9133 additions and 77 deletions

View File

@@ -0,0 +1,21 @@
CREATE TABLE IF NOT EXISTS dashboard_audit_log (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
timestamp BIGINT NOT NULL,
ip_address VARCHAR(45) NOT NULL,
endpoint VARCHAR(255) NOT NULL,
method VARCHAR(10) NOT NULL,
user_agent TEXT,
response_code INT NOT NULL,
INDEX idx_dashboard_audit_log_timestamp (timestamp),
INDEX idx_dashboard_audit_log_ip (ip_address)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS dashboard_config (
config_key VARCHAR(100) PRIMARY KEY,
config_value TEXT NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
INSERT IGNORE INTO dashboard_config (config_key, config_value) VALUES ('rate_limit_enabled', '1');
INSERT IGNORE INTO dashboard_config (config_key, config_value) VALUES ('rate_limit_requests', '100');
INSERT IGNORE INTO dashboard_config (config_key, config_value) VALUES ('rate_limit_window', '60');
INSERT IGNORE INTO dashboard_config (config_key, config_value) VALUES ('audit_retention_days', '90');

View File

@@ -0,0 +1,19 @@
CREATE TABLE IF NOT EXISTS dashboard_audit_log (
id INTEGER PRIMARY KEY AUTOINCREMENT,
timestamp INTEGER NOT NULL,
ip_address TEXT NOT NULL,
endpoint TEXT NOT NULL,
method TEXT NOT NULL,
user_agent TEXT,
response_code INTEGER NOT NULL
);
CREATE TABLE IF NOT EXISTS dashboard_config (
config_key TEXT PRIMARY KEY,
config_value TEXT NOT NULL
);
INSERT OR IGNORE INTO dashboard_config (config_key, config_value) VALUES ('rate_limit_enabled', '1');
INSERT OR IGNORE INTO dashboard_config (config_key, config_value) VALUES ('rate_limit_requests', '100');
INSERT OR IGNORE INTO dashboard_config (config_key, config_value) VALUES ('rate_limit_window', '60');
INSERT OR IGNORE INTO dashboard_config (config_key, config_value) VALUES ('audit_retention_days', '90');