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

@@ -9,6 +9,9 @@
#include "ePermissionMap.h"
// Forward declare eActivityType for Activity struct
enum class eActivityType : uint32_t;
class ICharInfo {
public:
struct Info {
@@ -19,6 +22,35 @@ public:
bool needsRename{};
LWOCLONEID cloneId{};
ePermissionMap permissionMap{};
// Extended fields for dashboard
uint32_t level{};
uint64_t uscore{};
uint32_t zoneId{};
uint64_t lastLogin{};
uint64_t createdOn{};
};
struct Stats {
uint64_t totalCurrencyCollected{};
uint64_t totalBricksCollected{};
uint64_t totalSmashables{};
uint64_t totalQuickbuildsCompleted{};
uint64_t totalEnemiesSmashed{};
uint64_t totalRocketsUsed{};
uint64_t totalMissionsCompleted{};
uint64_t totalPetsTamed{};
};
struct InventoryItem {
LWOOBJID itemId{};
uint32_t count{};
int32_t slot{};
};
struct Activity {
uint64_t timestamp{};
eActivityType activity{};
uint32_t mapId{};
};
// Get the approved names of all characters.
@@ -46,6 +78,41 @@ public:
virtual void UpdateLastLoggedInCharacter(const LWOOBJID characterId) = 0;
virtual bool IsNameInUse(const std::string_view name) = 0;
// Get total count of characters
virtual uint32_t GetCharacterCount() = 0;
// Get paginated list of all characters
virtual std::vector<Info> GetAllCharactersPaginated(
uint32_t offset,
uint32_t limit,
const std::string& orderColumn = "id",
const std::string& orderDir = "DESC"
) = 0;
// Get characters with pending names (for moderation)
virtual std::vector<Info> GetCharactersWithPendingNames() = 0;
// Update character permission map (for restrictions)
virtual void UpdateCharacterPermissions(const LWOOBJID characterId, ePermissionMap permissions) = 0;
// Set needs rename flag
virtual void SetCharacterNeedsRename(const LWOOBJID characterId, bool needsRename) = 0;
// Get character statistics
virtual std::optional<Stats> GetCharacterStats(const LWOOBJID characterId) = 0;
// Get character inventory
virtual std::vector<InventoryItem> GetCharacterInventory(const LWOOBJID characterId) = 0;
// Get character activity history
virtual std::vector<Activity> GetCharacterActivity(const LWOOBJID characterId, uint32_t limit = 50) = 0;
// Rescue character to a safe zone
virtual void RescueCharacter(const LWOOBJID characterId, uint32_t zoneId) = 0;
// Delete character and all associated data
virtual void DeleteCharacter(const LWOOBJID characterId) = 0;
};
#endif //!__ICHARINFO__H__