diff --git a/SD_ROOT/wz_mini/web/cgi-bin/wz_mini_web.sh b/SD_ROOT/wz_mini/web/cgi-bin/wz_mini_web.sh index 86db43e..c863b13 100644 --- a/SD_ROOT/wz_mini/web/cgi-bin/wz_mini_web.sh +++ b/SD_ROOT/wz_mini/web/cgi-bin/wz_mini_web.sh @@ -7,29 +7,100 @@ hackver="unknown" hostname=$(uname -n) title="Wyze $camver on $camfirmware running wz_mini $hackver as $hostname" - echo "HTTP/1.1 200" +echo -e "Content-type: text/html\n\n" echo "" -#echo "Content Length: 100000" + + +shft() { + # https://stackoverflow.com/questions/3690936/change-file-name-suffixes-using-sed/3691279#3691279 + # Change this '8' to one less than your desired maximum rollover file. + # Must be in reverse order for renames to work (n..1, not 1..n). + for suff in {8..1} ; do + if [[ -f "$1.${suff}" ]] ; then + ((nxt = suff + 1)) + mv -f "$1.${suff}" "$1.${nxt}" + fi + done + mv -f "$1" "$1.1" +} + +#test for post +if [[ $REQUEST_METHOD = 'POST' ]]; then + if [ "$CONTENT_LENGTH" -gt 0 ]; then + read -n $CONTENT_LENGTH POST_DATA <&0 + while read line + do eval "echo ${line}" + done + fi + + #since ash does not handle arrays we create variables using eval + IFS='&' + for PAIR in $POST_DATA + do + K=$(echo $PAIR | cut -f1 -d=) + VA=$(echo $PAIR | cut -f2 -d=) + VB=\"${VA//%3A/:}\" + #echo "