From ecc133d6052ecb39047f88963d02de7984cc2fa7 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Thu, 6 Jun 2019 15:33:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E7=9A=84hook=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6=E4=B8=8D=E5=81=9A=E9=89=B4=E6=9D=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/WebHook.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/server/WebHook.cpp b/server/WebHook.cpp index abfa7df1..d28068fb 100644 --- a/server/WebHook.cpp +++ b/server/WebHook.cpp @@ -164,7 +164,7 @@ void installWebHook(){ GET_CONFIG(string,hook_stream_none_reader,Hook::kOnStreamNoneReader); NoticeCenter::Instance().addListener(nullptr,Broadcast::kBroadcastMediaPublish,[](BroadcastMediaPublishArgs){ - if(!hook_enable || args._param_strs == hook_adminparams || hook_publish.empty()){ + if(!hook_enable || args._param_strs == hook_adminparams || hook_publish.empty() || sender.get_peer_ip() == "127.0.0.1"){ invoker(""); return; } @@ -180,7 +180,7 @@ void installWebHook(){ }); NoticeCenter::Instance().addListener(nullptr,Broadcast::kBroadcastMediaPlayed,[](BroadcastMediaPlayedArgs){ - if(!hook_enable || args._param_strs == hook_adminparams || hook_play.empty()){ + if(!hook_enable || args._param_strs == hook_adminparams || hook_play.empty() || sender.get_peer_ip() == "127.0.0.1"){ invoker(""); return; } @@ -195,7 +195,7 @@ void installWebHook(){ }); NoticeCenter::Instance().addListener(nullptr,Broadcast::kBroadcastFlowReport,[](BroadcastFlowReportArgs){ - if(!hook_enable || args._param_strs == hook_adminparams || hook_flowreport.empty()){ + if(!hook_enable || args._param_strs == hook_adminparams || hook_flowreport.empty() || sender.get_peer_ip() == "127.0.0.1"){ return; } auto body = make_json(args); @@ -214,7 +214,7 @@ void installWebHook(){ //监听kBroadcastOnGetRtspRealm事件决定rtsp链接是否需要鉴权(传统的rtsp鉴权方案)才能访问 NoticeCenter::Instance().addListener(nullptr,Broadcast::kBroadcastOnGetRtspRealm,[](BroadcastOnGetRtspRealmArgs){ - if(!hook_enable || args._param_strs == hook_adminparams || hook_rtsp_realm.empty()){ + if(!hook_enable || args._param_strs == hook_adminparams || hook_rtsp_realm.empty() || sender.get_peer_ip() == "127.0.0.1"){ //无需认证 invoker(""); return; @@ -311,7 +311,8 @@ void installWebHook(){ #endif //ENABLE_MP4V2 NoticeCenter::Instance().addListener(nullptr,Broadcast::kBroadcastShellLogin,[](BroadcastShellLoginArgs){ - if(!hook_enable || hook_shell_login.empty()){ + if(!hook_enable || hook_shell_login.empty() || sender.get_peer_ip() == "127.0.0.1"){ + invoker(""); return; } ArgsType body;