eqemu-server/zone/zone_cli.cpp
Chris Miles 0615864d51
[Databuckets] Nested Databuckets Protections and Improvements (#4748)
* Check for valid JSON before using it

* Do not allow nested keys to set be set an expiration

* Prevent overwriting of existing object or array

* Nested deletion support

* Update data_bucket.cpp

* Test cases

* More test cases, fix

* Update databuckets.cpp

* Update databuckets.cpp

* Basic databucket tests

* Update databuckets.cpp

* Update databuckets.cpp
2025-03-04 13:16:21 -06:00

46 lines
1.3 KiB
C++

#include "zone_cli.h"
#include "../common/cli/eqemu_command_handler.h"
#include <string.h>
bool ZoneCLI::RanConsoleCommand(int argc, char **argv)
{
return argc > 1 && (strstr(argv[1], ":") != nullptr || strstr(argv[1], "--") != nullptr);
}
bool ZoneCLI::RanSidecarCommand(int argc, char **argv)
{
return argc > 1 && (strstr(argv[1], "sidecar:") != nullptr);
}
bool ZoneCLI::RanTestCommand(int argc, char **argv)
{
return argc > 1 && (strstr(argv[1], "tests:") != nullptr);
}
void ZoneCLI::CommandHandler(int argc, char **argv)
{
if (argc == 1) { return; }
argh::parser cmd;
cmd.parse(argc, argv, argh::parser::PREFER_PARAM_FOR_UNREG_OPTION);
EQEmuCommand::DisplayDebug(cmd);
// Declare command mapping
auto function_map = EQEmuCommand::function_map;
// Register commands
function_map["benchmark:databuckets"] = &ZoneCLI::BenchmarkDatabuckets;
function_map["sidecar:serve-http"] = &ZoneCLI::SidecarServeHttp;
function_map["tests:databuckets"] = &ZoneCLI::DataBuckets;
function_map["tests:npc-handins"] = &ZoneCLI::NpcHandins;
function_map["tests:npc-handins-multiquest"] = &ZoneCLI::NpcHandinsMultiQuest;
EQEmuCommand::HandleMenu(function_map, cmd, argc, argv);
}
#include "cli/databuckets.cpp"
#include "cli/benchmark_databuckets.cpp"
#include "cli/sidecar_serve_http.cpp"
#include "cli/npc_handins.cpp"
#include "cli/npc_handins_multiquest.cpp"