From 3514376a97197e16aaa42464c70921852fe38a3c Mon Sep 17 00:00:00 2001 From: xia-chu <771730766@qq.com> Date: Sun, 22 Feb 2026 18:45:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dvideostack=E5=BC=80=E5=90=AF?= =?UTF-8?q?=E5=90=8E=E7=BC=96=E8=AF=91=E5=A4=B1=E8=B4=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/WebApi.cpp | 8 +++++++- server/WebApi.h | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) 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();