feat: web dashboard and playground work

The NexusDashboard-parity dashboard (dDashboardServer) and everything built on it on the experimental branch:
accounts, characters, properties and moderation tools, permissions shared with in-game slash commands, economy
reports, World 3D and property 3D views with client scenery, scheduled events (features, vanity changes, live
events, announcements, restarts), vanity files and events, the CDClient browser, the message inspector with saved
captures, chat filter tools, community challenges, live ops, the AI moderator helper, and the server-side changes
they need.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-09-26 17:52:10 -05:00
parent 854d02f509
commit e213a7aeff
681 changed files with 88310 additions and 1321 deletions

View File

@@ -37,6 +37,18 @@ dChatFilter::dChatFilter(const std::string& filepath, bool dontGenerateDCF) {
std::transform(name.begin(), name.end(), name.begin(), ::tolower); //Transform to lowercase
m_ApprovedWords.push_back(CalculateHash(name));
}
ReloadCustomWords();
}
void dChatFilter::ReloadCustomWords() {
m_CustomAllowedWords.clear();
m_CustomBlockedWords.clear();
// Words remembered as not allowed may be allowed now
m_UserUnapprovedWordCache.clear();
for (const auto& word : Database::Get()->GetChatFilterWords()) {
(word.allowed ? m_CustomAllowedWords : m_CustomBlockedWords).insert(CalculateHash(NormalizeWord(word.word)));
}
}
dChatFilter::~dChatFilter() {
@@ -112,7 +124,6 @@ std::set<std::pair<uint8_t, uint8_t>> dChatFilter::IsSentenceOkay(const std::str
std::stringstream sMessage(message);
std::string segment;
std::regex reg("(!*|\\?*|\\;*|\\.*|\\,*)");
std::set<std::pair<uint8_t, uint8_t>> listOfBadSegments;
@@ -121,16 +132,22 @@ std::set<std::pair<uint8_t, uint8_t>> dChatFilter::IsSentenceOkay(const std::str
while (std::getline(sMessage, segment, ' ')) {
std::string originalSegment = segment;
std::transform(segment.begin(), segment.end(), segment.begin(), ::tolower); //Transform to lowercase
segment = std::regex_replace(segment, reg, "");
segment = NormalizeWord(segment);
size_t hash = CalculateHash(segment);
// Blocked on the dashboard: stopped in every kind of chat
if (m_CustomBlockedWords.contains(hash)) {
listOfBadSegments.emplace(position, originalSegment.length());
position += originalSegment.length() + 1;
continue;
}
if (std::find(m_UserUnapprovedWordCache.begin(), m_UserUnapprovedWordCache.end(), hash) != m_UserUnapprovedWordCache.end() && allowList) {
listOfBadSegments.emplace(position, originalSegment.length());
}
if (std::find(m_ApprovedWords.begin(), m_ApprovedWords.end(), hash) == m_ApprovedWords.end() && allowList) {
if (std::find(m_ApprovedWords.begin(), m_ApprovedWords.end(), hash) == m_ApprovedWords.end() && !m_CustomAllowedWords.contains(hash) && allowList) {
m_UserUnapprovedWordCache.push_back(hash);
listOfBadSegments.emplace(position, originalSegment.length());
}

View File

@@ -1,4 +1,8 @@
#pragma once
#include <algorithm>
#include <cctype>
#include <set>
#include <unordered_set>
#include <vector>
#include <string>
@@ -26,11 +30,38 @@ public:
void ExportWordlistToDCF(const std::string& filepath, bool allowList);
std::set<std::pair<uint8_t, uint8_t>> IsSentenceOkay(const std::string& message, eGameMasterLevel gmLevel, bool allowList = true);
/**
* Load the words staff added on the dashboard (chat_filter_words) again, replacing the ones loaded before.
* Allowed words are accepted in whitelisted chat; blocked words are always stopped, even when a file allows them.
*/
void ReloadCustomWords();
// A word as the filter compares it: lower case, without ! ? ; . ,
static std::string NormalizeWord(std::string word) {
std::erase_if(word, [](char c) { return c == '!' || c == '?' || c == ';' || c == '.' || c == ','; });
std::transform(word.begin(), word.end(), word.begin(), ::tolower); //Transform to lowercase
return word;
}
// A message split into words (at spaces) the way the filter checks it
static std::vector<std::string> Words(const std::string& message) {
std::vector<std::string> words;
size_t start = 0;
while (start <= message.size()) {
const auto end = std::min(message.find(' ', start), message.size());
words.push_back(NormalizeWord(message.substr(start, end - start)));
start = end + 1;
}
return words;
}
private:
bool m_DontGenerateDCF;
std::vector<size_t> m_DeniedWords;
std::vector<size_t> m_ApprovedWords;
std::vector<size_t> m_UserUnapprovedWordCache;
std::unordered_set<size_t> m_CustomAllowedWords;
std::unordered_set<size_t> m_CustomBlockedWords;
//Private functions:
size_t CalculateHash(const std::string& word);