Sfoglia il codice sorgente

fixes for recent errors (#277)

virmaior 3 anni fa
parent
commit
5b90d98ce5

+ 28 - 10
SD_ROOT/wz_mini/www/cgi-bin/config.cgi

@@ -13,9 +13,34 @@ echo -e "Content-type: text/html\n\n"
 echo ""
 
 
+die_no_config() 
+{
+if [ -f ${hack_ini} ]
+then
+    if [ -s ${hack_ini} ]
+    then
+        echo "$hack_ini exists and not empty"
+    else
+ echo "$hack_ini exists but empty"
+ echo "if you reboot then the hack will fail "
+ exit
+    fi
+else
+ echo "$hack_ini file does  not exist"
+ echo "if you reboot then the hack will fail. Please insure you have a wz_hack.conf file.."
+ exit 
+fi
+
+}
+
+
 reboot_camera()  {
-    echo "rebooting camera (refreshing screen in 90 seconds)"
-    echo '<script type="text/javascript">setTimeout(function(){ document.location.reload (); },90 * 1000)</script>'
+    die_no_config
+    reboot_wait=90
+    echo "rebooting camera (refreshing screen in $reboot_wait seconds)"
+    echo '<script type="text/javascript">setTimeout(function(){ document.location.href = "/cgi-bin/config.cgi"; },'$reboot_wait' * 1000)</script>'
+    handle_css config.css
+    version_info "display_BAR"
     reboot 
     exit
 }
@@ -197,16 +222,9 @@ function html_cam_feed
 
 
 
-function handle_css
-{
-echo -ne "<style type=\"text/css\">"
-cat config.css
-echo -ne '</style>';
-}
-
 
 echo -ne "<html><head><title>$title</title>"
-handle_css wz_mini_web.css
+handle_css config.css
 
 echo '<script type="text/javascript" src="/config.js" ></script>'
 echo -ne "</head>"

+ 9 - 0
SD_ROOT/wz_mini/www/cgi-bin/shared.cgi

@@ -22,6 +22,15 @@ hackver=$(cat /opt/wz_mini/usr/bin/app.ver)
 ipaddr=$(ifconfig wlan0  | grep inet | cut -d ':' -f2 | cut -d ' ' -f0)
 macaddr=$(ifconfig wlan0  | grep HWaddr | cut -d 'HW' -f2 | cut -d ' ' -f2)
 
+function handle_css
+{
+echo -ne "<style type=\"text/css\">"
+cat $1
+echo -ne '</style>';
+}
+
+
+
 function version_info
 {          
  echo "<div id='$1'>"

+ 1 - 1
SD_ROOT/wz_mini/www/config.js

@@ -45,7 +45,7 @@ function compose_rtsp_block(stype)
   
   stream = "/unicast";
   if ((fdata.get('RTSP_HI_RES_ENABLED') == "true") && (fdata.get('RTSP_LOW_RES_ENABLED') == "true")) {
-	if (stype == "RTSP_HI") {  stream = "/video1_unicast"  } else { stream ="/video2_unicast" }
+	if (stype == "RTSP_HI_RES") {  stream = "/video1_unicast"  } else { stream ="/video2_unicast" }
   }
 
   var link = "rtsp://" + auth + document.body.getAttribute("ip") + ":" + fdata.get('RTSP_PORT') + stream;