From f48caf90e884e414d94082fd942b377aade7c11a Mon Sep 17 00:00:00 2001 From: xia-chu <771730766@qq.com> Date: Mon, 9 Mar 2026 16:43:14 +0800 Subject: [PATCH] =?UTF-8?q?downloadFile=20http=20api=E6=94=AF=E6=8C=81secr?= =?UTF-8?q?et=E9=89=B4=E6=9D=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/WebApi.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/server/WebApi.cpp b/server/WebApi.cpp index 60d51bfb..b2c6bfdc 100755 --- a/server/WebApi.cpp +++ b/server/WebApi.cpp @@ -2374,15 +2374,20 @@ void installWebApi() { } }; - bool flag = NOTICE_EMIT(BroadcastHttpAccessArgs, Broadcast::kBroadcastHttpAccess, allArgs.parser, file_path, false, file_invoker, sender); - if (!flag) { - // 文件下载鉴权事件无人监听,不允许下载 [AUTO-TRANSLATED:5e02f0ce] - // No one is listening to the file download authentication event, download is not allowed - invoker(401, StrCaseMap {}, "None http access event listener"); + try { + CHECK_SECRET(); + // 校验secret成功,文件下载鉴权成功 + file_invoker("", "", 0); + } catch (...) { + bool flag = NOTICE_EMIT(BroadcastHttpAccessArgs, Broadcast::kBroadcastHttpAccess, allArgs.parser, file_path, false, file_invoker, sender); + if (!flag) { + // 文件下载鉴权事件无人监听,不允许下载 [AUTO-TRANSLATED:5e02f0ce] + // No one is listening to the file download authentication event, download is not allowed + invoker(401, StrCaseMap {}, "None http access event listener"); + } } }); - api_regist("/index/api/searchOnvifDevice",[](API_ARGS_MAP_ASYNC){ CHECK_SECRET(); CHECK_ARGS("timeout_ms");