diff options
author | Sadie Powell <sadie@witchery.services> | 2025-05-04 14:39:20 +0100 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2025-05-04 14:39:20 +0100 |
commit | 72f5e3580fdc68161642ee0f11a354dbc74fffeb (patch) | |
tree | e1bd6f46e8a76fe8194425e1af03e421bf2faafe /modules | |
parent | 4b854d39357cbcfa43eb833949d48a49b0420ad6 (diff) |
Also allow hashed RPC tokens in the config file.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/extra/xmlrpc.cpp | 12 | ||||
-rw-r--r-- | modules/rpc/jsonrpc.cpp | 12 |
2 files changed, 14 insertions, 10 deletions
diff --git a/modules/extra/xmlrpc.cpp b/modules/extra/xmlrpc.cpp index 24f5f5f0e..3e6a8af76 100644 --- a/modules/extra/xmlrpc.cpp +++ b/modules/extra/xmlrpc.cpp @@ -324,12 +324,14 @@ public: for (int i = 0; i < modconf.CountBlock("token"); ++i) { const auto &block = modconf.GetBlock("token", i); - const auto &token = block.Get<const Anope::string>("token"); - if (!token.empty()) + + RPC::Token token; + token.token = block.Get<const Anope::string>("token"); + if (!token.token.empty()) { - std::vector<Anope::string> methods; - spacesepstream(block.Get<const Anope::string>("methods")).GetTokens(methods); - xmlrpcinterface.tokens.emplace(token, methods); + token.token_hash = block.Get<const Anope::string>("token_hash"); + spacesepstream(block.Get<const Anope::string>("methods")).GetTokens(token.methods); + xmlrpcinterface.tokens.emplace_back(token); } } diff --git a/modules/rpc/jsonrpc.cpp b/modules/rpc/jsonrpc.cpp index 8069ed8eb..163658495 100644 --- a/modules/rpc/jsonrpc.cpp +++ b/modules/rpc/jsonrpc.cpp @@ -281,12 +281,14 @@ public: for (int i = 0; i < modconf.CountBlock("token"); ++i) { const auto &block = modconf.GetBlock("token", i); - const auto &token = block.Get<const Anope::string>("token"); - if (!token.empty()) + + RPC::Token token; + token.token = block.Get<const Anope::string>("token"); + if (!token.token.empty()) { - std::vector<Anope::string> methods; - spacesepstream(block.Get<const Anope::string>("methods")).GetTokens(methods); - jsonrpcinterface.tokens.emplace(token, methods); + token.token_hash = block.Get<const Anope::string>("token_hash"); + spacesepstream(block.Get<const Anope::string>("methods")).GetTokens(token.methods); + jsonrpcinterface.tokens.emplace_back(token); } } |