motioneye-project / motioneye

A web frontend for the motion daemon.
GNU General Public License v3.0
3.94k stars 650 forks source link

Fix motion detection status check #2987

Closed zagrim closed 4 months ago

zagrim commented 4 months ago

This should fix motion detection check and make working schedule work as it did in the Python 2 releases. Thanks for @Marijn0 for pointing out the flaw in the code.

I've not myself tested this, hopefully someone using working schedule can do that.

Fixes #2663

zagrim commented 4 months ago

@MichaIng the vulnerability causing failing the safety check looks to me like something that should be ignored, right?

Marijn0 commented 4 months ago

Works fine:

May 27 18:59:54 raspberrypi motion[1425]: [0:wu0] [INF] [ALL] webu_answer_ctrl: Connection from: 127.0.0.1 May 27 19:00:03 raspberrypi motion[1425]: [0:cn0] [DBG] [STR] webu_parseurl: Sent url: /1/detection/status May 27 19:00:03 raspberrypi motion[1425]: [0:cn0] [DBG] [STR] webu_parseurl: Decoded url: /1/detection/status May 27 19:00:03 raspberrypi motion[1425]: [0:cn0] [DBG] [STR] webu_parseurl: camid: >1< cmd1: >detection< cmd2: >status< parm1:>< val1:>< parm2:>< val2:>< May 27 19:00:03 raspberrypi meyectl[512]: DEBUG: motion detection is enabled for camera with id May 27 19:00:03 raspberrypi meyectl[512]: DEBUG: must disable motion detection for camera with id 1 (during working schedule) May 27 19:00:03 raspberrypi meyectl[512]: DEBUG: disabling motion detection for camera with id 1 May 27 19:00:03 raspberrypi motion[1425]: [0:wu0] [INF] [ALL] webu_answer_ctrl: Connection from: 127.0.0.1 May 27 19:00:03 raspberrypi motion[1425]: [0:cn0] [DBG] [STR] webu_parseurl: Sent url: /1/detection/pause May 27 19:00:03 raspberrypi motion[1425]: [0:cn0] [DBG] [STR] webu_parseurl: Decoded url: /1/detection/pause May 27 19:00:03 raspberrypi motion[1425]: [0:cn0] [DBG] [STR] webu_parseurl: camid: >1< cmd1: >detection< cmd2: >pause< parm1:>< val1:>< parm2:>< val2:>< May 27 19:00:03 raspberrypi motion[1425]: [0:wu0] [INF] [ALL] webu_answer_ctrl: Connection from: 127.0.0.1 May 27 19:00:03 raspberrypi meyectl[512]: DEBUG: successfully disabled motion detection for camera with id 1

MichaIng commented 4 months ago

Uh, indeed:

root@VM-Bookworm:~# curl http://127.0.0.1:7999/1/detection/status
Camera 1 Detection status ACTIVE

Many thanks 👍!

The failing check is addressed here: #2983