@@ -161,51 +161,58 @@ void cls_webu_text::main()
161161 (webua->uri_cmd1 == " detection" ) &&
162162 (webua->uri_cmd2 == " connection" )) {
163163 connection ();
164- } else if (
165- (webua->uri_cmd1 == " detection" ) &&
166- (webua->uri_cmd2 == " pause" ) &&
167- (webua->is_admin == true )) {
168- webu_post->action_pause_on ();
169- } else if (
170- (webua->uri_cmd1 == " detection" ) &&
171- (webua->uri_cmd2 == " start" ) &&
172- (webua->is_admin == true )) {
173- webu_post->action_pause_off ();
174- } else if (
175- (webua->uri_cmd1 == " action" ) &&
176- (webua->uri_cmd2 == " eventend" ) &&
177- (webua->is_admin == true )) {
178- webu_post->action_eventend ();
179- } else if (
180- (webua->uri_cmd1 == " action" ) &&
181- (webua->uri_cmd2 == " eventstart" ) &&
182- (webua->is_admin == true )) {
183- webu_post->action_eventstart ();
184- } else if (
185- (webua->uri_cmd1 == " action" ) &&
186- (webua->uri_cmd2 == " snapshot" ) &&
187- (webua->is_admin == true )) {
188- webu_post->action_snapshot ();
189- } else if (
190- (webua->uri_cmd1 == " action" ) &&
191- (webua->uri_cmd2 == " restart" ) &&
192- (webua->is_admin == true )) {
193- webu_post->action_restart ();
194- } else if (
195- (webua->uri_cmd1 == " action" ) &&
196- ((webua->uri_cmd2 == " quit" ) ||
197- (webua->uri_cmd2 == " end" )) &&
198- (webua->is_admin == true )) {
199- webu_post->action_stop ();
200164 } else {
201- MOTION_LOG (INF, TYPE_STREAM, NO_ERRNO
202- , _ (" Invalid request: cmd1: >%s<"
203- " cmd2: >%s< camindx : >%d< "
204- " is admin >%s<" )
205- , webua->uri_cmd1 .c_str ()
206- , webua->uri_cmd2 .c_str ()
207- , webua->camindx
208- , (webua->is_admin ) ? " Y" :" N" );
165+ if (webu->cfg ->webcontrol_interface == " stream" ) {
166+ MOTION_LOG (NTC, TYPE_STREAM, NO_ERRNO
167+ ,_ (" Actions not permitted on webcontrol_interface stream" ));
168+ webua->resp_type = WEBUI_RESP_TEXT;
169+ webua->resp_page = " Bad Request" ;
170+ } else if (
171+ (webua->uri_cmd1 == " detection" ) &&
172+ (webua->uri_cmd2 == " pause" ) &&
173+ (webua->is_admin == true )) {
174+ webu_post->action_pause_on ();
175+ } else if (
176+ (webua->uri_cmd1 == " detection" ) &&
177+ (webua->uri_cmd2 == " start" ) &&
178+ (webua->is_admin == true )) {
179+ webu_post->action_pause_off ();
180+ } else if (
181+ (webua->uri_cmd1 == " action" ) &&
182+ (webua->uri_cmd2 == " eventend" ) &&
183+ (webua->is_admin == true )) {
184+ webu_post->action_eventend ();
185+ } else if (
186+ (webua->uri_cmd1 == " action" ) &&
187+ (webua->uri_cmd2 == " eventstart" ) &&
188+ (webua->is_admin == true )) {
189+ webu_post->action_eventstart ();
190+ } else if (
191+ (webua->uri_cmd1 == " action" ) &&
192+ (webua->uri_cmd2 == " snapshot" ) &&
193+ (webua->is_admin == true )) {
194+ webu_post->action_snapshot ();
195+ } else if (
196+ (webua->uri_cmd1 == " action" ) &&
197+ (webua->uri_cmd2 == " restart" ) &&
198+ (webua->is_admin == true )) {
199+ webu_post->action_restart ();
200+ } else if (
201+ (webua->uri_cmd1 == " action" ) &&
202+ ((webua->uri_cmd2 == " quit" ) ||
203+ (webua->uri_cmd2 == " end" )) &&
204+ (webua->is_admin == true )) {
205+ webu_post->action_stop ();
206+ } else {
207+ MOTION_LOG (INF, TYPE_STREAM, NO_ERRNO
208+ , _ (" Invalid request: cmd1: >%s<"
209+ " cmd2: >%s< camindx : >%d< "
210+ " is admin >%s<" )
211+ , webua->uri_cmd1 .c_str ()
212+ , webua->uri_cmd2 .c_str ()
213+ , webua->camindx
214+ , (webua->is_admin ) ? " Y" :" N" );
215+ }
209216 }
210217 pthread_mutex_unlock (&app->mutex_post );
211218 webua->mhd_send ();
0 commit comments