diff --git a/server/WebApi.cpp b/server/WebApi.cpp index 7bfcc085..aabc57e3 100755 --- a/server/WebApi.cpp +++ b/server/WebApi.cpp @@ -718,7 +718,8 @@ static constexpr char kLoginedCookieName[] = "ZLM_LOGINED"; static constexpr size_t kUnLoginCookieLifeSeconds = 60; static constexpr size_t kLoginedCookieLifeSeconds = 24 * 3600; -void check_secret(toolkit::SockInfo &sender, mediakit::HttpSession::KeyValue &headerOut, const ArgsMap &allArgs, Json::Value &val) { +template +void check_secret(toolkit::SockInfo &sender, mediakit::HttpSession::KeyValue &headerOut, const HttpAllArgs &allArgs, Json::Value &val) { GET_CONFIG(bool, legacy_auth , API::kLegacyAuth); GET_CONFIG(std::string, api_secret, API::kSecret); @@ -744,6 +745,11 @@ void check_secret(toolkit::SockInfo &sender, mediakit::HttpSession::KeyValue &he } } } + +template void check_secret(toolkit::SockInfo &, mediakit::HttpSession::KeyValue &, const HttpAllArgs &, Json::Value &); +template void check_secret(toolkit::SockInfo &, mediakit::HttpSession::KeyValue &, const HttpAllArgs &, Json::Value &); +template void check_secret(toolkit::SockInfo &, mediakit::HttpSession::KeyValue &, const HttpAllArgs &, Json::Value &); + /** * 安装api接口 * 所有api都支持GET和POST两种方式 diff --git a/server/WebApi.h b/server/WebApi.h index a573e494..cd642f0e 100755 --- a/server/WebApi.h +++ b/server/WebApi.h @@ -234,7 +234,8 @@ bool checkArgs(Args &args, const Key &key, const KeyTypes &...keys) { // Check whether the http parameters contain the secret key, the ip of 127.0.0.1 does not check the key // 同时检测是否在ip白名单内 [AUTO-TRANSLATED:d12f963d] // Check whether it is in the ip whitelist at the same time -void check_secret(toolkit::SockInfo &sender, mediakit::HttpSession::KeyValue &headerOut, const ArgsMap &allArgs, Json::Value &val); +template +void check_secret(toolkit::SockInfo &sender, mediakit::HttpSession::KeyValue &headerOut, const HttpAllArgs &allArgs, Json::Value &val); #define CHECK_SECRET() check_secret(sender, headerOut, allArgs, val) void installWebApi();