mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-21 19:45:53 +00:00
Make a simple way to extend the RPC command set without modifying core server code.
This makes it easy to add self-contained modules that can be controlled and is also useful for one-off and troubleshooting commands.
This commit is contained in:
@@ -53,7 +53,23 @@ std::string EncodeBase64(const std::string& s)
|
||||
|
||||
Json::Value RPCParser::parseAsIs(const Json::Value& jvParams)
|
||||
{
|
||||
return Json::Value(Json::objectValue);
|
||||
Json::Value v(Json::objectValue);
|
||||
if (jvParams.isArray() && (jvParams.size() > 0))
|
||||
v["params"] = jvParams;
|
||||
return v;
|
||||
}
|
||||
|
||||
Json::Value RPCParser::parseInternal(const Json::Value& jvParams)
|
||||
{
|
||||
Json::Value v(Json::objectValue);
|
||||
v["internal_command"] = jvParams[0u];
|
||||
|
||||
Json::Value params(Json::arrayValue);
|
||||
for (unsigned i = 1; i < jvParams.size(); ++i)
|
||||
params.append(jvParams[i]);
|
||||
v["params"] = params;
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
// account_info <account>|<nickname>|<account_public_key>
|
||||
@@ -481,6 +497,8 @@ Json::Value RPCParser::parseCommand(std::string strMethod, Json::Value jvParams)
|
||||
{ "wallet_propose", &RPCParser::parseWalletPropose, 0, 1 },
|
||||
{ "wallet_seed", &RPCParser::parseWalletSeed, 0, 1 },
|
||||
|
||||
{ "internal", &RPCParser::parseInternal, 1, -1 },
|
||||
|
||||
#if ENABLE_INSECURE
|
||||
// XXX Unnecessary commands which should be removed.
|
||||
{ "login", &RPCParser::parseLogin, 2, 2 },
|
||||
|
||||
Reference in New Issue
Block a user