downloadFile http api支持secret鉴权

This commit is contained in:
xia-chu 2026-03-09 16:43:14 +08:00
parent eef858ffd3
commit f48caf90e8

View File

@ -2374,15 +2374,20 @@ void installWebApi() {
} }
}; };
bool flag = NOTICE_EMIT(BroadcastHttpAccessArgs, Broadcast::kBroadcastHttpAccess, allArgs.parser, file_path, false, file_invoker, sender); try {
if (!flag) { CHECK_SECRET();
// 文件下载鉴权事件无人监听,不允许下载 [AUTO-TRANSLATED:5e02f0ce] // 校验secret成功文件下载鉴权成功
// No one is listening to the file download authentication event, download is not allowed file_invoker("", "", 0);
invoker(401, StrCaseMap {}, "None http access event listener"); } 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){ api_regist("/index/api/searchOnvifDevice",[](API_ARGS_MAP_ASYNC){
CHECK_SECRET(); CHECK_SECRET();
CHECK_ARGS("timeout_ms"); CHECK_ARGS("timeout_ms");