mirror of
https://github.com/gtxaspec/wz_mini_hacks.git
synced 2024-11-22 13:37:19 +00:00
fixes to www (#231)
fixed display of camera version, fixed issue jpeg.cgi, added diagnostics page, minor css improvements, made shared.cgi for common code between diagnostics and config
This commit is contained in:
parent
e7ccea5454
commit
91e76ec944
@ -1,15 +1,13 @@
|
||||
#!/bin/sh
|
||||
# This serves a rudimentary webpage based on wz_mini.conf
|
||||
base_dir=/opt/wz_mini/
|
||||
base_hack_ini=/opt/wz_mini/wz_mini.conf
|
||||
hack_ini=$base_hack_ini
|
||||
www_dir=/opt/wz_mini/www/cgi-bin/
|
||||
camver=V3
|
||||
camfirmware=$(tail -n1 /configs/app.ver | cut -f2 -d= )
|
||||
hackver=$(cat /opt/wz_mini/usr/bin/app.ver)
|
||||
title="Wyze $camver on $camfirmware running wz_mini $hackver as $HOSTNAME"
|
||||
. /opt/wz_mini/www/cgi-bin/shared.cgi
|
||||
|
||||
title="$camver on $camfirmware running wz_mini $hackver as $HOSTNAME"
|
||||
updated=false
|
||||
|
||||
|
||||
|
||||
|
||||
echo "HTTP/1.1 200"
|
||||
echo -e "Content-type: text/html\n\n"
|
||||
echo ""
|
||||
@ -65,17 +63,6 @@ function revert_menu
|
||||
echo '</div>'
|
||||
}
|
||||
|
||||
function version_info
|
||||
{
|
||||
echo "<div id='$1'>"
|
||||
echo "<div class='ver_DIV' vertype='Camera'>$camver</div>"
|
||||
echo "<div class='ver_DIV' vertype='Camera Firmware'>$camfirmware</div>"
|
||||
echo "<div class='ver_DIV' vertype='wz_mini'>$hackver</div>"
|
||||
echo "<div class='ver_DIV' vertype='Hostname'> $HOSTNAME</div>"
|
||||
echo "</div>"
|
||||
}
|
||||
|
||||
|
||||
|
||||
if [[ $REQUEST_METHOD = 'GET' ]]; then
|
||||
|
||||
|
@ -127,10 +127,12 @@ H1 {
|
||||
padding-right:15px;
|
||||
}
|
||||
.ver_DIV {
|
||||
padding-left:60px;
|
||||
min-width:120px;
|
||||
font-family:monospace;
|
||||
flex: 1 0 120px;
|
||||
padding-left: 2vw;
|
||||
min-width: 12vw;
|
||||
font-family: monospace;
|
||||
flex: 1 0 9vw;
|
||||
overflow: hidden;
|
||||
font-size: 1.1vw;
|
||||
}
|
||||
.ver_DIV:before {
|
||||
content:attr(vertype);
|
||||
|
64
SD_ROOT/wz_mini/www/cgi-bin/diagnostics.cgi
Normal file
64
SD_ROOT/wz_mini/www/cgi-bin/diagnostics.cgi
Normal file
@ -0,0 +1,64 @@
|
||||
#!/bin/sh
|
||||
# diagnostics
|
||||
|
||||
. /opt/wz_mini/www/cgi-bin/shared.cgi
|
||||
title="Diagnostics $camver on $camfirmware running wz_mini $hackver as $HOSTNAME"
|
||||
|
||||
|
||||
function handle_css
|
||||
{
|
||||
echo -ne "<style type=\"text/css\">"
|
||||
cat config.css
|
||||
echo -ne '</style>';
|
||||
}
|
||||
|
||||
|
||||
dmesg_test()
|
||||
{
|
||||
x=$(dmesg | grep $1)
|
||||
if [-n "$x" ]; then
|
||||
echo "<div>$2 error found</div>"
|
||||
else
|
||||
echo "<div>no $2 error</div>"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
echo "HTTP/1.1 200"
|
||||
echo -e "Content-type: text/html\n\n"
|
||||
echo ""
|
||||
|
||||
echo "<html><head><title>$title</title>"
|
||||
handle_css
|
||||
echo "</head>"
|
||||
|
||||
echo "<body>"
|
||||
|
||||
echo "<h1>$title</h1>"
|
||||
|
||||
|
||||
echo "<h2>SD Card Test</h2>"
|
||||
|
||||
dmesg_test "invalid access to FAT" "SD card"
|
||||
dmesg_test "Filesystem has been set read-only" "SD read only"
|
||||
dmesg_test "fat_get_cluster: invalid cluster chain" "file system"
|
||||
|
||||
|
||||
echo "<h2>Firmware Version Test</h2>"
|
||||
|
||||
echo "Firmware Version: $camfirmware <br />"
|
||||
|
||||
if [ "$camfirmware" = "4.36.10.2163" ]; then
|
||||
echo "<div>this version is broken. Please downgrade to a working version</div>"
|
||||
fi
|
||||
|
||||
|
||||
echo "<pre>"
|
||||
dmesg
|
||||
echo "</pre>"
|
||||
|
||||
|
||||
version_info "display_BAR"
|
||||
echo "</body>"
|
||||
|
||||
echo "</html>"
|
@ -4,7 +4,6 @@
|
||||
#test for jpeg
|
||||
if [[ $REQUEST_METHOD = 'GET' ]]; then
|
||||
|
||||
echo "entered GET"
|
||||
#since ash does not handle arrays we create variables using eval
|
||||
IFS='&'
|
||||
for PAIR in $QUERY_STRING
|
||||
|
33
SD_ROOT/wz_mini/www/cgi-bin/shared.cgi
Normal file
33
SD_ROOT/wz_mini/www/cgi-bin/shared.cgi
Normal file
@ -0,0 +1,33 @@
|
||||
#!/bin/sh
|
||||
# This provides shared values for webpages
|
||||
base_dir=/opt/wz_mini/
|
||||
base_hack_ini=/opt/wz_mini/wz_mini.conf
|
||||
hack_ini=$base_hack_ini
|
||||
www_dir=/opt/wz_mini/www/cgi-bin/
|
||||
camver=V3
|
||||
|
||||
if [ -f /opt/wz_mini/tmp/.T31 ]; then
|
||||
camtype=T31
|
||||
elif [ -f /opt/wz_mini/tmp/.T20 ]; then
|
||||
camtype=T20
|
||||
fi
|
||||
|
||||
cammodel=$(/opt/wz_mini/etc/init.d/s04model start | grep detected | cut -f1 -d ' ' )
|
||||
|
||||
camver="$camtype($cammodel)"
|
||||
|
||||
camfirmware=$(tail -n1 /configs/app.ver | cut -f2 -d= )
|
||||
hackver=$(cat /opt/wz_mini/usr/bin/app.ver)
|
||||
|
||||
|
||||
function version_info
|
||||
{
|
||||
echo "<div id='$1'>"
|
||||
echo "<div class='ver_DIV' vertype='Model'>$camver</div>"
|
||||
echo "<div class='ver_DIV' vertype='Firmware'>$camfirmware</div>"
|
||||
echo "<div class='ver_DIV' vertype='wz_mini'>$hackver</div>"
|
||||
echo "<div class='ver_DIV' vertype='Hostname'> $HOSTNAME</div>"
|
||||
echo "</div>"
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,6 @@
|
||||
<p><a href="cgi-bin/config.cgi">Configuration Editor</a></p>
|
||||
<p><a href="car/car.html">Car Interface</a></p>
|
||||
<p><a href="cgi-bin/jpeg.cgi">Current Screen</a></p>
|
||||
|
||||
<p><a href="cgi-bin/diagnostics.cgi">Diagnostics</a></p>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user