mirror of
https://github.com/Dingo-Shenanigans/ReSkate.git
synced 2026-10-28 03:27:07 +01:00
Fix costume merging, restrict server names, add Centrix tag
- Mod merge: rebuild a merged bundle's chunk metadata the way the game writes it (one record per chunk, in chunk GUID order), so costumes from different mods built on the same game costume keep their textures and meshes - Merge audit checks that layout, and there is a new unit test for it - Server names: only letters, numbers, spaces and - _ [ ] ( ), 1 to 64 characters; the server browser hides servers with other names - New Centrix tag from the backend's "centrix" list: blue and white name, badge and item animation, ranked after Dev and before Creator
This commit is contained in:
1 parent
0d5dfda243
commit
2cdc5ee8df
24 files changed
+645
-29
No files matched your search
+1
-1
@@ -38,7 +38,7 @@ straight away (players are told to rejoin). Turn this off with
|
||||
|
||||
ReSkateServer.json
|
||||
------------------
|
||||
name Shown in the browser (1-64 characters).
|
||||
name Shown in the browser: 1-64 letters, numbers, spaces and - _ [ ] ( ).
|
||||
map The map everyone skates, named like the game's load command:
|
||||
"San Vansterdam", "Isle of Grom", "Super Ultra Mega Resort",
|
||||
"Stadium 1", or a custom map such as "bbcity" (see Custom maps).
|
||||
|
||||
@@ -23,6 +23,7 @@ std::string text(const std::filesystem::path &file) {
|
||||
|
||||
int run() {
|
||||
using namespace dingosdk::server;
|
||||
using dingosdk::valid_server_name;
|
||||
const auto folder = std::filesystem::temp_directory_path() / "reskate_server_config_tests";
|
||||
std::filesystem::remove_all(folder);
|
||||
std::filesystem::create_directories(folder);
|
||||
@@ -47,6 +48,15 @@ int run() {
|
||||
const auto reloaded = load_config(file);
|
||||
check(reloaded.name == "Old Server" && !reloaded.boosts && reloaded.votes.map.percent == 60, "Values lost on rewrite");
|
||||
|
||||
// Server names: letters, digits, spaces and - _ [ ] ( ) only.
|
||||
check(valid_server_name("Old Server") && valid_server_name("[EU] Skate_Park-2 (24x7)") && valid_server_name("a"),
|
||||
"A plain server name was refused");
|
||||
check(!valid_server_name("") && !valid_server_name(std::string(65, 'a')) && !valid_server_name("Best! Server") &&
|
||||
!valid_server_name("caf\xC3\xA9") && !valid_server_name("a.b") && !valid_server_name("<b>x</b>") &&
|
||||
!valid_server_name(" padded") && !valid_server_name("padded ") && !valid_server_name("[]--()") &&
|
||||
!valid_server_name("two\nlines"),
|
||||
"A server name with other characters was accepted");
|
||||
|
||||
// An up-to-date file is left alone.
|
||||
const auto before = std::filesystem::last_write_time(file);
|
||||
added.clear();
|
||||
|
||||
@@ -230,7 +230,7 @@ std::optional<std::uint64_t> parse_scoring(std::string_view text) {
|
||||
}
|
||||
std::string config_error(const ServerConfig &c) {
|
||||
using namespace multiplayer;
|
||||
if (c.name.empty() || c.name.size() > 64 || !valid_member_name(c.name)) return "name must be 1 to 64 characters.";
|
||||
if (!valid_server_name(c.name)) return std::string("name must be ") + server_name_rule + ".";
|
||||
if (c.map.empty() || !valid_map_destination(map_destination(c.map)))
|
||||
return "map \"" + c.map + "\" is not a known map. Use a name like \"San Vansterdam\", or put the map's mod "
|
||||
"folder in Mods next to the server.";
|
||||
|
||||
@@ -1017,7 +1017,7 @@ std::string Host::command(std::string_view line, std::uint64_t admin) {
|
||||
return changed(rotation_text());
|
||||
}
|
||||
if (name == "name") {
|
||||
if (argument.empty() || argument.size() > 64 || !valid_member_name(argument)) return "Server names are 1 to 64 characters.";
|
||||
if (!valid_server_name(argument)) return std::string("Server names are ") + server_name_rule + ".";
|
||||
config_.name = argument;
|
||||
if (text::contains_bad_words(config_.name))
|
||||
return changed("Server renamed to " + config_.name +
|
||||
|
||||
Reference in new issue
Block a user