mirror of
https://github.com/Dingo-Shenanigans/ReSkate.git
synced 2026-10-23 19:56:00 +02:00
The bad-word list now comes from the ReSkate backend's Words page, in the same /api/v1/steam-ids answer the game and servers already read. It has two lists: filtered words, and words not allowed in chat at all. Until the backend has any words the built-in list stays in use; once it does, its lists replace the built-in one. Filtered words work as before: masked for players with the chat filter on, and not allowed in server or lobby names. Words not allowed at all are filtered the same way, and a chat message with one is not passed on. Its player is warned each time, and after three warnings the next one gets them kicked. Dedicated servers: new players setting word_warnings (default 3, 1 to 10, 0 switches the rule off). The count lasts while the server runs, so a kicked player who joins again is kicked at their next one. Party chat and commands are checked too, and each warning and kick is logged under [words]. The lists are read whenever global bans or word warnings are on. Player lobbies: the host's game applies the same rule to its guests, with three warnings.
28 lines
1.2 KiB
C++
28 lines
1.2 KiB
C++
#pragma once
|
|
#include <cstddef>
|
|
#include <string>
|
|
#include <string_view>
|
|
|
|
// The ReSkate backend's ban list (its admin panel's Bans page), which a dedicated
|
|
// server enforces beside its own: Host::tick turns those players away
|
|
// (multiplayer::reskate_banned). The server reads the list at startup and every
|
|
// ten minutes; until it has, and while the backend cannot be reached, it bans
|
|
// nobody by it.
|
|
namespace dingosdk::server {
|
|
struct BanListCheck {
|
|
bool ok{};
|
|
bool changed{}; // the ban list is not the one read before (or is the first)
|
|
std::size_t banned{}; // players on it
|
|
// The chat word lists that came with it (word_lists.h): whether they are new, and their sizes.
|
|
bool words_changed{};
|
|
std::size_t filtered_words{}, forbidden_words{};
|
|
std::string problem; // why it could not be read, or empty
|
|
};
|
|
// Puts the backend's answer (the JSON of developer_identity.h) in use. An answer
|
|
// that is not the lists changes nothing.
|
|
BanListCheck use_ban_list(std::string_view answer);
|
|
// Asks the backend and does the same; blocks for a few seconds at most. Windows
|
|
// asks over WinHTTP; Linux runs curl, which has to be installed.
|
|
BanListCheck read_global_bans();
|
|
} // namespace dingosdk::server
|