1
0
mirror of https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks.git synced 2025-09-04 13:35:33 +02:00

Merge branch 'beta'

This commit is contained in:
dewi-ny-je
2020-10-28 22:44:34 +01:00
243 changed files with 124287 additions and 12083 deletions

View File

@@ -7,13 +7,15 @@ This repository contains custom firmwares for the following devices:
Name | Picture
--- | ---
Xiaomi Dafang | ![Dafang](/dafang.png)
Xiaomi Xiaofang 1S (only old Version with T20, newer Version with T20L not supported yet!) | ![XiaoFang](/xiaofang.png)
Xiaomi Xiaofang 1S (old Version with T20 is supported, newer Version with T20L is in beta) | ![XiaoFang](/xiaofang.png)
Wyzecam Pan | ![Dafang](/dafang.png)
Wyzecam V2 | ![XiaoFang](/xiaofang.png)
Neos SmartCam | ![XiaoFang](/xiaofang.png)
Sannce I21AG, MixSight HX-I2110T2, WanScam HW0036, Digoo BB-M2 | ![XiaoFang](/sannce.jpg)
Any other Device with Ingenic T10/T20 Device https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/issues/980 | ![T20](/t20.png)
If you want to test the Xiaofang T20L (newer version) please check out the [beta branch in this repository](https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/tree/beta).
If you have a classic XiaoFang with a ARM-Processor, consider using https://github.com/samtap/fang-hacks
### Attentention: Do not install the latest Firmware on your Device. It will disable the support of this hack.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -4,6 +4,8 @@ OSD=on
JPEG=on
MOTION=on
POOLSIZE=on
# Augment this value to get higher OSD fonts
POOLSIZEBUFFER=0x64000
FontFixedWidth=/system/sdcard/fonts/NotoMono-Regular.ttf
FontRegular=/system/sdcard/fonts/NotoSans-Regular.ttf
@@ -27,3 +29,5 @@ DetectionTracking=/system/sdcard/scripts/detectionTracking.sh
#Quality=2
# The maximum number of gop occupied by the same scene
#maxSameSceneCnt=6
# Maximum GOP
#maxgop=8

View File

@@ -0,0 +1,6 @@
# min hour day month weekday command
*/15 * * * * busybox run-parts /system/sdcard/config/cron/periodic/15min
0 * * * * busybox run-parts /system/sdcard/config/cron/periodic/hourly
0 2 * * * busybox run-parts /system/sdcard/config/cron/periodic/daily
0 3 * * 6 busybox run-parts /system/sdcard/config/cron/periodic/weekly
0 5 1 * * busybox run-parts /system/sdcard/config/cron/periodic/monthly

View File

@@ -1,9 +1,9 @@
DISPLAY_AXIS=true
ENABLE_OSD=true
OSD="%H:%M:%S %d.%m.%Y"
COLOR=0
SIZE=0
POSY=
FIXEDW=0
DISPLAY_AXIS=false
COLOR=3
SIZE=18
SPACE=
POSY=
FIXEDW=false
FONTNAME=

View File

@@ -6,6 +6,7 @@
# Configure RTSP Servers
# Use /system/sdcard/bin/v4l2rtspserver-master -h to see available options
CODEC="H264"
LOG=false
LOGDIR="/tmp"
LOGPATH="$LOGDIR/v4l2rtspserver-master.log"
@@ -15,19 +16,24 @@ PORT=8554
USERNAME=
USERPASSWORD=
# H264 RTSP server options
# Examples:
# RTSPH264OPTS="-W960 -H540"
# To enable authentication:
# RTSPH264OPTS="-U user:password"
RTSPH264OPTS=""
#Path to save recordings to:
#Set to main Recording directory
DCIM_PATH="/system/sdcard/DCIM/Recording"
# MJPEG RTSP server options
#Add a subdirectory if required:
#Add sub directory to main DCIM path seperated by date then by
#hour for faster loading over ftp
SUB_DIR="$(date +%Y-%m-%d)/$(date +%H)"
#Set the filename format to use
FILE_NAME="REC_$(date +%H-%M-%S.h264)"
# RTSP server options
# Examples:
# RTSPMJPEGOPTS="-W960 -H540"
# RTSPOPTS="-W960 -H540"
# To enable authentication:
# RTSPMJPEGOPTS="-U user:password"
RTSPMJPEGOPTS=""
# RTSPOPTS="-U user:password"
RTSPOPTS=""
# Enable multicast stream
# Example:

View File

@@ -47,7 +47,7 @@ fi
--cert-file ${ACMEPATH}/host.crt \
--key-file ${ACMEPATH}/host.key \
--fullchain-file ${ACMEPATH}/fullchain.crt \
--reloadcmd "cat ${ACMEPATH}/fullchain.crt ${ACMEPATH}/host.key > ${CONFIGPATH}/lighttpd.pem ;\
--reloadcmd "cat ${ACMEPATH}/host.crt ${ACMEPATH}/host.key > ${CONFIGPATH}/lighttpd.pem ;\
pkill lighttpd.bin ;\
/system/sdcard/bin/lighttpd -f ${CONFIGPATH}/lighttpd.conf"

View File

@@ -3,6 +3,7 @@ TIMELAPSE_INTERVAL=2.0
# Duration of the script should run, in minutes, set to 0 for unlimited
TIMELAPSE_DURATION=0
# Save dir config
DCIM_PATH='/system/sdcard/DCIM/Timelapse'
SAVE_DIR_PER_DAY=1
# Enable compression
COMPRESSION_QUALITY=80
COMPRESSION_QUALITY=100

View File

@@ -1,6 +1,6 @@
#!/bin/sh
PIDFILE="/var/run/bftpd.pid"
PIDFILE="/var/run/ftp_server.pid"
status()
{

View File

@@ -2,7 +2,6 @@
. /system/sdcard/config/rtspserver.conf
PIDFILE="/run/recording.pid"
DCIM_PATH="/system/sdcard/DCIM/Recording"
## UserName and password
if [ "$USERNAME" != "" ]; then
@@ -27,14 +26,11 @@ start()
echo "Recording already running.";
else
echo "Started recording."
# Add sub directory to main dcim path seperated by date then by
# hour for faster loading over ftp
SUB_DIR="$(date +%Y-%m-%d)/$(date +%H)"
if [ ! -d "$DCIM_PATH/$SUB_DIR" ]; then
mkdir -p "$DCIM_PATH/$SUB_DIR"
fi
# Create the recording with timestamp
FILE_NAME="REC_$(date +%H-%M-%S.h264)"
RECORDING_PATH="$DCIM_PATH/$SUB_DIR/$FILE_NAME"
# wait for rtspserver to become available
until pids=$(pidof v4l2rtspserver-master)

View File

@@ -0,0 +1,116 @@
#!/bin/sh
PIDFILE="/run/rtsp.pid"
LOGDIR="/tmp"
LOGPATH="$LOGDIR/v4l2rtspserver-master.log"
export LD_LIBRARY_PATH='/system/sdcard/lib:/thirdlib:/system/lib'
if [ ! -f /system/sdcard/config/rtspserver.conf ]; then
cp /system/sdcard/config/rtspserver.conf.dist /system/sdcard/config/rtspserver.conf
fi
if [ -f /system/sdcard/config/rtspserver.conf ]; then
. /system/sdcard/config/rtspserver.conf
fi
if [ "$LOG" != true ] ; then
LOGPATH="/dev/null"
fi
if [ -f /system/sdcard/config/osd.conf ]; then
. /system/sdcard/config/osd.conf 2>/dev/null
fi
if [ -z "${CODEC+x}" ]; then
CODEC="H264"
fi
status()
{
pid="$(cat "$PIDFILE" 2>/dev/null)"
if [ "$pid" ]; then
# Prints PID: $pid if exists and returns 0(no error) else returns 1(error condition)
kill -0 "$pid" >/dev/null && echo "PID: $pid" || return 1
fi
}
start()
{
if [ "$(status)" != "" ]; then
echo "A v4l2rtspserver is already running, please stop it or reboot"
else
echo "Starting v4l2rtspserver-master"
## Configure OSD
if [ -f /system/sdcard/controlscripts/configureOsd ]; then
. /system/sdcard/controlscripts/configureOsd 2>/dev/null
fi
## Configure Motion
if [ -f /system/sdcard/controlscripts/configureMotion ]; then
. /system/sdcard/controlscripts/configureMotion 2>/dev/null
fi
## Bitrate
/system/sdcard/bin/setconf -k b -v ${BITRATE} 2>/dev/null
## Framerate
if [ "$FRAMERATE_DEN" != "" ] && [ "$FRAMERATE_NUM" != "" ]; then
/system/sdcard/bin/setconf -k d -v "$FRAMERATE_NUM,$FRAMERATE_DEN" 2>/dev/null
fi
## Audio
if [ "$AUDIOFORMAT" != "OFF" ] ; then
AUDIOPARAM="-E $AUDIOFORMAT:$AUDIOINBR:$AUDIOOUTBR"
/system/sdcard/bin/setconf -k h -v "$HWVOLUME" 2>/dev/null
/system/sdcard/bin/setconf -k i -v "$SWVOLUME" 2>/dev/null
/system/sdcard/bin/setconf -k q -v "$FILTER" 2>/dev/null
/system/sdcard/bin/setconf -k l -v "$HIGHPASSFILTER" 2>/dev/null
/system/sdcard/bin/setconf -k a -v "$AECFILTER" 2>/dev/null
else
AUDIOPARAM="-A"
fi
## Video format
if [ "$VIDEOFORMAT" != "" ]; then
VIDEOFORMAT="-r $VIDEOFORMAT -F $FRAMERATE_NUM"
fi
## UserName and password
if [ "$USERNAME" != "" ]; then
CREDENTIAL="-U $USERNAME:$USERPASSWORD"
fi
## Port
if [ "$PORT" != "" ]; then
PORT="-P $PORT"
fi
## Multicast
if [ "$MULTICASTDEST" != "" ]; then
MULTICASTDEST="-M $MULTICASTDEST"
fi
## FLIP
if [ "$FLIP" == "ON" ]; then
/system/sdcard/bin/setconf -k f -v 1
else
/system/sdcard/bin/setconf -k f -v 0
fi
echo "================== START ===============" >> "$LOGPATH"
echo "/system/sdcard/bin/v4l2rtspserver-master -f$CODEC $RTSPOPTS $AUDIOPARAM $VIDEOFORMAT $CREDENTIAL $PORT $MULTICASTDEST" >> "$LOGPATH"
/system/sdcard/bin/v4l2rtspserver-master -f$CODEC $RTSPOPTS $AUDIOPARAM $VIDEOFORMAT $CREDENTIAL $PORT $MULTICASTDEST 2>> "$LOGPATH" >> "$LOGPATH" &
echo "$!" > "$PIDFILE"
fi
}
stop()
{
pid="$(cat "$PIDFILE" 2>/dev/null)"
if [ "$pid" ]; then
kill "$pid"
rm "$PIDFILE" 1> /dev/null 2>&1
fi
}
if [ $# -eq 0 ]; then
start
else
case $1 in start|stop|status)
$1
;;
esac
fi

View File

@@ -1,5 +1,5 @@
#!/bin/sh
PIDFILE="/run/v4l2rtspserver-master-h264.pid"
PIDFILE="/run/rtsp-h264.pid"
export LD_LIBRARY_PATH='/system/sdcard/lib/:/thirdlib:/system/lib'
if [ ! -f /system/sdcard/config/rtspserver.conf ]; then
@@ -96,9 +96,9 @@ start()
fi
echo "================== START ===============" >> "$LOGPATH"
echo "/system/sdcard/bin/v4l2rtspserver-master $RTSPH264OPTS $AUDIOPARAM $VIDEOFORMAT $CREDENTIAL $PORT $MULTICASTDEST" >> "$LOGPATH"
echo "/system/sdcard/bin/v4l2rtspserver-master $RTSPOPTS $AUDIOPARAM $VIDEOFORMAT $CREDENTIAL $PORT $MULTICASTDEST" >> "$LOGPATH"
cd /system/sdcard/hls
/system/sdcard/bin/v4l2rtspserver-master $RTSPH264OPTS $AUDIOPARAM $VIDEOFORMAT $CREDENTIAL $PORT $MULTICASTDEST 2>> "$LOGPATH" >> "$LOGPATH" &
/system/sdcard/bin/v4l2rtspserver-master $RTSPOPTS $AUDIOPARAM $VIDEOFORMAT $CREDENTIAL $PORT $MULTICASTDEST 2>> "$LOGPATH" >> "$LOGPATH" &
echo "$!" > "$PIDFILE"
fi
}
@@ -109,6 +109,7 @@ stop()
if [ "$pid" ]; then
kill "$pid"
rm "$PIDFILE" 1> /dev/null 2>&1
fi
}

View File

@@ -1,5 +1,5 @@
#!/bin/sh
PIDFILE="/run/v4l2rtspserver-master-mjpeg.pid"
PIDFILE="/run/rtsp-mpjeg.pid"
LOGDIR="/tmp"
LOGPATH="$LOGDIR/v4l2rtspserver-master.log"
export LD_LIBRARY_PATH='/system/sdcard/lib:/thirdlib:/system/lib'
@@ -90,8 +90,8 @@ start()
fi
echo "================== START ===============" >> "$LOGPATH"
echo "/system/sdcard/bin/v4l2rtspserver-master -fMJPG $RTSPMJPEGOPTS $AUDIOPARAM $VIDEOFORMAT $CREDENTIAL $PORT $MULTICASTDEST" >> "$LOGPATH"
/system/sdcard/bin/v4l2rtspserver-master -fMJPG $RTSPMJPEGOPTS $AUDIOPARAM $VIDEOFORMAT $CREDENTIAL $PORT $MULTICASTDEST 2>> "$LOGPATH" >> "$LOGPATH" &
echo "/system/sdcard/bin/v4l2rtspserver-master -fMJPG $RTSPOPTS $AUDIOPARAM $VIDEOFORMAT $CREDENTIAL $PORT $MULTICASTDEST" >> "$LOGPATH"
/system/sdcard/bin/v4l2rtspserver-master -fMJPG $RTSPOPTS $AUDIOPARAM $VIDEOFORMAT $CREDENTIAL $PORT $MULTICASTDEST 2>> "$LOGPATH" >> "$LOGPATH" &
echo "$!" > "$PIDFILE"
fi
}

View File

@@ -0,0 +1,11 @@
#!/bin/sh
CONF_FILE_DATE=$(date +%Y-%m-%d_%H-%M-%S)
CONF_FILE_NAME="savedConf-${CONF_FILE_DATE}.tar.gz"
CONF_PATH="/system/sdcard/config"
CONF_DEST="/system/sdcard/DCIM/Config"
if [ ! -d $CONF_DEST ]; then
mkdir $CONF_DEST
fi
tar -zcf $CONF_DEST/$CONF_FILE_NAME -C $CONF_PATH --exclude='*.dist' .

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
firmware_mod/lib/libtls.so Executable file

Binary file not shown.

BIN
firmware_mod/lib/libz.so Executable file

Binary file not shown.

View File

@@ -354,6 +354,108 @@ ftp_server(){
esac
}
# Control the MQTT control
mqtt_control(){
case "$1" in
on)
/system/sdcard/controlscripts/mqtt_control start
;;
off)
/system/sdcard/controlscripts/mqtt_control stop
;;
status)
if /system/sdcard/controlscripts/mqtt_control status | grep -q "PID"
then
echo "ON"
else
echo "OFF"
fi
;;
esac
}
# Control the MQTT status
mqtt_status(){
case "$1" in
on)
/system/sdcard/controlscripts/mqtt_status start
;;
off)
/system/sdcard/controlscripts/mqtt_status stop
;;
status)
if /system/sdcard/controlscripts/mqtt_status status | grep -q "PID"
then
echo "ON"
else
echo "OFF"
fi
;;
esac
}
# Control the ONVIF status
onvif_srvd(){
case "$1" in
on)
/system/sdcard/controlscripts/onvif-srvd.sh start
;;
off)
/system/sdcard/controlscripts/onvif-srvd.sh stop
;;
status)
if /system/sdcard/controlscripts/onvif-srvd.sh status | grep -q "PID"
then
echo "ON"
else
echo "OFF"
fi
;;
esac
}
# Control the sound on startup status
sound_on_startup(){
case "$1" in
on)
/system/sdcard/controlscripts/sound-on-startup start
;;
off)
/system/sdcard/controlscripts/sound-on-startup stop
;;
status)
if /system/sdcard/controlscripts/sound-on-startup status | grep -q "PID"
then
echo "ON"
else
echo "OFF"
fi
;;
esac
}
# Control the timelapse
debug_on_osd(){
case "$1" in
on)
/system/sdcard/controlscripts/debug-on-osd start
;;
off)
/system/sdcard/controlscripts/debug-on-osd stop
;;
status)
if /system/sdcard/controlscripts/debug-on-osd status | grep -q "PID"
then
echo "ON"
else
echo "OFF"
fi
;;
esac
}
# Control the timelapse
timelapse(){
case "$1" in
@@ -442,6 +544,26 @@ motion_send_mail(){
esac
}
# Control the telegram service
telegram_bot(){
case "$1" in
on)
/system/sdcard/controlscripts/telegram-bot start
;;
off)
/system/sdcard/controlscripts/telegram-bot stop
;;
status)
if /system/sdcard/controlscripts/telegram-bot status | grep -q "PID"
then
echo "ON"
else
echo "OFF"
fi
;;
esac
}
# Control the motion detection Telegram function
motion_send_telegram(){
case "$1" in
@@ -669,7 +791,7 @@ update_axis(){
# Set timezone from the timezone config file to system timezone
set_timezone(){
timezone_name=$(cat /system/sdcard/config/timezone.conf)
timezone=$(/system/sdcard/bin/busybox awk -F '\t' -v tzn="$timezone_name" '($1==tzn) {print $2}' /system/sdcard/www/timezones.tsv)
timezone=$(/system/sdcard/bin/busybox awk -F '\t' -v tzn="$timezone_name" '($1==tzn) {print $2}' /system/sdcard/www/json/timezones.tsv)
if [ "$(cat /etc/TZ)" != "$timezone" ]; then
echo "$timezone" > /etc/TZ
fi
@@ -701,3 +823,17 @@ check_commit() {
echo "No version file"
fi
}
#Get list of font files
getFonts() {
fontName="$(/system/sdcard/bin/setconf -g e)"
echo -n "<option value=\"\""
if [ -n "${fontName-unset}" ] ; then echo selected; fi
echo -n ">Default fonts </option>"
for i in `/system/sdcard/bin/busybox find /system/sdcard/fonts -name *.ttf`
do
echo -n "<option value=\"$i\" "
if [ "$fontName" == "$i" ] ; then echo selected; fi
echo -n ">`/system/sdcard/bin/busybox basename $i` </option>"
done
}

0
firmware_mod/scripts/detectionOn.sh Executable file → Normal file
View File

View File

@@ -0,0 +1,28 @@
#!/bin/sh
# Check if there is new parameters in the dist config file
CONF_PATH="/system/sdcard/config"
CONF_LIST="mqtt.conf rtspserver.conf matrix.conf motion.conf autonight.conf letsencrypt.conf sendmail.conf swap.conf telegram.conf"
for CONF in $CONF_LIST; do
CONF_NEW_VARS_COUNT=0
if [ -f "${CONF_PATH}/${CONF}" ]; then
echo "Check ${CONF}"
CONF_DIST_VARS=$(grep -o '^[^#]*' "${CONF_PATH}/${CONF}.dist" | cut -d= -f1 | sort)
CONF_USER_VARS=$(grep -o '^[^#]*' ${CONF_PATH}/${CONF} | cut -d= -f1 | sort)
for VAR in $CONF_DIST_VARS; do
if [ ! -n "$(echo $CONF_USER_VARS | grep $VAR)" ]; then
CONF_NEW_VARS_COUNT=$((CONF_NEW_VARS_COUNT+1))
echo "# Parameter added by merge tool" >> "${CONF_PATH}/${CONF}"
grep $VAR "${CONF_PATH}/${CONF}.dist" >> "${CONF_PATH}/${CONF}"
fi
done
if [ $CONF_NEW_VARS_COUNT == 0 ]; then
echo "No new parameters between ${CONF} ${CONF}.dist"
else
echo "Merging ${CONF_NEW_VARS_COUNT} parameters in ${CONF}"
fi
else
echo "${CONF} not exist"
fi
done

View File

@@ -423,8 +423,13 @@ done
;;
"${TOPIC}/update/set update")
if [ -f "/system/sdcard/VERSION" ]; then
branch=$(/system/sdcard/bin/jq -r .branch /system/sdcard/VERSION)
else
branch="master"
fi
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "${TOPIC}"/update ${MOSQUITTOOPTS} ${MOSQUITTOPUBOPTS} -m "Upgrade started"
result=$(/bin/sh /system/sdcard/autoupdate.sh -s -v -f)
result=$(/bin/sh /system/sdcard/autoupdate.sh -s -v -f -r $branch)
/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "${TOPIC}"/update ${MOSQUITTOOPTS} ${MOSQUITTOPUBOPTS} -m "Upgrade finish: ${result}"
;;

0
firmware_mod/scripts/telegram-bot-daemon.sh Executable file → Normal file
View File

View File

@@ -5,7 +5,6 @@
PIDFILE='/run/timelapse.pid'
TIMELAPSE_CONF='/system/sdcard/config/timelapse.conf'
DCIM_PATH='/system/sdcard/DCIM/Timelapse'
if [ -f "$TIMELAPSE_CONF" ]; then
. "$TIMELAPSE_CONF" 2>/dev/null

View File

@@ -0,0 +1,14 @@
baudrate=115200
bootargs=console=ttyS1,115200n8 mem=39M@0x0 ispmem=5M@0x2700000 rmem=20M@0x2C00000 init=/linuxrc rootfstype=squashfs root=/dev/mtdblock2 rw mtdparts=jz_sfc:256k(boot),2048k(kernel),3392k(root),640k(driver),4736k(appfs),2048k(backupk),640k(backupd),2048k(backupa),256k(config),256k(para),-(flag)
bootcmd=sf probe;sf read 0x80600000 0x40000 0x280000; bootm 0x80600000;
bootdelay=1
ethact=Jz4775-9161
ethaddr=00:11:22:33:44:55
gatewayip=193.169.4.1
ipaddr=193.169.4.81
loads_echo=1
netmask=255.255.255.0
serverip=193.169.4.2
stderr=serial
stdin=serial
stdout=serial

View File

@@ -0,0 +1,14 @@
baudrate=115200
bootargs=console=ttyS1,115200n8 mem=39M@0x0 ispmem=5M@0x2700000 rmem=20M@0x2C00000 init=/linuxrc rootfstype=squashfs root=/dev/mtdblock2 rw mtdparts=jz_sfc:256k(boot),2048k(kernel),3392k(root),640k(driver),4736k(appfs),2048k(backupk),640k(backupd),2048k(backupa),256k(config),256k(para),-(flag)
bootcmd=fatload mmc 0:1 0x80600000 kernel.bin;bootm 0x80600000
bootdelay=1
ethact=Jz4775-9161
ethaddr=00:11:22:33:44:55
gatewayip=193.169.4.1
ipaddr=193.169.4.81
loads_echo=1
netmask=255.255.255.0
serverip=193.169.4.2
stderr=serial
stdin=serial
stdout=serial

315
firmware_mod/www/camera.html Executable file
View File

@@ -0,0 +1,315 @@
<div class="w3-panel w3-card">
<h1>Camera Configuration</h1>
<!-- Tab menu -->
<div class="w3-row">
<a href="javascript:void(0)" onclick="openTab(event, 'videoTab');">
<div class="w3-quarter tablink w3-bottombar w3-hover-light-grey w3-padding w3-border-theme">Video</div>
</a>
<a href="javascript:void(0)" onclick="openTab(event, 'audioTab');">
<div class="w3-quarter tablink w3-bottombar w3-hover-light-grey w3-padding">Audio</div>
</a>
<a href="javascript:void(0)" onclick="openTab(event, 'timelapseTab');">
<div class="w3-quarter tablink w3-bottombar w3-hover-light-grey w3-padding">Timelapse</div>
</a>
<a href="javascript:void(0)" onclick="openTab(event, 'osdTab');">
<div class="w3-quarter tablink w3-bottombar w3-hover-light-grey w3-padding">OSD</div>
</a>
</div>
<!-- Tab video -->
<div id="videoTab" class="w3-container tab">
<form class="w3-container" onsubmit="saveConfig('video');return false" id="video">
<p></p>
<!-- Setting accordion-->
<button class="accordion" type='button'>Format</button>
<div class="panel">
<p></p>
<div class="w3-row-padding">
<div class="w3-third">
<label>Codec for RTSP server</label>
<select id="codec" class="w3-select" name="option">
<option value="H264">H264</option>
<option value="MJPG">MPJEG</option>
</select>
</div>
<div class="w3-third">
<label>Video size:</label>
<select id="videoSize" class="w3-select" name="option">
<option value="-W640 -H360">640x360</option>
<option value="-W768 -H432">768x432</option>
<option value="-W960 -H540">960x540</option>
<option value="-W1280 -H720">1280x720</option>
<option value="-W1600 -H900">1600x900</option>
<option value="-W1920 -H1080">1920x1080</option>
</select>
</div>
<div class="w3-third">
<label>Bitrate (kbps):</label>
<input id="bitRate" class="w3-input" type="text">
</div>
</div>
<p></p>
<div class="w3-row-padding">
<div class="w3-third">
<label>Format:</label>
<select id="format" class="w3-select" name="option">
<option value="0">FixedQp</option>
<option value="1">CBR</option>
<option value="2">VBR</option>
<option value="3">SMART</option>
</select>
</div>
<div class="w3-third">
<label>Flip Image:</label>
<select id="flip" class="w3-select" name="option">
<option value="OFF">Off</option>
<option value="ON">On</option>
</select>
</div>
<div class="w3-third">
<label>Frame rate (images per secondes):</label>
<div class="w3-row-padding">
<div class="w3-half">
<label>Images:</label>
<input id="frmRateNum" class="w3-input" type="text">
</div>
<div class="w3-half">
<label>Seconds:</label>
<input id="frmRateDen" class="w3-input" type="text">
</div>
</div>
</div>
</div>
<p></p>
</div>
<!-- Network / Security accordion -->
<button class="accordion" type='button'>Network / Security</button>
<div class="panel">
<p></p>
<div class="w3-row-padding">
<div class="w3-half">
<label>Username:</label>
<input id="videoUser" class="w3-input" type="text">
</div>
<div class="w3-half">
<label>Password:</label>
<input id="videoPassword" class="w3-input" type="password">
</div>
</div>
<p></p>
<div class="w3-row-padding">
<div class="w3-half">
<label>Port (default 8554):</label>
<input id="videoPort" class="w3-input" type="number">
</div>
<div class="w3-half">
<label>Multicast address (leave blank to disable multicast):</label>
<input id="multicast" class="w3-input" type="text">
</div>
</div>
<p></p>
</div>
<!-- Auto Night accordion -->
<button class="accordion" type='button'>Auto Night</button>
<div class="panel">
<p></p>
<label>Auto Night Mode</label>
<select id="autoNightMode" class="w3-select" name="option">
<option value="hw">Hardware</option>
<option value="sw">Software</option>
</select>
<br />
<label>Use average measurement on switching. Number of measurements:</label>
<select id="avg" class="w3-select" name="option">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="10">10</option>
<option value="15">15</option>
</select>
</div>
<p><button class="w3-btn w3-theme" >Save</button></p></form>
</div>
<!-- Tab audio -->
<div id="audioTab" class="w3-container tab" style="display:none">
<p><form class="w3-container" onsubmit="saveConfig('audio');return false" id="audio"></p>
<div class="w3-row-padding">
<div class="w3-half">
<label>Audio format</label>
<select id="audioinFormat" class="w3-select">
<option value="OFF">OFF</option>
<option value="OPUS">OPUS</option>
<option value="PCM">PCM</option>
<option value="PCMU">PCMU</option>
<option value="MP3">MP3</option>
</select>
</div>
<div class="w3-half">
<label>Volume</label><br />
<input name="audioinVol" step="1" min="-1" max="120" type="range" class="w3-input">
</div>
</div>
<p></p>
<div class="w3-row-padding">
<div class="w3-half">
<label>Sample rate in</label>
<select id="audioinBR" class="w3-select" >
<option value="8000">8000</option>
<option value="16000">16000</option>
<option value="24000">24000</option>
<option value="44100">44100</option>
<option value="48000">48000</option>
</select>
</div>
<div class="w3-half">
<label>Sample rate out</label>
<select id="audiooutBR" class="w3-select">
<option value="8000">8000</option>
<option value="16000">16000</option>
<option value="24000">24000</option>
<option value="44100">44100</option>
<option value="48000">48000</option>
</select>
</div>
</div>
<p></p>
<div class="w3-row-padding">
<div class="w3-third">
<label>Filter (low filter)</label>
<select id="audioinFilter" class="w3-select" name="option">
<option value="0">No filter</option>
<option value="1">Filter 1</option>
<option value="2">Filter 2</option>
<option value="3">NS Filter LOW</option>
<option value="4">NS Filter MODERATE</option>
<option value="5">NS Filter HIGH</option>
<option value="6">NS Filter VERY HIGH</option>
</select>
</div>
<div class="w3-third">
<label>Hight pass filter</label>
<select id="HFEnabled" class="w3-select" name="option">
<option value="false">Deactivate</option>
<option value="true">Activate</option>
</select>
</div>
<div class="w3-third">
<label>AEC Filter</label>
<select id="AECEnabled" class="w3-select" name="option">
<option value="false">Deactivate</option>
<option value="true">Activate</option>
</select>
</div>
</div>
<p><button class="w3-btn w3-theme" >Save</button></p></form>
</div>
<!-- Tab timelapse -->
<div id="timelapseTab" class="w3-container tab" style="display:none">
<p><form class="w3-container" onsubmit="saveConfig('timelapseF');return false" id="timelapseF"></p>
<label>Interval (in seconds)</label>
<input class="w3-input" id="tlinterval" type="text">
<br />
<label>Duration (in minutes)</label>
<input class="w3-input" id="tlduration" type="text">
<br />
<p><button class="w3-btn w3-theme" >Save</button></p></form>
</div>
<!-- Tab OSD-->
<div id="osdTab" class="w3-container tab" style="display:none">
<p><form class="w3-container" onsubmit="saveConfig('osd');return false" id="osd"></p>
<div class="w3-row-padding">
<div class="w3-third">
<label>Date saveConfigate</label>
<input id="osdText" class="w3-input" type="text">
</div>
<div class="w3-third">
<label>OSD Text</label>
<select id="osdEnable" class="w3-select" name="option">
<option value="false">Deactivate</option>
<option value="true">Activate</option>
</select>
</div>
<div class="w3-third">
<label>OSD Axis</label>
<select id="osdAxis" class="w3-select" name="option">
<option value="false">Deactivate</option>
<option value="true">Activate</option>
</select>
</div>
</div>
<p></p>
<div class="w3-row-padding">
<div class="w3-third">
<label>OSD Text color</label>
<select id="osdColor" class="w3-select" name="option">
<option value="0">White</option>
<option value="1">Black</option>
<option value="2">Red</option>
<option value="3">Green</option>
<option value="4">Blue</option>
<option value="5">Cyan</option>
<option value="6">Yellow</option>
<option value="7">Purple</option>
</select>
</div>
<div class="w3-third">
<label>OSD Font name</label>
<select id="osdFonts" class="w3-select">
</select>
</div>
<div class="w3-third">
<label>OSD Text size</label>
<input id="osdSize" class="w3-input" type="number">
</div>
</div>
<p></p>
<div class="w3-row-padding">
<div class="w3-third">
<label>Pixel between chars</label>
<input id="osdPixel" class="w3-input" type="text">
</div>
<div class="w3-third">
<label>Y position</label>
<input id="osdY" class="w3-input" type="text">
</div>
<div class="w3-third">
<label>Fixed width ( only work for "default" fonts)</label>
<select id="osdFixW" class="w3-select" name="option">
<option value="false">Deactivate</option>
<option value="true">Activate</option>
</select>
</div>
</div>
<p><button class="w3-btn w3-theme" >Save</button></form></p>
</div>
<!-- Modal save box -->
<div id="save_confirm" class="w3-modal">
<div class="w3-modal-content">
<header class="w3-container w3-theme">
<span onclick="document.getElementById('save_confirm').style.display='none'"
class="w3-button w3-display-topright">&times;</span>
<h2>Save config</h2>
</header>
<div class="w3-container">
<p id="save_result"></p>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="js/camera.js"></script>

View File

@@ -389,8 +389,7 @@ auto_night_mode_status)
frmRateDen=$(printf '%b' "${F_frmRateDen/%/\\x}")
frmRateNum=$(printf '%b' "${F_frmRateNum/%/\\x}")
rewrite_config /system/sdcard/config/rtspserver.conf RTSPH264OPTS "\"$video_size\""
rewrite_config /system/sdcard/config/rtspserver.conf RTSPMJPEGOPTS "\"$video_size\""
rewrite_config /system/sdcard/config/rtspserver.conf RTSPOPTS "\"$video_size\""
rewrite_config /system/sdcard/config/rtspserver.conf BITRATE "$brbitrate"
rewrite_config /system/sdcard/config/rtspserver.conf VIDEOFORMAT "$video_format"
rewrite_config /system/sdcard/config/rtspserver.conf USERNAME "$videouser"

0
firmware_mod/www/cgi-bin/api.cgi Normal file → Executable file
View File

2
firmware_mod/www/cgi-bin/currentpic.cgi Normal file → Executable file
View File

@@ -2,4 +2,4 @@
echo "Content-type: image/jpeg"
echo ""
/system/sdcard/bin/getimage
exec /system/sdcard/bin/getimage

0
firmware_mod/www/cgi-bin/currentpicoptim.cgi Normal file → Executable file
View File

0
firmware_mod/www/cgi-bin/dumpbootloader.cgi Normal file → Executable file
View File

View File

@@ -1,67 +0,0 @@
#!/bin/sh
echo "Content-type: application/json"
echo "Pragma: no-cache"
echo "Cache-Control: max-age=0, no-store, no-cache"
echo
. /system/sdcard/scripts/common_functions.sh
motion_indicator_color=`/system/sdcard/bin/setconf -g z 2>/dev/null`
if [ "${motion_indicator_color}X" == "X" ]
then
motion_indicator_color="0"
fi
motion_sensitivity=`/system/sdcard/bin/setconf -g m 2>/dev/null`
if [ "${motion_sensitivity}X" == "X" ]
then
motion_sensitivity="0"
fi
region_of_interest=`/system/sdcard/bin/setconf -g r 2>/dev/null`
if [ "${region_of_interest}X" == "X" ]
then
region_of_interest="0,0,0,0"
fi
motion_tracking=`/system/sdcard/bin/setconf -g t 2>/dev/null`
if [ "${motion_tracking}X" == "X" ]
then
motion_tracking=false
fi
motion_timeout=`/system/sdcard/bin/setconf -g u 2>/dev/null`
if [ "${motion_timeout}X" == "X" ]
then
motion_timeout=60
fi
process=`ps -l| grep v4l2rtspserver-master | grep -v grep`
w=`echo ${process}| awk -F '-W' '{print $2}' | awk '{print $1}'`
if [ "${w}X" == "X" ]
then
w="1280"
fi
h=`echo ${process} | awk -F '-H' '{print $2}' | awk '{print $1}'`
if [ "${h}X" == "X" ]
then
h="720"
fi
if [ "$(motion_detection status)" == "ON" ]
then
motion_detection="true"
else
motion_detection="false"
fi
echo "{\"motion_indicator_color\": ${motion_indicator_color},
\"motion_sensitivity\": ${motion_sensitivity},
\"motion_detection\": ${motion_detection},
\"region_of_interest\": [${region_of_interest}],
\"motion_tracking\": ${motion_tracking},
\"motion_timeout\": ${motion_timeout},
\"width\": ${w},
\"height\": ${h}}"

View File

@@ -1,40 +0,0 @@
#!/bin/sh
. /system/sdcard/www/cgi-bin/func.cgi
echo "Content-type: text/html"
echo "Pragma: no-cache"
echo "Cache-Control: max-age=0, no-store, no-cache"
echo
if [ "$F_dir" == "recording" ] || [ "$F_dir" == "timelapse" ] || [ "$F_dir" == "motion" ]; then
echo "<h1 class='is-size-4' >${F_dir} files on SD card</h1>"
cat << EOF
<table id="files">
<tr class="header">
<th>Filename</th>
<th>Size</th>
<th>Date</th>
<th>Actions</th>
</tr>
EOF
for file in $(find /system/sdcard/DCIM/${F_dir}/ -type f)
do
if [[ -f $file ]]; then
ip_addr=$(ip -o -4 addr show | sed 's/.* inet \([^/]*\).*/\1/' | grep -v "127.0.0.1")
file_size=$(ls -lh $file | awk '{print $5}')
file_url=$(ls -lh $file | awk '{print $9}' | sed 's/\/system\/sdcard\/DCIM/\/viewer/')
file_date=$(ls -lh $file | awk '{print $6 "-" $7 "-" $8}')
file_name=$(ls -lh $file | awk '{print $9}' | awk -F / '{print $(NF)}')
echo "
<tr>
<td>${file_name}</td>
<td>${file_size}</td>
<td>${file_date}</td>
<td><a href="${file_url}">download</a>
</tr>
"
fi
done
echo "</table>"
else
echo "<h1 class='is-size-4' >Wrong parameters</h1>"
fi

View File

@@ -1,20 +0,0 @@
#!/bin/sh
echo "Content-type: text/html"
echo "Pragma: no-cache"
echo "Cache-Control: max-age=0, no-store, no-cache"
echo ""
source ./func.cgi
if [ -e "/etc/fang_hacks.cfg" ]; then source /etc/fang_hacks.cfg; fi
PATH="/bin:/sbin:/usr/bin:/system/bin"
cat << EOF
Information:
<pre>Interfaces:<br/>$(ifconfig; iwconfig)</pre>
<pre>Routes:<br/>$(route)</pre>
<pre>DNS:<br/>$(cat /etc/resolv.conf)</pre>
</body>
</html>
EOF

View File

@@ -1,145 +0,0 @@
#!/bin/sh
source ./func.cgi
echo "Pragma: no-cache"
echo "Cache-Control: max-age=0, no-store, no-cache"
SCRIPT_HOME="/system/sdcard/controlscripts/"
if [ -n "$F_script" ]; then
script="${F_script##*/}"
if [ -e "$SCRIPT_HOME/$script" ]; then
case "$F_cmd" in
start)
echo "Content-type: text/html"
echo ""
echo "Running script '$script'..."
echo "<pre>$("$SCRIPT_HOME/$script" 2>&1)</pre>"
;;
disable)
rm "/system/sdcard/config/autostart/$script"
echo "Content-type: application/json"
echo ""
echo "{\"status\": \"ok\"}"
;;
stop)
echo "Content-type: text/html"
echo ""
status='unknown'
echo "Stopping script '$script'..."
echo "<pre>"
"$SCRIPT_HOME/$script" stop 2>&1 && echo "OK" || echo "NOK"
echo "</pre>"
;;
enable)
echo "#!/bin/sh" > "/system/sdcard/config/autostart/$script"
echo "$SCRIPT_HOME$script" >> "/system/sdcard/config/autostart/$script"
echo "Content-type: application/json"
echo ""
echo "{\"status\": \"ok\"}"
;;
view)
echo "Content-type: text/html"
echo ""
echo "Contents of script '$script':"
echo "<pre>$(cat "$SCRIPT_HOME/$script" 2>&1)</pre>"
;;
*)
echo "Content-type: text/html"
echo ""
echo "<p>Unsupported command '$F_cmd'</p>"
;;
esac
else
echo "Content-type: text/html"
echo ""
echo "<p>$F_script is not a valid script!</p>"
fi
return
fi
echo "Content-type: text/html"
echo ""
if [ ! -d "$SCRIPT_HOME" ]; then
echo "<p>No scripts.cgi found in $SCRIPT_HOME</p>"
else
SCRIPTS=$(ls -A "$SCRIPT_HOME")
for i in $SCRIPTS; do
# Card - start
echo "<div class='card script_card'>"
# Header
echo "<header class='card-header'><p class='card-header-title'>"
# echo "<div class='card-content'>"
if [ -x "$SCRIPT_HOME/$i" ]; then
if grep -q "^status()" "$SCRIPT_HOME/$i"; then
status=$("$SCRIPT_HOME/$i" status)
badgestatus=$status
if [ $? -eq 0 ]; then
if [ -n "$status" ]; then
badge="";
else
badge="is-badge-warning";
fi
else
badge="is-badge-danger"
badgestatus="NOK"
fi
echo "<span class='badge $badge' data-badge='$badgestatus'>$i</span>"
else
echo "$i"
fi
# echo "</div>"
echo "</p></header>"
# Footer
echo "<footer class='card-footer'>"
echo "<span class='card-footer-item'>"
# Start / Stop / Run buttons
echo "<div class='buttons'>"
if grep -q "^start()" "$SCRIPT_HOME/$i"; then
echo "<button data-target='cgi-bin/scripts.cgi?cmd=start&script=$i' class='button is-link script_action_start' data-script='$i' "
if [ ! -z "$status" ]; then
echo "disabled"
fi
echo ">Start</button>"
else
echo "<button data-target='cgi-bin/scripts.cgi?cmd=start&script=$i' class='button is-link script_action_start' data-script='$i' "
echo ">Run</button>"
fi
if grep -q "^stop()" "$SCRIPT_HOME/$i"; then
echo "<button data-target='cgi-bin/scripts.cgi?cmd=stop&script=$i' class='button is-danger script_action_stop' data-script='$i' "
if [ ! -n "$status" ]; then
echo "disabled"
fi
echo ">Stop</button>"
fi
echo "</div>"
echo "</span>"
# Autostart Switch
echo "<span class='card-footer-item'>"
echo "<input type='checkbox' id='autorun_$i' name='autorun_$i' class='switch is-rtl autostart' data-script='$i' "
echo " data-unchecked='cgi-bin/scripts.cgi?cmd=disable&script=$i'"
echo " data-checked='cgi-bin/scripts.cgi?cmd=enable&script=$i'"
if [ -f "/system/sdcard/config/autostart/$i" ]; then
echo " checked='checked'"
fi
echo "'>"
echo "<label for='autorun_$i'>Autorun</label>"
echo "</span>"
# View link
echo "<a href='cgi-bin/scripts.cgi?cmd=view&script=$i' class='card-footer-item view_script' data-script="$i">View</a>"
echo "</footer>"
fi
# Card - End
echo "</div>"
done
fi
script=$(cat /system/sdcard/www/scripts/scripts.cgi.js)
echo "<script>$script</script>"

View File

@@ -13,6 +13,54 @@ echo ""
if [ -n "$F_cmd" ]; then
case "$F_cmd" in
all)
echo "auto_night_mode:$(auto_night_mode status)"
if [ -f /system/sdcard/config/autostart/sound-on-startup ]; then
echo "sound_on_startup:ON"
else
echo "sound_on_startup:OFF"
fi
echo "ir_led:$(ir_led status)"
echo "ir_cut:$(ir_cut status)"
echo "blue_led:$(blue_led status)"
echo "yellow_led:$(yellow_led status)"
echo "motion_detection:$(motion_detection status)"
if [ get_config "/system/sdcard/config/motion.conf" "send_email" ] ; then
echo "motion_mail:ON"
else
echo "motion_mail:OFF"
fi
if [ get_config "/system/sdcard/config/motion.conf" "send_telegram" ]; then
echo "motion_telegram:ON"
else
echo "motion_telegram:OFF"
fi
if [ get_config "/system/sdcard/config/motion.conf" "motion_trigger_led" ]; then
echo "motion_led:ON"
else
echo "motion_led:OFF"
fi
if [ get_config "/system/sdcard/config/motion.conf" "save_snapshot" ]; then
echo "motion_snapshot:ON"
else
echo "motion_snapshot:OFF"
fi
if [ get_config "/system/sdcard/config/motion.conf" "publish_mqtt_message" ]; then
echo "motion_mqtt:ON"
else
echo "motion_mqtt:OFF"
fi
if [ get_config "/system/sdcard/config/motion.conf" "publish_mqtt_snapshot" ]; then
echo "motion_mqtt_snapshot:ON"
else
echo "motion_mqtt_snapshot:OFF"
fi
if [ get_config "/system/sdcard/config/motion.conf" "publish_mqtt_video" ]; then
echo "motion_mqtt_video:ON"
else
echo "motion_mqtt_video:OFF"
fi
;;
blue_led)
echo $(blue_led status)
;;
@@ -154,7 +202,7 @@ if [ -n "$F_cmd" ]; then
if [ -s "/system/sdcard/VERSION" ]; then
V_BRANCH=$(/system/sdcard/bin/jq -r .branch /system/sdcard/VERSION)
V_COMMIT=$(/system/sdcard/bin/jq -r .commit /system/sdcard/VERSION)
echo "commit <b>${V_COMMIT}</b> from branch <b>${V_BRANCH}</b>"
echo "commit <b>${V_COMMIT}</b> from the <b>${V_BRANCH}</b> branch"
else
echo "Need to update to create a version file."
fi

View File

@@ -1,147 +0,0 @@
#!/bin/sh
source /system/sdcard/scripts/common_functions.sh
echo "Content-type: text/html"
echo "Pragma: no-cache"
echo "Cache-Control: max-age=0, no-store, no-cache"
echo ""
mount|grep "/system/sdcard"|grep "rw,">/dev/null
if [ $? == 1 ]; then
cat << EOF
<!-- sdcard warning -->
<article class="message is-warning">
<div class="message-header">
<p>Warning</p>
<button class="delete" aria-label="delete"></button>
</div>
<div class="message-body">
Your sdcard is mounted read-only. Settings can't be saved.
<br>
<p>Please try rebooting. If the problem persists, please <a target="_blank" href="https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/search?q=read+only+sdcard&type=Issues">search
for possible solutions.</a></p>
</div>
</article>
<!-- end sdcard warning -->
EOF
fi
cat << EOF
<!-- System -->
<div class='card status_card'>
<header class='card-header'><p class='card-header-title'>System</p></header>
<div class='card-content'>
<div class='content'>
<table>
<tbody>
<tr>
<td> Hostname </td>
<td> $(hostname) </td>
</tr>
<tr>
<td> Model </td>
<td> $(detect_model) </td>
</tr>
<tr>
<td> Firmware date </td>
<td> $(if [ -s "/system/sdcard/VERSION" ]; then /system/sdcard/bin/jq -r .date /system/sdcard/VERSION; else echo "Never updated. Make an update to get version."; fi) </td>
</tr>
<tr>
<td> Firmware branch </td>
<td> $(if [ -s "/system/sdcard/VERSION" ]; then /system/sdcard/bin/jq -r .branch /system/sdcard/VERSION; else echo "Never updated. Make an update to get version."; fi) </td>
</tr>
<tr>
<td> Firmware commit </td>
<td> $(if [ -s "/system/sdcard/VERSION" ]; then echo $(check_commit); else echo "Never updated through UI, please run update to get a version file."; fi) </td>
</tr>
<tr>
<td> Kernel Version </td>
<td> $(/system/sdcard/bin/busybox uname -v) </td>
</tr>
<tr>
<td> Bootloader Version </td>
<td> $(busybox strings /dev/mtd0 | grep "U-Boot 2") </td>
<tr>
<tr>
<td> Local Time </td>
<td> $(date) </td>
</tr>
<tr>
<td> Uptime </td>
<td> $(uptime | sed 's/^.*up *//;s/, *[0-9]* user.*$/m/; s/ day[^0-9]*/d, /;s/ \([hms]\).*m$/\1/;s/:/h, /') </td>
</tr>
<tr>
<td> Load Average </td>
<td> $(uptime | awk -F': ' '{print $2}') </td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- Network -->
<div class='card status_card'>
<header class='card-header'><p class='card-header-title'>Network (WLAN0)</p></header>
<div class='card-content'>
<div class='content'>
<table>
<tbody>
<tr>
<td> SSID </td>
<td> $(/system/bin/iwgetid -r) </td>
</tr>
<tr>
<td> Link Quality </td>
<td> $(cat /proc/net/wireless | awk 'END { print $3 }' | sed 's/\.$//') </td>
</tr>
<tr>
<td> IP Address </td>
<td> $(ifconfig | grep -E "([0-9]{1,3}\.){3}[0-9]{1,3}" | grep -v 127.0.0.1 | awk '{ print $2 }' | cut -f2 -d:) </td>
</tr>
<tr>
<td> MAC Address </td>
<td> $(cat /sys/class/net/wlan0/address) </td>
</tr>
<tr>
<td> Netmask </td>
<td> $(ifconfig wlan0 | sed -rn '2s/ .*:(.*)$/\1/p') </td>
</tr>
<tr>
<td> Gateway </td>
<td> $(route | awk '/default/ { print $2}') </td>
</tr>
<tr>
<td> DNS </td>
<td> <pre>$(cat /etc/resolv.conf) </pre></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- Bootloader -->
<div class='card status_card'>
<header class='card-header'><p class='card-header-title'>Bootloader</p></header>
<div class='card-content'>
Bootloader MD5:
<pre>$(md5sum /dev/mtd0 |cut -f 1 -d " ")</pre>
Bootloader Version:
<pre>$(busybox strings /dev/mtd0 | grep "U-Boot 2")</pre>
Your CMDline is:
<pre>$(cat /proc/cmdline)</pre>
<a target="_blank" href="cgi-bin/dumpbootloader.cgi">Download Bootloader</a>
</div>
</div>
EOF

View File

@@ -1,68 +0,0 @@
#!/bin/sh
echo "Content-type: text/html"
echo "Pragma: no-cache"
echo "Cache-Control: max-age=0, no-store, no-cache"
echo ""
# source header.cgi
mount|grep "/system/sdcard"|grep "rw,">/dev/null
if [ $? == 1 ]; then
cat << EOF
<!-- sdcard warning -->
<article class="message is-warning">
<div class="message-header">
<p>Warning</p>
<button class="delete" aria-label="delete"></button>
</div>
<div class="message-body">
Your sdcard is mounted read-only. Settings can't be saved.
<br>
<p>Please try rebooting. If the problem persists, please <a target="_blank" href="https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/search?q=read+only+sdcard&type=Issues">search
for possible solutions.</a></p>
</div>
</article>
<!-- end sdcard warning -->
EOF
fi
cat << EOF
<!-- Passwords -->
<div class='card status_card'>
<header class='card-header'><p class='card-header-title'>Passwords</p></header>
<div class='card-content'>
<form id="passwordForm" action="cgi-bin/action.cgi?cmd=set_http_password" method="post">
<div class="field is-horizontal">
<div class="field-label is-normal">
<label class="label">Set HTTP Password</label>
</div>
<div class="field-body">
<div class="field">
<div class="control">
<input class="input" id="password" name="password" type="password" size="12" value="*****"/>
</div>
</div>
</div>
</div>
<div class="field is-horizontal">
<div class="field-label is-normal">
</div>
<div class="field-body">
<div class="field">
<div class="control">
<input id="pwSubmit" class="button is-primary" type="submit" value="Set" />
</div>
</div>
</div>
</div>
</form>
</div>
</div>
EOF
script=$(cat /system/sdcard/www/scripts/status.cgi.js)
echo "<script>$script</script>"

View File

@@ -1,198 +0,0 @@
#!/bin/sh
echo "Content-type: text/html"
echo "Pragma: no-cache"
echo "Cache-Control: max-age=0, no-store, no-cache"
echo ""
# source header.cgi
mount|grep "/system/sdcard"|grep "rw,">/dev/null
if [ $? == 1 ]; then
cat << EOF
<!-- sdcard warning -->
<article class="message is-warning">
<div class="message-header">
<p>Warning</p>
<button class="delete" aria-label="delete"></button>
</div>
<div class="message-body">
Your sdcard is mounted read-only. Settings can't be saved.
<br>
<p>Please try rebooting. If the problem persists, please <a target="_blank" href="https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/search?q=read+only+sdcard&type=Issues">search
for possible solutions.</a></p>
</div>
</article>
<!-- end sdcard warning -->
EOF
fi
cat << EOF
<!-- Audio Settings -->
<div class='card status_card'>
<header class='card-header'>
<p class='card-header-title'>Audio Settings</p>
</header>
<div class='card-content'>
<form id="formaudioin" action="cgi-bin/action.cgi?cmd=conf_audioin" method="post">
<div class="field is-horizontal">
<div class="field-label is-normal">
<label class="label">Select audio format</label>
</div>
<div class="field-body">
<div class="select">
<select name="audioinFormat">
<option value="OFF" $(source /system/sdcard/config/rtspserver.conf; if [ "$(echo $AUDIOFORMAT | grep OFF)" != "" ]; then echo selected; fi)>OFF</option>
<option value="OPUS" $(source /system/sdcard/config/rtspserver.conf; if [ "$(echo $AUDIOFORMAT | grep OPUS)" != "" ]; then echo selected; fi)>OPUS</option>
<option value="PCM" $(source /system/sdcard/config/rtspserver.conf; if [ "$(echo $AUDIOFORMAT | grep -w PCM)" != "" ]; then echo selected; fi)>PCM</option>
<option value="PCMU" $(source /system/sdcard/config/rtspserver.conf; if [ "$(echo $AUDIOFORMAT | grep -w PCMU)" != "" ]; then echo selected; fi)>PCMU</option>
<option value="MP3" $(source /system/sdcard/config/rtspserver.conf; if [ "$(echo $AUDIOFORMAT | grep -w MP3)" != "" ]; then echo selected; fi)>MP3</option>
</select>
</div>
<span class="help">
Needs a restart to become active.
</span>
</div>
</div>
<div class="columns">
<div class="column">
<div class="field is-horizontal">
<div class="field-label is-normal">
<label class="label">Select in sample rate</label>
</div>
<div class="field-body">
<div class="select">
<select name="audioinBR">
<option value="8000" $(source /system/sdcard/config/rtspserver.conf; if [ "$(echo $AUDIOINBR | grep 8000)" != "" ]; then echo selected; fi)>8000</option>
<option value="16000" $(source /system/sdcard/config/rtspserver.conf; if [ "$(echo $AUDIOINBR | grep 16000)" != "" ]; then echo selected; fi)>16000</option>
<option value="24000" $(source /system/sdcard/config/rtspserver.conf; if [ "$(echo $AUDIOINBR | grep -w 24000)" != "" ]; then echo selected; fi)>24000</option>
<option value="44100" $(source /system/sdcard/config/rtspserver.conf; if [ "$(echo $AUDIOINBR | grep -w 44100)" != "" ]; then echo selected; fi)>44100</option>
<option value="48000" $(source /system/sdcard/config/rtspserver.conf; if [ "$(echo $AUDIOINBR | grep -w 48000)" != "" ]; then echo selected; fi)>48000</option>
</select>
</div>
<span class="help">
Above 16000 some filters become inactive
</span>
</div>
</div>
<div class="field is-horizontal">
<div class="field-label is-normal">
<label class="label">Filter (low filter)</label>
</div>
<div class="field-body">
<div class="select">
<select name="audioinFilter">
<option value="0" $(if [ "$(/system/sdcard/bin/setconf -g q)" == "0" ]; then echo selected; fi)>No filter</option>
<option value="1" $(if [ "$(/system/sdcard/bin/setconf -g q)" == "1" ]; then echo selected; fi)>Filter 1</option>
<option value="2" $(if [ "$(/system/sdcard/bin/setconf -g q)" == "2" ]; then echo selected; fi)>Filter 2</option>
<option value="3" $(if [ "$(/system/sdcard/bin/setconf -g q)" == "3" ]; then echo selected; fi)>NS Filter LOW</option>
<option value="4" $(if [ "$(/system/sdcard/bin/setconf -g q)" == "4" ]; then echo selected; fi)>NS Filter MODERATE</option>
<option value="5" $(if [ "$(/system/sdcard/bin/setconf -g q)" == "5" ]; then echo selected; fi)>NS Filter HIGH</option>
<option value="6" $(if [ "$(/system/sdcard/bin/setconf -g q)" == "6" ]; then echo selected; fi)>NS Filter VERY HIGH</option>
</select>
</div>
</div>
</div>
<div class="field is-horizontal">
<div class="field-label is-normal">
<label class="label">High pass filter</label>
</div>
<div class="field-body">
<p class="control">
<div class="double">
<input type="checkbox" name="HFEnabled" value="enabled" $(if [ "$(/system/sdcard/bin/setconf -g l)" == "true" ]; then echo checked; fi)/>
</div>
</p>
</div>
</div>
</div>
<div class="column">
<div class="field is-horizontal">
<div class="field-label is-normal">
<label class="label">Select out sample rate</label>
</div>
<div class="field-body">
<div class="select">
<select name="audiooutBR">
<option value="8000" $(source /system/sdcard/config/rtspserver.conf; if [ "$(echo $AUDIOOUTBR | grep 8000)" != "" ]; then echo selected; fi)>8000</option>
<option value="16000" $(source /system/sdcard/config/rtspserver.conf; if [ "$(echo $AUDIOOUTBR | grep 16000)" != "" ]; then echo selected; fi)>16000</option>
<option value="24000" $(source /system/sdcard/config/rtspserver.conf; if [ "$(echo $AUDIOOUTBR | grep -w 24000)" != "" ]; then echo selected; fi)>24000</option>
<option value="44100" $(source /system/sdcard/config/rtspserver.conf; if [ "$(echo $AUDIOOUTBR | grep -w 44100)" != "" ]; then echo selected; fi)>44100</option>
<option value="48000" $(source /system/sdcard/config/rtspserver.conf; if [ "$(echo $AUDIOOUTBR | grep -w 48000)" != "" ]; then echo selected; fi)>48000</option>
</select>
</div>
</div>
</div>
<div class="field is-horizontal">
<div class="field-label is-normal">
<label class="label">Volume</label>
</div>
<input class="slider is-fullwidth" name="audioinVol" step="1" min="-1" max="120" value="$(/system/sdcard/bin/setconf -g h)" type="range">
</div>
<br><br>
<div class="field is-horizontal">
<div class="field-label is-normal">
<label class="label">AEC filter</label>
</div>
<div class="field-body">
<p class="control">
<div class="double">
<input type="checkbox" name="AECEnabled" value="enabled" $(if [ "$(/system/sdcard/bin/setconf -g a)" == "true" ]; then echo checked; fi)/>
</div>
</p>
</div>
</div>
</div>
</div>
<p class="control">
<input id="audioinSubmit" class="button is-primary" type="submit" value="Set" />
</p>
</form>
</div>
</div>
<!-- Audio Testing -->
<div class='card status_card'>
<header class='card-header'><p class='card-header-title'>Audio Test</p></header>
<div class='card-content'>
<div class="columns">
<div class="column">
<form id="formAudio" action="cgi-bin/action.cgi?cmd=audio_test" method="post">
<label>Audio Output Test</label>
<div class="select">
<select name="audioSource">
$(
for i in `/system/sdcard/bin/busybox find /usr/share/notify/ /system/sdcard/media -name *.wav`
do
echo "<option value=$i> `/system/sdcard/bin/busybox basename $i` </option>"
done
)
</select>
</div>
<input class="slider is-fullwidth" name="audiotestVol" step="1" min="0" max="120" value="50" type="range">
<div class="field-body">
<div class="field">
<div class="control">
<input id="AudioTestSubmit" class="button is-primary" type="submit" value="Play" />
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
EOF
script=$(cat /system/sdcard/www/scripts/status.cgi.js)
echo "<script>$script</script>"

View File

@@ -1,94 +0,0 @@
#!/bin/sh
echo "Content-type: text/html"
echo "Pragma: no-cache"
echo "Cache-Control: max-age=0, no-store, no-cache"
echo ""
# source header.cgi
mount|grep "/system/sdcard"|grep "rw,">/dev/null
if [ $? == 1 ]; then
cat << EOF
<!-- sdcard warning -->
<article class="message is-warning">
<div class="message-header">
<p>Warning</p>
<button class="delete" aria-label="delete"></button>
</div>
<div class="message-body">
Your sdcard is mounted read-only. Settings can't be saved.
<br>
<p>Please try rebooting. If the problem persists, please <a target="_blank" href="https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/search?q=read+only+sdcard&type=Issues">search
for possible solutions.</a></p>
</div>
</article>
<!-- end sdcard warning -->
EOF
fi
cat << EOF
<script>
function call(url){
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.send();
}
</script>
<!-- Blue / Yellow LED -->
<div class='card status_card'>
<header class='card-header'><p class='card-header-title'>LED</p></header>
<div class='card-content'>
<div class="columns">
<div class="column">
<label>Blue LED</label>
<div class="buttons">
<button class="button is-link" onClick="call('cgi-bin/action.cgi?cmd=blue_led_on')">On</button>
<button class="button is-warning" onClick="call('cgi-bin/action.cgi?cmd=blue_led_off')">Off</button>
</div>
</div>
<div class="column">
<label>Yellow LED</label>
<div class="buttons">
<button class="button is-link" onClick="call('cgi-bin/action.cgi?cmd=yellow_led_on')">On</button>
<button class="button is-warning" onClick="call('cgi-bin/action.cgi?cmd=yellow_led_off')">Off</button>
</div>
</div>
</div>
</div>
</div>
<!-- IR LED / (Filter)Cut-->
<div class='card status_card'>
<header class='card-header'><p class='card-header-title'>IR</p></header>
<div class='card-content'>
<div class="columns">
<div class="column">
<label>IR LED</label>
<div class="buttons">
<button class="button is-link" onClick="call('cgi-bin/action.cgi?cmd=ir_led_on')">On</button>
<button class="button is-warning" onClick="call('cgi-bin/action.cgi?cmd=ir_led_off')">Off</button>
</div>
</div>
<div class="column">
<label>IR Filter</label>
<div class="buttons">
<button class="button is-link" onClick="call('cgi-bin/action.cgi?cmd=ir_cut_on')">On</button>
<button class="button is-warning" onClick="call('cgi-bin/action.cgi?cmd=ir_cut_off')">Off</button>
</div>
</div>
</div>
</div>
</div>
EOF
script=$(cat /system/sdcard/www/scripts/status.cgi.js)
echo "<script>$script</script>"

View File

@@ -1,225 +0,0 @@
#!/bin/sh
echo "Content-type: text/html"
echo "Pragma: no-cache"
echo "Cache-Control: max-age=0, no-store, no-cache"
echo ""
# source header.cgi
mount|grep "/system/sdcard"|grep "rw,">/dev/null
if [ $? == 1 ]; then
cat << EOF
<!-- sdcard warning -->
<article class="message is-warning">
<div class="message-header">
<p>Warning</p>
<button class="delete" aria-label="delete"></button>
</div>
<div class="message-body">
Your sdcard is mounted read-only. Settings can't be saved.
<br>
<p>Please try rebooting. If the problem persists, please <a target="_blank" href="https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/search?q=read+only+sdcard&type=Issues">search
for possible solutions.</a></p>
</div>
</article>
<!-- end sdcard warning -->
EOF
fi
cat << EOF
<script>
function call(url){
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.send();
}
</script>
<!-- OSD -->
<div class='card status_card'>
<header class='card-header'><p class='card-header-title'>OSD Display</p></header>
<div class='card-content'>
<form id="formOSD" action="cgi-bin/action.cgi?cmd=osd" method="post">
<div class="field is-horizontal">
<div class="field-label is-normal">
<label class="label">Enable Text</label>
</div>
<div class="field-body">
<div class="field is-grouped">
<p class="control">
<input type="checkbox" name="OSDenable" value="enabled" $(if [ "$(grep ENABLE_OSD /system/sdcard/config/osd.conf | sed s/ENABLE_OSD=//)" == "true" ]; then echo checked; fi) />
</p>
<p class="control">
<input class="input" id="osdtext" name="osdtext" type="text" size="25" value="$(source /system/sdcard/config/osd.conf && echo "$OSD")"/>
<span class="help">
Enter time-variables in <a href="http://strftime.org/" target="_blank">strftime</a> format
</span>
</p>
</div>
</div>
</div>
<div class="field is-horizontal">
<div class="field-label is-normal">
<label class="label">Enable Axis</label>
</div>
<div class="field-body">
<div class="field is-grouped">
<p class="control">
<input type="checkbox" name="AXISenable" value="enabled" $(if [[ "$(grep DISPLAY_AXIS /system/sdcard/config/osd.conf | sed s/DISPLAY_AXIS=//)" == "true" ]];then echo checked; fi) />
</p>
</div>
</div>
</div>
<div class="field is-horizontal">
<div class="field-label is-normal">
<label class="label">OSD Color</label>
</div>
<div class="field-body">
<div class="field">
<div class="control">
<div class="select">
<select name="color">
<option value="0" $(if [ "$(grep COLOR /system/sdcard/config/osd.conf | sed s/COLOR=//)" -eq 0 ]; then echo selected; fi)>White</option>
<option value="1" $(if [ "$(grep COLOR /system/sdcard/config/osd.conf | sed s/COLOR=//)" -eq 1 ]; then echo selected; fi)>Black</option>
<option value="2" $(if [ "$(grep COLOR /system/sdcard/config/osd.conf | sed s/COLOR=//)" -eq 2 ]; then echo selected; fi)>Red</option>
<option value="3" $(if [ "$(grep COLOR /system/sdcard/config/osd.conf | sed s/COLOR=//)" -eq 3 ]; then echo selected; fi)>Green</option>
<option value="4" $(if [ "$(grep COLOR /system/sdcard/config/osd.conf | sed s/COLOR=//)" -eq 4 ]; then echo selected; fi)>Blue</option>
<option value="5" $(if [ "$(grep COLOR /system/sdcard/config/osd.conf | sed s/COLOR=//)" -eq 5 ]; then echo selected; fi)>Cyan</option>
<option value="6" $(if [ "$(grep COLOR /system/sdcard/config/osd.conf | sed s/COLOR=//)" -eq 6 ]; then echo selected; fi)>Yellow</option>
<option value="7" $(if [ "$(grep COLOR /system/sdcard/config/osd.conf | sed s/COLOR=//)" -eq 7 ]; then echo selected; fi)>Purple</option>
</select>
</div>
</div>
</div>
</div>
</div>
<div class="field is-horizontal">
<div class="field-label is-normal">
<label class="label">Font name</label>
</div>
<div class="field-body">
<div class="field">
<div class="control">
<div class="select">
<select name="FontName">
$(
fontName="$(/system/sdcard/bin/setconf -g e)"
echo -n "<option value=\"\""
if [ -n "${fontName-unset}" ] ; then echo selected; fi
echo -n ">Default fonts </option>"
for i in `/system/sdcard/bin/busybox find /system/sdcard/fonts -name *.ttf`
do
echo -n "<option value=\"$i\" "
if [ "$fontName" == "$i" ] ; then echo selected; fi
echo -n ">`/system/sdcard/bin/busybox basename $i` </option>"
done
)
</select>
</div>
</div>
</div>
</div>
</div>
<div class="field is-horizontal">
<div class="field-label is-normal">
<label class="label">OSD Text Size</label>
</div>
<div class="field-body">
<div class="field">
<p class="control">
<input class="input" id="OSDSize" name="OSDSize" type="number" size="4"
value="$(
fontSize=$(/system/sdcard/bin/setconf -g s)
if [ "$fontSize" == "0" ]; then echo 18
elif [ "$fontSize" == "1" ]; then echo 40
else echo "$fontSize"
fi
)"/>
</p>
<p class="help">Too high value won't display anything</p>
</div>
</div>
</div>
<div class="field is-horizontal">
<div class="field-label is-normal">
<label class="label">Pixels between chars</label>
</div>
<div class="field-body">
<div class="field">
<p class="control">
<input class="input" id="spacepixels" name="spacepixels" type="number" size="4" value="$(source /system/sdcard/config/osd.conf && echo "$SPACE")"/>
</p>
<p class="help">Can be negative</p>
</div>
</div>
</div>
<div class="field is-horizontal">
<div class="field-label is-normal">
<label class="label">Y Position</label>
</div>
<div class="field-body">
<div class="field">
<p class="control">
<input class="input" id="posy" name="posy" type="number" size="6" value="$(source /system/sdcard/config/osd.conf && echo "$POSY")"/>
</p>
</div>
</div>
</div>
<div class="field is-horizontal">
<div class="field-label is-normal">
<label class="label">Fixed width</label>
</div>
<div class="field-body">
<div class="field">
<div class="control">
<div class="select">
<select name="fixedw">
<option value="0" $(if [ "$(grep FIXEDW /system/sdcard/config/osd.conf | sed s/FIXEDW=//)" -eq 0 ]; then echo selected; fi)>No</option>
<option value="1" $(if [ "$(grep FIXEDW /system/sdcard/config/osd.conf | sed s/FIXEDW=//)" -eq 1 ]; then echo selected; fi)>Yes</option>
</select>
</div>
<p class="help">Fixed width works only for "default" fonts</p>
</div>
</div>
</div>
</div>
<div class="field is-horizontal">
<div class="field-label is-normal">
</div>
<div class="field-body">
<div class="field">
<div class="control">
<input id="osdSubmit" class="button is-primary" type="submit" value="Set" />
</div>
</div>
</div>
</div>
</form>
</div>
</div>
<!-- OSD Debug -->
<div class='card status_card'>
<header class='card-header'><p class='card-header-title'>Display debug info on OSD</p></header>
<div class='card-content'>
<button class="button is-link" onClick="call('cgi-bin/action.cgi?cmd=onDebug')">On</button>
<button class="button is-warning" onClick="call('cgi-bin/action.cgi?cmd=offDebug')">Off</button>
</div>
</div>
EOF
script=$(cat /system/sdcard/www/scripts/status.cgi.js)
echo "<script>$script</script>"

View File

@@ -1,82 +0,0 @@
#!/bin/sh
echo "Content-type: text/html"
echo "Pragma: no-cache"
echo "Cache-Control: max-age=0, no-store, no-cache"
echo ""
# source header.cgi
mount|grep "/system/sdcard"|grep "rw,">/dev/null
if [ $? == 1 ]; then
cat << EOF
<!-- sdcard warning -->
<article class="message is-warning">
<div class="message-header">
<p>Warning</p>
<button class="delete" aria-label="delete"></button>
</div>
<div class="message-body">
Your sdcard is mounted read-only. Settings can't be saved.
<br>
<p>Please try rebooting. If the problem persists, please <a target="_blank" href="https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/search?q=read+only+sdcard&type=Issues">search
for possible solutions.</a></p>
</div>
</article>
<!-- end sdcard warning -->
EOF
fi
cat << EOF
<script>
function call(url){
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.send();
}
</script>
<!-- Motor -->
<div class='card status_card'>
<header class='card-header'><p class='card-header-title'>Motor</p></header>
<div class='card-content'>
<table class="motor_control">
<tr>
<td></td>
<td>
<button class="button is-link" onclick="call('cgi-bin/action.cgi?cmd=motor_up&val='+document.getElementById('val').value)">&uarr; Up</button>
</td>
<td></td>
</tr>
<tr>
<td>
<button class="button is-link" onclick="call('cgi-bin/action.cgi?cmd=motor_left&val='+document.getElementById('val').value)">&larr; Left</button>
</td>
<td>
<input class="input has-text-centered" type="text" id="val" name="val" value="100">
</td>
<td>
<button class="button is-link" onclick="call('cgi-bin/action.cgi?cmd=motor_right&val='+document.getElementById('val').value)">Right &rarr;</button>
</td>
</tr>
<tr>
<td></td>
<td>
<button class="button is-link" onclick="call('cgi-bin/action.cgi?cmd=motor_down&val='+document.getElementById('val').value)">&darr; Down</button>
</td>
<td></td>
</tr>
</table>
<div class="buttons">
<button class="button is-warning" onclick="call('cgi-bin/action.cgi?cmd=motor_calibrate')">Calibrate</button>
</div>
</div>
</div>
EOF
script=$(cat /system/sdcard/www/scripts/status.cgi.js)
echo "<script>$script</script>"

View File

@@ -1,106 +0,0 @@
#!/bin/sh
echo "Content-type: text/html"
echo "Pragma: no-cache"
echo "Cache-Control: max-age=0, no-store, no-cache"
echo ""
# source header.cgi
mount|grep "/system/sdcard"|grep "rw,">/dev/null
if [ $? == 1 ]; then
cat << EOF
<!-- sdcard warning -->
<article class="message is-warning">
<div class="message-header">
<p>Warning</p>
<button class="delete" aria-label="delete"></button>
</div>
<div class="message-body">
Your sdcard is mounted read-only. Settings can't be saved.
<br>
<p>Please try rebooting. If the problem persists, please <a target="_blank" href="https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/search?q=read+only+sdcard&type=Issues">search
for possible solutions.</a></p>
</div>
</article>
<!-- end sdcard warning -->
EOF
fi
cat << EOF
<script>
function call(url){
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.send();
}
</script>
<!-- System -->
<div class='card status_card'>
<header class='card-header'><p class='card-header-title'>System Properties</p></header>
<div class='card-content'>
<form id="tzForm" action="cgi-bin/action.cgi?cmd=settz" method="post">
<div class="field is-horizontal">
<div class="field-label is-normal">
<label class="label" for="tz">Time Zone</label>
</div>
<div class="field-body">
<div class="field">
<div class="control">
<div class="select">
<select name="timeZone">
$(/system/sdcard/bin/busybox awk -F '\t' -v tzn="$(cat /system/sdcard/config/timezone.conf)" '{print "<option value=\""$1"\""; if ($1==tzn) print "selected"; print ">" $1 "</option>"}' /system/sdcard/www/timezones.tsv)
</select>
</div>
<p class="help">$(date) - $(cat /etc/TZ)</p>
</div>
</div>
</div>
</div>
<div class="field is-horizontal">
<div class="field-label is-normal">
<label class="label" for="ntp_srv">NTP Server</label>
</div>
<div class="field-body">
<div class="field">
<div class="control">
<input class="input" id="ntp_srv" name="ntp_srv" type="text" size="25" value="$(cat /system/sdcard/config/ntp_srv.conf)" />
</div>
</div>
</div>
</div>
<div class="field is-horizontal">
<div class="field-label is-normal">
<label class="label" for="hostname">Hostname</label>
</div>
<div class="field-body">
<div class="field">
<div class="control">
<input class="input" id="hostname" name="hostname" type="text" size="15" value="$(hostname)" />
</div>
</div>
</div>
</div>
<div class="field is-horizontal">
<div class="field-label is-normal">
</div>
<div class="field-body">
<div class="field">
<div class="control">
<input id="tzSubmit" class="button is-primary" type="submit" value="Set" />
</div>
</div>
</div>
</div>
</form>
</div>
</div>
EOF
script=$(cat /system/sdcard/www/scripts/status.cgi.js)
echo "<script>$script</script>"

View File

@@ -1,363 +0,0 @@
#!/bin/sh
echo "Content-type: text/html"
echo "Pragma: no-cache"
echo "Cache-Control: max-age=0, no-store, no-cache"
echo ""
# source header.cgi
mount|grep "/system/sdcard"|grep "rw,">/dev/null
if [ $? == 1 ]; then
cat << EOF
<!-- sdcard warning -->
<article class="message is-warning">
<div class="message-header">
<p>Warning</p>
<button class="delete" aria-label="delete"></button>
</div>
<div class="message-body">
Your sdcard is mounted read-only. Settings can't be saved.
<br>
<p>Please try rebooting. If the problem persists, please <a target="_blank" href="https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/search?q=read+only+sdcard&type=Issues">search
for possible solutions.</a></p>
</div>
</article>
<!-- end sdcard warning -->
EOF
fi
cat << EOF
<script>
function call(url){
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.send();
}
</script>
<!-- Video settings -->
<div class='card status_card'>
<header class='card-header'><p class='card-header-title'>Video Settings</p></header>
<div class='card-content'>
<form id="formResolution" action="cgi-bin/action.cgi?cmd=set_video_size" method="post">
<div class="columns">
<div class="column">
<div class="field is-horizontal">
<div class="field-body">
<div class="field-label is-normal">
<label class="label">Video username</label>
</div>
<div class="field">
<div class="control">
<input class="input" id="videouser" name="videouser" type="text" size="12" value="$(source /system/sdcard/config/rtspserver.conf; echo $USERNAME)" />
</div>
</div>
</div>
</div>
</div>
<div class="column">
<div class="field-body">
<div class="field-label is-normal">
<label class="label">Video password</label>
</div>
<div class="field">
<div class="control">
<input class="input" id="videopassword" name="videopassword" type="password" size="12" value="$(source /system/sdcard/config/rtspserver.conf; echo $USERPASSWORD)" />
</div>
</div>
</div>
</div>
<div class="column">
<div class="field-body">
<div class="field-label is-normal">
<label class="label">Video port</label>
</div>
<div class="field">
<div class="control">
<input class="input" id="videoport" name="videoport" type="number" size="12" value=$(source /system/sdcard/config/rtspserver.conf; echo $PORT) />
</div>
</div>
<span class="help">
Default is 8554
</span>
</div>
</div>
</div>
<div class="columns">
<div class="column">
<div class="field is-horizontal">
<div class="field-label is-normal">
<label class="label">Video Size</label>
</div>
<div class="field-body">
<div class="field">
<div class="control">
<div class="select">
<select name="video_size">
<option value="-W640 -H360" $(source /system/sdcard/config/rtspserver.conf; if [ "$RTSPH264OPTS" == "-W640 -H360" ]; then echo selected; fi) >640x360</option>
<option value="-W768 -H432" $(source /system/sdcard/config/rtspserver.conf; if [ "$RTSPH264OPTS" == "-W768 -H432" ]; then echo selected; fi) >768x432</option>
<option value="-W960 -H540" $(source /system/sdcard/config/rtspserver.conf; if [ "$RTSPH264OPTS" == "-W960 -H540" ]; then echo selected; fi) >960x540</option>
<option value="-W1280 -H720" $(source /system/sdcard/config/rtspserver.conf; if [ "$RTSPH264OPTS" == "-W1280 -H720" ] || [ -z "$RTSPH264OPTS" ]; then echo selected; fi) >1280x720</option>
<option value="-W1600 -H900" $(source /system/sdcard/config/rtspserver.conf; if [ "$RTSPH264OPTS" == "-W1600 -H900" ]; then echo selected; fi) >1600x900</option>
<option value="-W1920 -H1080" $(source /system/sdcard/config/rtspserver.conf; if [ "$RTSPH264OPTS" == "-W1920 -H1080" ]; then echo selected; fi) >1920x1080</option>
</select>
</div>
</div>
</div>
</div>
</div>
<div class="field is-horizontal">
<div class="field-label is-normal">
<label class="label">Video format</label>
</div>
<div class="field-body">
<div class="field">
<div class="control">
<div class="select">
<select name="video_format">
0 = FixedQp, 1 = CBR, 2 = VBR, 3 = SMART
<option value="0" $(source /system/sdcard/config/rtspserver.conf; if [ "$(echo $VIDEOFORMAT | grep -w 0)" != "" ]; then echo selected; fi)>FixedQp</option>
<option value="1" $(source /system/sdcard/config/rtspserver.conf; if [ "$(echo $VIDEOFORMAT | grep -w 1)" != "" ]; then echo selected; fi)>CBR</option>
<option value="2" $(source /system/sdcard/config/rtspserver.conf; if [ "$(echo $VIDEOFORMAT | grep -w 2)" != "" ] || [ -z "$VIDEOFORMAT" ] ; then echo selected; fi)>VBR</option>
<option value="3" $(source /system/sdcard/config/rtspserver.conf; if [ "$(echo $VIDEOFORMAT | grep -w 3)" != "" ]; then echo selected; fi)>SMART</option>
</select>
</div>
</div>
</div>
</div>
</div>
<div class="field is-horizontal">
<div class="field-body">
<div class="field-label is-horizontal">
<label class="label">FrameRate: number of image(s) </label>
</div>
<div class="field">
<div class="control">
<input class="input" id="frmRateNum" name="frmRateNum" type="text" size="5" value="$(source /system/sdcard/config/rtspserver.conf; echo $FRAMERATE_NUM)" placeholder="25"/>
</div>
</div>
<div class="field-label is-horizontal">
<label class="label">per </label>
</div>
<div class="field">
<div class="control">
<input class="input" id="frmRateDen" name="frmRateDen" type="text" size=5 value="$(source /system/sdcard/config/rtspserver.conf; echo $FRAMERATE_DEN)" placeholder="1" />
</div>
</div>
<div class="field-label is-horizontal">
<label class="label"> second(s) </label>
</div>
</div>
</div>
</div>
<div class="column">
<div class="field is-horizontal">
<div class="field-label is-normal">
<label class="label">bitrate</label>
</div>
<div class="field-body">
<div class="field">
<div class="control">
<input class="input" id="brbitrate" name="brbitrate" type="text" size="5" value="$(/system/sdcard/bin/setconf -g b)"/> kbps
</div>
</div>
</div>
</div>
</div>
</div>
<div class="field is-horizontal">
<div class="field-body">
<div class="field">
<div class="control">
<input id="resSubmit" class="button is-primary" type="submit" value="Set" />
</div>
</div>
</div>
</div>
</form>
</div>
</div>
<!-- Video Test -->
<div class='card status_card'>
<header class='card-header'><p class='card-header-title'>Video Test</p></header>
<div class='card-content'>
<div class="columns">
<div class="column">
<div class="buttons">
<a class="button is-link" href='cgi-bin/currentpic.cgi' target='_blank'>Get Image</a>
</div>
</div>
</div>
</div>
</div>
<!-- Auto Night Mode -->
<div class='card status_card'>
<header class='card-header'><p class='card-header-title'>Auto Night Mode</p></header>
<div class='card-content'>
<div class="columns">
<div class="column">
<button class="button is-link" onClick="call('cgi-bin/action.cgi?cmd=auto_night_mode_start')">On</button>
<button class="button is-warning" onClick="call('cgi-bin/action.cgi?cmd=auto_night_mode_stop')">Off</button>
<input class="is-checkradio" id="night_config_hw" type="radio" name="night_config" $(if [ "$(grep -q -e "=hw" /system/sdcard/config/autonight.conf; echo $?)" != 0 ]; then echo "checked"; fi) onClick="call('cgi-bin/action.cgi?cmd=autonight_hw')" >
<label for="night_config_hw">HW</label>
<input class="is-checkradio" id="night_config_sw" type="radio" name="night_config" $(if [ "$(grep -q -e "=sw" /system/sdcard/config/autonight.conf; echo $?)" == 0 ]; then echo "checked"; fi) onClick="call('cgi-bin/action.cgi?cmd=autonight_sw')">
<label for="night_config_sw">SW</label>
</div>
<div class="column">
<form id="formldr" action="cgi-bin/action.cgi?cmd=setldravg" method="post">
<p>Use average measurement on switching.</p>
<label class="label">Number of measurements</label>
<div class="field is-grouped">
<div class="control">
<div class="select">
<select class="select" name="avg">
<option value="1" $(if [ "$(sed s/AVG=// /system/sdcard/config/ldr-average.conf)" -eq 1 ]; then echo selected; fi)>1</option>
<option value="2" $(if [ "$(sed s/AVG=// /system/sdcard/config/ldr-average.conf)" -eq 2 ]; then echo selected; fi)>2</option>
<option value="3" $(if [ "$(sed s/AVG=// /system/sdcard/config/ldr-average.conf)" -eq 3 ]; then echo selected; fi)>3</option>
<option value="4" $(if [ "$(sed s/AVG=// /system/sdcard/config/ldr-average.conf)" -eq 4 ]; then echo selected; fi)>4</option>
<option value="5" $(if [ "$(sed s/AVG=// /system/sdcard/config/ldr-average.conf)" -eq 5 ]; then echo selected; fi)>5</option>
<option value="10" $(if [ "$(sed s/AVG=// /system/sdcard/config/ldr-average.conf)" -eq 10 ]; then echo selected; fi)>10</option>
<option value="15" $(if [ "$(sed s/AVG=// /system/sdcard/config/ldr-average.conf)" -eq 15 ]; then echo selected; fi)>15</option>
</select>
</div>
</div>
<p class="control">
<input id="ldrSubmit" class="button is-primary" type="submit" value="Set" />
</p>
</div>
</form>
</div>
</div>
</div>
</div>
<!-- RTSP -->
<div class='card status_card'>
<header class='card-header'><p class='card-header-title'>RTSP</p></header>
<div class='card-content'>
<div class="columns">
<div class="column">
<label>Night Vision</label>
<div class="buttons">
<button class="button is-link" onClick="call('cgi-bin/action.cgi?cmd=toggle-rtsp-nightvision-on')">On</button>
<button class="button is-warning" onClick="call('cgi-bin/action.cgi?cmd=toggle-rtsp-nightvision-off')">Off</button>
</div>
</div>
<div class="column">
<br>
<div class="field is-horizontal">
<div class="field">
<input class="switch" name="flip" id="flip" type="checkbox" $(if [ "$(/system/sdcard/bin/setconf -g f)" == 1 ]; then echo "checked"; fi) >
<label for="flip">Image flip</label>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- H264 RTSP -->
<div class='card status_card'>
<header class='card-header'><p class='card-header-title'>Start H264 RTSP</p></header>
<div class='card-content'>
<button class="button is-link" onClick="call('cgi-bin/action.cgi?cmd=h264_start')">Start</button>
<button class="button is-warning" onClick="call('cgi-bin/action.cgi?cmd=rtsp_stop')">Stop</button>
EOF
PATH="/bin:/sbin:/usr/bin:/media/mmcblk0p2/data/bin:/media/mmcblk0p2/data/sbin:/media/mmcblk0p2/data/usr/bin"
IP=$(ifconfig wlan0 |grep "inet addr" |awk '{print $2}' |awk -F: '{print $2}')
echo "<p>Path to feed: <a href='rtsp://$IP:$(source /system/sdcard/config/rtspserver.conf; echo $PORT)/unicast'>rtsp://$IP:$(source /system/sdcard/config/rtspserver.conf; echo $PORT)/unicast</a></p>"
echo "<p>HLS: <a href='http://$IP:$(source /system/sdcard/config/rtspserver.conf; echo $PORT)/unicast.m3u8'>http://$IP:$(source /system/sdcard/config/rtspserver.conf; echo $PORT)/unicast.m3u8</a></p>"
echo "<p>hls.js web player: <a href='http://$IP:$(source /system/sdcard/config/rtspserver.conf; echo $PORT)'>http://$IP:$(source /system/sdcard/config/rtspserver.conf; echo $PORT)</a></p>"
echo "<p>MPEG-DASH: <a href='http://$IP:$(source /system/sdcard/config/rtspserver.conf; echo $PORT)/unicast.mpd'>http://$IP:$(source /system/sdcard/config/rtspserver.conf; echo $PORT)/unicast.mpd</a></p>"
echo "HLS & MPEG-DASH require the rtspserver to be started with the -S flag. This may reduce the compatibility with some ip camera viewers such as ipcamviewer etc."
cat << EOF
</div>
</div>
<!-- MJPEG RTSP -->
<div class='card status_card'>
<header class='card-header'><p class='card-header-title'>Start MJPEG RTSP</p></header>
<div class='card-content'>
<button class="button is-link" onClick="call('cgi-bin/action.cgi?cmd=mjpeg_start')">Start</button>
<button class="button is-warning" onClick="call('cgi-bin/action.cgi?cmd=rtsp_stop')">Stop</button>
EOF
PATH="/bin:/sbin:/usr/bin:/media/mmcblk0p2/data/bin:/media/mmcblk0p2/data/sbin:/media/mmcblk0p2/data/usr/bin"
IP=$(ifconfig wlan0 |grep "inet addr" |awk '{print $2}' |awk -F: '{print $2}')
echo "<p>Path to feed : <a href='rtsp://$IP:$(source /system/sdcard/config/rtspserver.conf; echo $PORT)/unicast'>rtsp://$IP:$(source /system/sdcard/config/rtspserver.conf; echo $PORT)/unicast</a></p>"
cat << EOF
</div>
</div>
<!-- Timelapse Config-->
<div class='card status_card'>
<header class='card-header'><p class='card-header-title'>Timelapse Settings</p></header>
<div class='card-content'>
<form id="formTimelapse" action="cgi-bin/action.cgi?cmd=conf_timelapse" method="post">
<div class="field is-horizontal">
<div class="field-label is-normal">
<label class="label">Interval</label>
</div>
<div class="field-body">
<div class="field">
<div class="control">
<input class="input" id="tlinterval" name="tlinterval" type="text" size="5" value="$(source /system/sdcard/config/timelapse.conf && echo "$TIMELAPSE_INTERVAL")"/> seconds
</div>
</div>
</div>
</div>
<div class="field is-horizontal">
<div class="field-label is-normal">
<label class="label">Duration</label>
</div>
<div class="field-body">
<div class="field">
<div class="control">
<input class="input" id="tlduration" name="tlduration" type="text" size="5" value="$(source /system/sdcard/config/timelapse.conf && echo "$TIMELAPSE_DURATION")"/> minutes
</div>
<p class="help">Set to 0 for unlimited</p>
<p class="help">These settings configure the timelapse mode. Start the timelapse on the Services page.</p>
</div>
</div>
</div>
<div class="field is-horizontal">
<div class="field-label is-normal">
</div>
<div class="field-body">
<div class="field">
<div class="control">
<input id="tlSubmit" class="button is-primary" type="submit" value="Save Configuration" />
</div>
</div>
</div>
</div>
</form>
</div>
</div>
EOF
script=$(cat /system/sdcard/www/scripts/status.cgi.js)
echo "<script>$script</script>"

View File

@@ -0,0 +1,271 @@
#!/bin/sh
. /system/sdcard/www/cgi-bin/func.cgi
. /system/sdcard/scripts/common_functions.sh
export LD_LIBRARY_PATH=/system/lib
export LD_LIBRARY_PATH=/thirdlib:$LD_LIBRARY_PATH
echo "Content-type: text/html"
echo "Pragma: no-cache"
echo "Cache-Control: max-age=0, no-store, no-cache"
echo ""
if [ -n "$F_cmd" ]; then
case "$F_cmd" in
get_config)
source /system/sdcard/config/rtspserver.conf
source /system/sdcard/config/autonight.conf
source /system/sdcard/config/ldr-average.conf
source /system/sdcard/config/timelapse.conf
source /system/sdcard/config/osd.conf
echo "multicast#:#${MULTICASTDEST}"
echo "flip#:#${FLIP}"
echo "codec#:#${CODEC}"
echo "videoSize#:#${RTSPOPTS}"
echo "bitRate#:#${BITRATE}"
echo "format#:#${VIDEOFORMAT}"
echo "frmRateNum#:#${FRAMERATE_NUM}"
echo "frmRateDen#:#${FRAMERATE_DEN}"
echo "videoUser#:#${USERNAME}"
echo "videoPassword#:#${USERPASSWORD}"
echo "videoPort#:#${PORT}"
echo "autoNightMode#:#${autonight_mode}"
echo "avg#:#${AVG}"
echo "audioinFormat#:#${AUDIOFORMAT}"
echo "audioinBR#:#${AUDIOINBR}"
echo "audiooutBR#:#${AUDIOOUTBR}"
echo "audioinFilter#:#$(/system/sdcard/bin/setconf -g q)"
echo "HFEnabled#:#$(/system/sdcard/bin/setconf -g l)"
echo "AECEnabled#:#$(/system/sdcard/bin/setconf -g a)"
echo "audioinVol#:#$(/system/sdcard/bin/setconf -g h)"
echo "tlinterval#:#${TIMELAPSE_INTERVAL}"
echo "tlduration#:#${TIMELAPSE_DURATION}"
echo "osdEnable#:#${ENABLE_OSD}"
echo "osdText#:#${OSD}"
echo "osdAxis#:#${DISPLAY_AXIS}"
echo "osdColor#:#${COLOR}"
echo "osdSize#:#$(/system/sdcard/bin/setconf -g s)"
echo "osdPixel#:#${SPACE}"
echo "osdY#:#${POSY}"
echo "osdFixW#:#${FIXEDW}"
echo "osdFonts#:#$(getFonts)"
;;
save_config)
if [ -n "${F_codec+x}" ]; then
video_codec=$(echo "${F_codec}"| sed -e 's/+/ /g')
rewrite_config /system/sdcard/config/rtspserver.conf CODEC "\"$video_codec\""
echo "Server video codec set to $video_codec<br/>"
fi
if [ -n "${F_videoSize+x}" ]; then
video_size=$(echo "${F_videoSize}"| sed -e 's/+/ /g')
rewrite_config /system/sdcard/config/rtspserver.conf RTSPOPTS "\"$video_size\""
echo "Video resolution set to $video_size<br/>"
fi
if [ -n "${F_bitRate+x}" ]; then
brbitrate=$(printf '%b' "${F_bitRate/%/\\x}")
rewrite_config /system/sdcard/config/rtspserver.conf BITRATE "$brbitrate"
echo "Bitrate set to $brbitrate<br/>"
fi
if [ -n "${F_format+x}" ]; then
video_format=$(printf '%b' "${F_format/%/\\x}")
rewrite_config /system/sdcard/config/rtspserver.conf VIDEOFORMAT "$video_format"
echo "Video format set to $video_format (0 = FixedQp, 1 = CBR, 2 = VBR and 3 = SMART)<br/>"
fi
if [ -n "${F_flip+x}" ]; then
video_flip=$(echo "${F_flip}"| sed -e 's/+/ /g')
rewrite_config /system/sdcard/config/rtspserver.conf FLIP "\"$video_flip\""
echo "Server video flip set to $video_flip<br/>"
fi
if [ -n "${F_frmRateNum+x}" ]; then
frmRateNum=$(printf '%b' "${F_frmRateNum/%/\\x}")
if [ "$frmRateNum" != "" ]; then
rewrite_config /system/sdcard/config/rtspserver.conf FRAMERATE_NUM "$frmRateNum"
fi
fi
if [ -n "${F_frmRateDen+x}" ]; then
frmRateDen=$(printf '%b' "${F_frmRateDen/%/\\x}")
if [ "$frmRateDen" != "" ]; then
rewrite_config /system/sdcard/config/rtspserver.conf FRAMERATE_DEN "$frmRateDen"
fi
echo "FrameRate set to $frmRateDen/$frmRateNum <br/>"
/system/sdcard/bin/setconf -k d -v "$frmRateNum,$frmRateDen" 2>/dev/null
fi
if [ -n "${F_videoUser+x}" ]; then
videouser=$(printf '%b' "${F_videoUser//%/\\x}")
rewrite_config /system/sdcard/config/rtspserver.conf USERNAME "$videouser"
fi
if [ -n "${F_videoPassword+x}" ]; then
videopassword=$(printf '%b' "${F_videoPassword//%/\\x}")
rewrite_config /system/sdcard/config/rtspserver.conf USERPASSWORD "$videopassword"
echo "Set user and password for video stream<br />"
fi
if [ -n "${F_multicast+x}" ]; then
multicast_dest=$(printf '%b' "${F_multicast//%/\\x}")
rewrite_config /system/sdcard/config/rtspserver.conf MULTICASTDEST "$multicast_dest"
echo "Set multicast address to ${multicast_dest}<br />"
fi
if [ -n "${F_videoPort+x}" ]; then
videoport=$(echo "${F_videoPort}"| tr '\n')
rewrite_config /system/sdcard/config/rtspserver.conf PORT "$videoport"
echo "Set video port tp ${videoport}"
fi
if [ -n "${F_autoNightMode+x}" ]; then
rewrite_config /system/sdcard/config/autonight.conf autonight_mode $F_autoNightMode
echo "Set autonight to mode ${F_autoNightMode} <br />"
fi
if [ -n "${F_avg+x}" ]; then
ldravg=$(printf '%b' "${F_avg/%/\\x}")
ldravg=$(echo "$ldravg" | sed "s/[^0-9]//g")
echo AVG="$ldravg" > /system/sdcard/config/ldr-average.conf
echo "Average set to $ldravg iterations. <br />"
fi
if [ -n "${F_audioinFormat+x}" ]; then
audioinFormat=$(printf '%b' "${F_audioinFormat/%/\\x}")
if [ "$audioinFormat" == "OPUS" ]; then
audioOutBR="48000"
fi
if [ "$audioinFormat" == "PCM" ]; then
audioOutBR = audioinBR
fi
if [ "$audioinFormat" == "PCMU" ]; then
audioOutBR = audioinBR
fi
rewrite_config /system/sdcard/config/rtspserver.conf AUDIOFORMAT "$audioinFormat"
echo "Audio format $audioinFormat <br/>"
fi
if [ -n "${F_audioinBR+x}" ]; then
audioinBR=$(printf '%b' "${F_audioinBR/%/\\x}")
if [ "$audioinBR" == "" ]; then
audioinBR="8000"
fi
rewrite_config /system/sdcard/config/rtspserver.conf AUDIOINBR "$audioinBR"
echo "In audio bitrate $audioinBR <br/>"
fi
if [ -n "${F_audiooutBR+x}" ]; then
audiooutBR=$(printf '%b' "${F_audiooutBR/%/\\x}")
if [ "$audiooutBR" == "" ]; then
audioOutBR = audioinBR
fi
rewrite_config /system/sdcard/config/rtspserver.conf AUDIOOUTBR "$audiooutBR"
echo "Out audio bitrate $audiooutBR <br/>"
fi
if [ -n "${F_audioinFilter+x}" ]; then
rewrite_config /system/sdcard/config/rtspserver.conf FILTER "$F_audioinFilter"
echo "Filter $F_audioinFilter <br/>"
system/sdcard/bin/setconf -k q -v "$F_audioinFilter" 2>/dev/null
fi
if [ -n "${F_HFEnabled+x}" ]; then
rewrite_config /system/sdcard/config/rtspserver.conf HIGHPASSFILTER "$F_HFEnabled"
echo "High Pass Filter $F_HFEnabled <br/>"
/system/sdcard/bin/setconf -k l -v "$F_HFEnabled" 2>/dev/null
fi
if [ -n "${F_AECEnabled+x}" ]; then
rewrite_config /system/sdcard/config/rtspserver.conf AECFILTER "$F_AECEnabled"
echo "AEC Filter $F_AECEnabled <br/>"
/system/sdcard/bin/setconf -k a -v "$F_AECEnabled" 2>/dev/null
fi
if [ -n "${F_audioinVol+x}" ]; then
rewrite_config /system/sdcard/config/rtspserver.conf HWVOLUME "$F_audioinVol"
rewrite_config /system/sdcard/config/rtspserver.conf SWVOLUME "-1"
echo "Volume $F_audioinVol <br/>"
/system/sdcard/bin/setconf -k h -v "$F_audioinVol" 2>/dev/null
fi
if [ -n "${F_tlinterval+x}" ]; then
tlinterval=$(printf '%b' "${F_tlinterval/%/\\x}")
tlinterval=$(echo "$tlinterval" | sed "s/[^0-9\.]//g")
if [ "$tlinterval" ]; then
rewrite_config /system/sdcard/config/timelapse.conf TIMELAPSE_INTERVAL "$tlinterval"
echo "Timelapse interval set to $tlinterval seconds. <br />"
else
echo "Invalid timelapse interval <br />"
fi
fi
if [ -n "${F_tlduration+x}" ]; then
tlduration=$(printf '%b' "${F_tlduration/%/\\x}")
tlduration=$(echo "$tlduration" | sed "s/[^0-9\.]//g")
if [ "$tlduration" ]; then
rewrite_config /system/sdcard/config/timelapse.conf TIMELAPSE_DURATION "$tlduration"
echo "Timelapse duration set to $tlduration minutes. <br />"
else
echo "Invalid timelapse duration <br />"
fi
fi
if [ -n "${F_osdEnable+x}" ]; then
if [ "${F_osdEnable}" == "true" ]; then
echo "ENABLE_OSD=true" > /system/sdcard/config/osd.conf
update_axis
echo "OSD enabled <br />"
else
echo "ENABLE_OSD=false" > /system/sdcard/config/osd.conf
echo "OSD disabled <br />"
/system/sdcard/bin/setconf -k o -v ""
fi
fi
if [ -n "${F_osdText+x}" ]; then
osdtext=$(printf '%b' "${F_osdText//%/\\x}")
osdtext=$(echo "$osdtext" | sed -e "s/\\+/ /g")
echo "OSD=\"${osdtext}\"" | sed -r 's/[ ]X=.*"/"/' >> /system/sdcard/config/osd.conf
echo "OSD set text ${osdtext}<br />"
fi
if [ -n "${F_osdAxis+x}" ];then
if [ "${F_osdAxis}" == "true" ]; then
echo "DISPLAY_AXIS=true" >> /system/sdcard/config/osd.conf
echo "OSD Display axis enabled<br />"
else
echo "DISPLAY_AXIS=false" >> /system/sdcard/config/osd.conf
echo "OSD Display axis disabled<br />"
fi
fi
if [ -n "${F_osdColor+x}" ]; then
color='white black red green blue cyan yellow purple'
echo "COLOR=${F_osdColor}" >> /system/sdcard/config/osd.conf
/system/sdcard/bin/setconf -k c -v "${F_osdColor}"
echo -n "Set text color to "
echo -n $(echo $color | cut -d ' ' -f $(($F_osdColor + 1)))
echo "<br />"
fi
if [ -n "${F_osdSize+x}" ]; then
echo "SIZE=${F_osdSize}" >> /system/sdcard/config/osd.conf
/system/sdcard/bin/setconf -k s -v "${F_osdSize}"
echo "Set OSD text size to ${F_osdSize}<br />"
fi
if [ -n "${F_osdPixel+x}" ]; then
echo "SPACE=${F_osdPixel}" >> /system/sdcard/config/osd.conf
/system/sdcard/bin/setconf -k p -v "${F_osdPixel}"
echo "Set OSD pixel betwwen chars to ${F_osdPixel}<br />"
fi
if [ -n "${F_osdY+x}" ]; then
echo "POSY=${F_osdY}" >> /system/sdcard/config/osd.conf
system/sdcard/bin/setconf -k x -v "${F_osdY}"
echo "Set OSD Y position to ${F_osdY}<br />"
fi
if [ -n "${F_osdFixW+x}" ]; then
echo "FIXEDW=${F_osdFixW}" >> /system/sdcard/config/osd.conf
/system/sdcard/bin/setconf -k w -v "${F_osdFixW}"
echo "Set OSD fixed width to ${F_osdFixW}<br />"
fi
if [ -n "${F_osdFonts+x}" ]; then
fontName=$(printf '%b' "${F_osdFonts//%/\\x}")
fontName=$(echo "$fontName" | sed -e "s/\\+/ /g")
echo "FONTNAME=${fontName}" >> /system/sdcard/config/osd.conf
/system/sdcard/bin/setconf -k e -v "${fontName}"
echo "Set OSD font to ${fontName}<br />"
fi
if [ "$(/system/sdcard/controlscripts/rtsp status)" != "" ]; then
echo "Restart rtsp server"
/system/sdcard/controlscripts/rtsp stop
/system/sdcard/controlscripts/rtsp start
fi
return
;;
*)
echo "Unsupported command '$F_cmd'"
;;
esac
fi
exit 0

View File

@@ -0,0 +1,85 @@
#!/bin/sh
. /system/sdcard/www/cgi-bin/func.cgi
export LD_LIBRARY_PATH=/system/lib
export LD_LIBRARY_PATH=/thirdlib:$LD_LIBRARY_PATH
echo "Content-type: text/html"
echo "Pragma: no-cache"
echo "Cache-Control: max-age=0, no-store, no-cache"
echo ""
if [ -n "$F_cmd" ]; then
case "$F_cmd" in
get_services)
services="auto-night-detection debug-on-osd ftp_server mqtt-control mqtt-status onvif-srvd recording rtsp sound-on-startup telegram-bot timelapse"
for service in $services ; do
echo "${service}#:#$(test -f /run/${service}.pid && echo 'started' || echo 'stopped')#:#$(test -f /system/sdcard/config/autostart/${service} && echo 'true' || echo 'false')#:#false"
done
return
;;
autoStartService)
if [ $F_service == "auto_night_mode" ]; then
F_service="auto-night-detection"
fi
if $F_action ; then
echo "#!/bin/sh" > "/system/sdcard/config/autostart/${F_service}"
echo "/system/sdcard/controlscripts/${F_service}" >> "/system/sdcard/config/autostart/${F_service}"
else
rm "/system/sdcard/config/autostart/${F_service}"
fi
return
;;
services)
$(/system/sdcard/controlscripts/${F_service} $F_action) > /dev/null
return
;;
getFiles)
ip_addr=$(ip -o -4 addr show | sed 's/.* inet \([^/]*\).*/\1/' | grep -v "127.0.0.1")
for file in $(find /system/sdcard/DCIM/${F_dir}/ -type f)
do
if [[ -f $file ]]; then
file_size=$(ls -lh $file | awk '{print $5}')
file_url=$(ls -lh $file | awk '{print $9}' | sed 's/\/system\/sdcard\/DCIM/\/viewer/')
file_date=$(ls -lh $file | awk '{print $6 "-" $7 "-" $8}')
file_name=$(ls -lh $file | awk '{print $9}' | awk -F / '{print $(NF)}')
echo "${file_name}#:#${file_size}#:#${file_date}#:#${file_url}"
fi
done
return
;;
del_config)
F_file=$(echo ${F_file} | sed -e 's/%2F/\//g' | sed -e 's/viewer/system\/sdcard\/DCIM/')
echo "Remove ${F_file}"
rm $F_file
;;
restore_config)
F_file=$(echo ${F_file} | sed -e 's/%2F/\//g' | sed -e 's/viewer/system\/sdcard\/DCIM/')
tar -xf $F_file -C /system/sdcard/config/
echo "Restore done"
/sbin/reboot
;;
save_config)
/system/sdcard/controlscripts/saveConfig.sh
;;
reboot)
echo "Rebooting device..."
/sbin/reboot
return
;;
shutdown)
echo "Shutting down device.."
/sbin/halt
return
;;
*)
echo "Unsupported command '$F_cmd'"
;;
esac
fi
exit 0

View File

@@ -0,0 +1,80 @@
#!/bin/sh
. /system/sdcard/www/cgi-bin/func.cgi
. /system/sdcard/scripts/common_functions.sh
export LD_LIBRARY_PATH=/system/lib
export LD_LIBRARY_PATH=/thirdlib:$LD_LIBRARY_PATH
echo "Content-type: text/html"
echo "Pragma: no-cache"
echo "Cache-Control: max-age=0, no-store, no-cache"
echo ""
if [ -n "$F_cmd" ]; then
case "$F_cmd" in
get_config)
echo "hostname#:#$(hostname)"
echo "model#:#$(detect_model)"
echo "fwDate#:#$(if [ -s "/system/sdcard/VERSION" ]; then /system/sdcard/bin/jq -r .date /system/sdcard/VERSION; else echo "Never updated. Make an update to get version."; fi)"
echo "fwBranch#:#$(if [ -s "/system/sdcard/VERSION" ]; then /system/sdcard/bin/jq -r .branch /system/sdcard/VERSION; else echo "Never updated. Make an update to get version."; fi)"
echo "fwCommit#:#$(if [ -s "/system/sdcard/VERSION" ]; then echo $(check_commit); else echo "Never updated. Make an update to get version."; fi)"
echo "kernel#:#$(/system/sdcard/bin/busybox uname -v)"
echo "bootLoader#:#$(busybox strings /dev/mtd0 | grep "U-Boot 2")"
echo "localTime#:#$(date)"
echo "uptime#:#$(uptime | sed 's/^.*up *//;s/, *[0-9]* user.*$/m/; s/ day[^0-9]*/d, /;s/ \([hms]\).*m$/\1/;s/:/h, /')"
echo "loadAvg#:#$(uptime | awk -F': ' '{print $2}')"
echo "ssid#:#$(/system/bin/iwgetid -r)"
echo "linkQuality#:#$(cat /proc/net/wireless | awk 'END { print $3 }' | sed 's/\.$//')"
echo "ip#:#$(ifconfig | grep -E "([0-9]{1,3}\.){3}[0-9]{1,3}" | grep -v 127.0.0.1 | awk '{ print $2 }' | cut -f2 -d:)"
echo "mac#:#$(cat /sys/class/net/wlan0/address)"
echo "netmask#:#$(ifconfig wlan0 | sed -rn '2s/ .*:(.*)$/\1/p')"
echo "gateway#:#$(route | awk '/default/ { print $2}')"
echo "dns#:#$(cat /etc/resolv.conf | grep nameserver | cut -d ' ' -f 2)"
echo "bootMD5#:#$(md5sum /dev/mtd0 |cut -f 1 -d " ")"
echo "bootVersion#:#$(busybox strings /dev/mtd0 | grep "U-Boot 2")"
echo "bootCMD#:#$(cat /proc/cmdline)"
return
;;
get_info)
case "$F_info" in
netInt)
ifconfig
iwconfig
;;
netRoutes)
route
;;
netDNS)
cat /etc/resolv.conf
;;
dmesg)
dmesg
;;
logVideo)
cat /tmp/v4l2rtspserver-master.log
;;
logCat)
/system/bin/logcat -d
;;
logUpdate)
cat /system/sdcard/log/update.log
;;
logProcess)
ps
;;
logMounts)
mount
;;
esac
return
;;
*)
echo "Unsupported command '$F_cmd'"
;;
esac
fi
exit 0

View File

@@ -0,0 +1,114 @@
#!/bin/sh
# CGI file for live view
. /system/sdcard/www/cgi-bin/func.cgi
. /system/sdcard/scripts/common_functions.sh
export LD_LIBRARY_PATH=/system/lib
export LD_LIBRARY_PATH=/thirdlib:$LD_LIBRARY_PATH
echo "Content-type: text"
echo "Pragma: no-cache"
echo "Cache-Control: max-age=0, no-store, no-cache"
echo ""
if [ -n "$F_cmd" ]; then
case "$F_cmd" in
status_all)
echo "auto_night_mode:$(auto_night_mode status)"
echo "ir_led:$(ir_led status)"
echo "ir_cut:$(ir_cut status)"
echo "blue_led:$(blue_led status)"
echo "yellow_led:$(yellow_led status)"
echo "motion_detection:$(motion_detection status)"
echo "motion_mail:$(motion_send_mail status)"
echo "motion_telegram:$(motion_send_telegram status)"
echo "motion_led:$(motion_led status)"
echo "motion_snapshot:$(motion_snapshot status)"
echo "motion_mqtt:$(motion_mqtt_publish status)"
echo "motion_mqtt_snapshot:$(motion_snapshot status)"
echo "motion_mqtt_video:$(motion_mqtt_video status)"
;;
show_HWmodel)
detect_model
return
;;
hostname)
echo $(hostname);
;;
motor)
if [ -z "$F_val" ]; then
F_val=100
fi
motor $F_move $F_val
;;
version)
if [ -s "/system/sdcard/VERSION" ]; then
V_BRANCH=$(/system/sdcard/bin/jq -r .branch /system/sdcard/VERSION)
V_COMMIT=$(/system/sdcard/bin/jq -r .commit /system/sdcard/VERSION)
echo "commit <b>${V_COMMIT}</b> from the <b>${V_BRANCH}</b> branch"
else
echo "Need to update to create a version file."
fi
;;
auto_night_mode)
auto_night_mode $F_action
;;
ir_led)
ir_led $F_action
;;
ir_cut)
ir_cut $F_action
;;
blue_led)
blue_led $F_action
;;
yellow_led)
yellow_led $F_action
;;
motion_detection)
motion_detection $F_action
;;
motion_mail)
motion_send_mail $F_action
;;
motion_telegram)
motion_send_telegram $F_action
;;
motion_led)
motion_led $F_action
;;
motion_snapshot)
motion_snapshot $F_action
;;
motion_mqtt)
motion_mqtt_publish $F_action
;;
motion_mqtt_snapshot)
motion_mqtt_snapshot $F_action
;;
motion_mqtt_video)
motion_mqtt_video $F_action
;;
recording)
recording $F_action
;;
flip)
if [ $(/system/sdcard/bin/setconf -g f) == "0" ]; then
/system/sdcard/bin/setconf -k f -v 1
else
/system/sdcard/bin/setconf -k f -v 0
fi
;;
*)
echo "Unsupported command '$F_cmd'"
;;
esac
fi
exit 0

View File

@@ -0,0 +1,247 @@
#!/bin/sh
. /system/sdcard/www/cgi-bin/func.cgi
. /system/sdcard/scripts/common_functions.sh
export LD_LIBRARY_PATH=/system/lib
export LD_LIBRARY_PATH=/thirdlib:$LD_LIBRARY_PATH
echo "Content-type: text"
echo "Pragma: no-cache"
echo "Cache-Control: max-age=0, no-store, no-cache"
echo ""
if [ -n "$F_cmd" ]; then
case "$F_cmd" in
get_config)
if [ ! -f "/system/sdcard/config/motion.conf" ]; then
$(cp /system/sdcard/config/motion.conf.dist /system/sdcard/config/motion.conf)
fi
source /system/sdcard/config/motion.conf
echo "currentRegions#:#${region_of_interest}"
echo "motionSensitivity#:#${motion_sensitivity}"
echo "motionIndicatorColor#:#${motion_indicator_color}"
echo "motionDetection#:#${motion_detection}"
echo "motionTimeout#:#${motion_timeout}"
echo "motionTracking#:#${motion_tracking}"
echo "saveSnapshot#:#${save_snapshot}"
echo "maxSnaphotDays#:#${max_snapshot_days}"
echo "maxVideoDays#:#${max_video_days}"
echo "ftpSnapshot#:#${ftp_snapshot}"
echo "ftpVideo#:#${ftp_video}"
echo "ftpHost#:#${ftp_host}"
echo "ftpPort#:#${ftp_port}"
echo "ftpUsername#:#${ftp_username}"
echo "ftpPassword#:#${ftp_password}"
echo "ftpStillsDir#:#${ftp_stills_dir}"
echo "ftpVideosDir#:#${ftp_videos_dir}"
echo "smbSnapshot#:#${smb_snapshot}"
echo "smbVideo#:#${smb_video}"
echo "smbShare#:#${smb_share}"
echo "smbUsername#:#${smb_username}"
echo "smbPassword#:#${smb_password}"
echo "smbStillsDir#:#${smb_stills_path}"
echo "smbVideosDir#:#${smb_videos_path}"
echo "motionTriggerLed#:#${motion_trigger_led}"
echo "mqttMessage#:#${publish_mqtt_message}"
echo "mqttSnapshot#:#${publish_mqtt_snapshot}"
echo "mqttVideo#:#${publish_mqtt_video}"
echo "sendEmail#:#${send_email}"
echo "sendTelegram#:#${send_telegram}"
echo "telegramAlertType#:#${telegram_alert_type}"
echo "sendMatrix#:#${send_matrix}"
;;
save_config)
if [ -n "${F_motionDetection+x}" ]; then
F_motionDetection=$(printf '%b' "${F_motionDetection//%/\\x}")
rewrite_config /system/sdcard/config/motion.conf motion_detection $F_motionDetection
echo "Motion detection set to $F_motionDetection<br/>"
fi
if [ -n "${F_motionSensitivity+x}" ]; then
F_motionSensitivity=$(printf '%b' "${F_motionSensitivity//%/\\x}")
rewrite_config /system/sdcard/config/motion.conf motion_sensitivity $F_motionSensitivity
echo "Motion sensitivity set to $F_motionSensitivity<br/>"
fi
if [ -n "${F_motionIndicatorColor+x}" ]; then
F_motionIndicatorColor=$(printf '%b' "${F_motionIndicatorColor//%/\\x}")
color='white black red green blue cyan yellow purple'
rewrite_config /system/sdcard/config/motion.conf motion_indicator_color $F_motionIndicatorColor
if [ "$F_motionIndicatorColor" == "-1" ]; then
echo "Motion color indicator is deactivated<br/>"
else
echo -n "Motion color indicator set to "
echo -n $(echo $color | cut -d ' ' -f $(($F_motionIndicatorColor + 1)))
echo "<br />"
fi
fi
if [ -n "${F_motionTracking+x}" ]; then
F_motionTracking=$(printf '%b' "${F_motionTracking//%/\\x}")
rewrite_config /system/sdcard/config/motion.conf motion_tracking $F_motionTracking
echo "Motion tracking set to $F_motionTracking<br/>"
fi
if [ -n "${F_motionTimeout+x}" ]; then
F_motionTimeout=$(printf '%b' "${F_motionTimeout//%/\\x}")
rewrite_config /system/sdcard/config/motion.conf motion_timeout $F_motionTimeout
echo "Motion timeout set to $F_motionTimeout<br/>"
fi
if [ -n "${F_saveSnaphot+x}" ]; then
F_saveSnaphot=$(printf '%b' "${F_saveSnaphot//%/\\x}")
rewrite_config /system/sdcard/config/motion.conf save_snapshot $F_saveSnaphot
echo "Save snapshot set to $F_saveSnaphot<br/>"
fi
if [ -n "${F_maxSnaphotDays+x}" ]; then
F_maxSnaphotDays=$(printf '%b' "${F_maxSnaphotDays//%/\\x}")
rewrite_config /system/sdcard/config/motion.conf max_snapshot_days $F_maxSnaphotDays
echo "Maximun snapshot retention in days set to $F_maxSnaphotDays<br/>"
fi
if [ -n "${F_saveVideo+x}" ]; then
F_saveVideo=$(printf '%b' "${F_saveVideo//%/\\x}")
rewrite_config /system/sdcard/config/motion.conf save_video $F_saveVideo
echo "Save video set to $F_saveVideo<br/>"
fi
if [ -n "${F_maxVideoDays+x}" ]; then
F_maxVideoDays=$(printf '%b' "${F_maxVideoDays//%/\\x}")
rewrite_config /system/sdcard/config/motion.conf max_video_days $F_maxVideoDays
echo "Maximun video retention in days set to $F_maxVideoDays<br/>"
fi
if [ -n "${F_smbSnapshot+x}" ]; then
F_smbSnapshot=$(printf '%b' "${F_smbSnapshot//%/\\x}")
rewrite_config /system/sdcard/config/motion.conf smb_snapshot $F_smbSnapshot
echo "Save snapshot to samba share set to $F_smbSnapshot<br/>"
fi
if [ -n "${F_smbVideo+x}" ]; then
F_smbVideo=$(printf '%b' "${F_smbVideo//%/\\x}")
rewrite_config /system/sdcard/config/motion.conf smb_video $F_smbVideo
echo "Save video to samba share set to $F_smbVideo<br/>"
fi
if [ -n "${F_smbShare+x}" ]; then
F_smbShare=$(printf '%b' "${F_smbShare//%/\\x}" | sed 's/\//\\\//g')
rewrite_config /system/sdcard/config/motion.conf smb_share "\"$F_smbShare\""
echo "Samba share set to $F_smbShare<br/>"
fi
if [ -n "${F_smbUsername+x}" ]; then
F_smbUsername=$(printf '%b' "${F_smbUsername//%/\\x}")
rewrite_config /system/sdcard/config/motion.conf smb_username "\"$F_smbUsername\""
echo "Samba username set to $F_smbUsername<br/>"
fi
if [ -n "${F_smbPassword+x}" ]; then
F_smbPassword=$(printf '%b' "${F_smbPassword//%/\\x}" | sed 's/\//\\\//g')
rewrite_config /system/sdcard/config/motion.conf smb_password "\"$F_smbPassword\""
echo "Samba passward set<br/>"
fi
if [ -n "${F_smbStillsDir+x}" ]; then
F_smbStillsDir=$(printf '%b' "${F_smbStillsDir//%/\\x}" | sed 's/\//\\\//g')
rewrite_config /system/sdcard/config/motion.conf smb_stills_path "\"$F_smbStillsDir\""
echo "Samba snapshot destination directory set to $F_smbStillsDir<br/>"
fi
if [ -n "${F_smbVideosDir+x}" ]; then
F_smbVideosDir=$(printf '%b' "${F_smbVideosDir//%/\\x}" | sed 's/\//\\\//g')
rewrite_config /system/sdcard/config/motion.conf smb_videos_path "\"$F_smbVideosDir\""
echo "Samba video destination directory set to $F_smbVideosDir<br/>"
fi
if [ -n "${F_ftpSnapshot+x}" ]; then
F_ftpSnapshot=$(printf '%b' "${F_ftpSnapshot//%/\\x}")
rewrite_config /system/sdcard/config/motion.conf ftp_snapshot $F_ftpSnapshot
echo "Save snapshot to FTP set to set to $F_ftpSnapshot<br/>"
fi
if [ -n "${F_ftpVideo+x}" ]; then
F_ftpVideo=$(printf '%b' "${F_ftpVideo//%/\\x}")
rewrite_config /system/sdcard/config/motion.conf ftp_video $F_ftpVideo
echo "Save video to FTP set to $F_ftpVideo<br/>"
fi
if [ -n "${F_ftpHost+x}" ]; then
F_ftpHost=$(printf '%b' "${F_ftpHost//%/\\x}")
rewrite_config /system/sdcard/config/motion.conf ftp_host "\"$F_ftpHost\""
echo "FTP Host set to $F_ftpHost<br/>"
fi
if [ -n "${F_ftpPort+x}" ]; then
F_ftpPort=$(printf '%b' "${F_ftpPort//%/\\x}")
rewrite_config /system/sdcard/config/motion.conf ftp_port $F_ftpPort
echo "FTP Port set to $F_ftpPort<br/>"
fi
if [ -n "${F_ftpUsername+x}" ]; then
F_ftpUsername=$(printf '%b' "${F_ftpUsername//%/\\x}")
rewrite_config /system/sdcard/config/motion.conf ftp_username "\"$F_ftpUsername\""
echo "FTP username set to $F_ftpUsername<br/>"
fi
if [ -n "${F_ftpPassword+x}" ]; then
F_ftpPassword=$(printf '%b' "${F_ftpPassword//%/\\x}" | sed 's/\//\\\//g')
rewrite_config /system/sdcard/config/motion.conf ftp_password "\"$F_ftpPassword\""
echo "FTP password set<br/>"
fi
if [ -n "${F_ftpStillsDir+x}" ]; then
F_ftpStillsDir=$(printf '%b' "${F_ftpStillsDir//%/\\x}" | sed 's/\//\\\//g')
rewrite_config /system/sdcard/config/motion.conf ftp_stills_dir "\"$F_ftpStillsDir\""
echo "FTP snapshots directory set to $F_ftpStillsDir<br/>"
fi
if [ -n "${F_ftpVideosDir+x}" ]; then
F_ftpVideosDir=$(printf '%b' "${F_ftpVideosDir//%/\\x}" | sed 's/\//\\\//g')
rewrite_config /system/sdcard/config/motion.conf ftp_videos_dir "\"$F_ftpVideosDir\""
echo "FTP videos directory set to $F_ftpVideosDir<br/>"
fi
if [ -n "${F_motionTriggerLed+x}" ]; then
F_motionTriggerLed=$(printf '%b' "${F_motionTriggerLed//%/\\x}")
rewrite_config /system/sdcard/config/motion.conf motion_trigger_led $F_motionTriggerLed
echo "Motion trigger led set to $F_motionTriggerLed<br/>"
fi
if [ -n "${F_mqttMessage+x}" ]; then
F_mqttMessage=$(printf '%b' "${F_mqttMessage//%/\\x}")
rewrite_config /system/sdcard/config/motion.conf publish_mqtt_message $F_mqttMessage
echo "MQTT publish message on motion set to $F_mqttMessage<br/>"
fi
if [ -n "${F_mqttSnapshot+x}" ]; then
F_mqttSnapshot=$(printf '%b' "${F_mqttSnapshot//%/\\x}")
rewrite_config /system/sdcard/config/motion.conf publish_mqtt_snapshot $F_mqttSnapshot
echo "MQTT publish image on motion set to $F_mqttSnapshot<br/>"
fi
if [ -n "${F_mqttVideo+x}" ]; then
F_mqttVideo=$(printf '%b' "${F_mqttVideo//%/\\x}")
rewrite_config /system/sdcard/config/motion.conf publish_mqtt_video $F_mqttVideo
echo "MQTT publish video on motion set to $F_mqttVideo<br/>"
fi
if [ -n "${F_sendEmail+x}" ]; then
F_sendEmail=$(printf '%b' "${F_sendEmail//%/\\x}")
rewrite_config /system/sdcard/config/motion.conf send_email $F_sendEmail
echo "Send mail on motion set to $F_sendEmail<br/>"
fi
if [ -n "${F_sendTelegram+x}" ]; then
F_sendTelegram=$(printf '%b' "${F_sendTelegram//%/\\x}")
rewrite_config /system/sdcard/config/motion.conf send_telegram $F_sendTelegram
echo "Send Telegram on motion set to $F_sendTelegram<br/>"
fi
if [ -n "${F_telegramAlertType+x}" ]; then
F_telegramAlertType=$(printf '%b' "${F_telegramAlertType//%/\\x}")
rewrite_config /system/sdcard/config/motion.conf telegram_alert_type $F_telegramAlertType
echo "Telegram alert type set to $F_telegramAlertType<br/>"
fi
if [ -n "${F_sendMatrix+x}" ]; then
F_sendMatrix=$(printf '%b' "${F_sendMatrix//%/\\x}")
rewrite_config /system/sdcard/config/motion.conf send_matrix $F_sendMatrix
echo "Send Matrix on motion set to $F_sendMatrix<br/>"
fi
if [ -n "${F_regions+x}" ]; then
F_regions=$(printf '%b' "${F_regions//%/\\x}")
rewrite_config /system/sdcard/config/motion.conf region_of_interest $F_regions
echo "Regions set to $F_regions<br/>"
fi
if [ "$(rtsp_h264_server status)" = "ON" ]; then
echo "Restart H264 rtsp server"
rtsp_h264_server off
rtsp_h264_server on
fi
if [ "$(rtsp_mjpeg_server status)" = "ON" ]; then
echo "Restart MJPEG rtsp server"
rtsp_mjpeg_server off
rtsp_mjpeg_server on
fi
;;
*)
echo "Unsupported command '$F_cmd'"
;;
esac
fi
exit 0

View File

@@ -0,0 +1,219 @@
#!/bin/sh
. /system/sdcard/www/cgi-bin/func.cgi
. /system/sdcard/scripts/common_functions.sh
export LD_LIBRARY_PATH=/system/lib
export LD_LIBRARY_PATH=/thirdlib:$LD_LIBRARY_PATH
echo "Content-type: text/html"
echo "Pragma: no-cache"
echo "Cache-Control: max-age=0, no-store, no-cache"
echo ""
if [ -n "$F_cmd" ]; then
case "$F_cmd" in
get_config_mqtt)
if [ ! -f "/system/sdcard/config/mqtt.conf" ]; then
$(cp /system/sdcard/config/mqtt.conf.dist /system/sdcard/config/mqtt.conf)
fi
source /system/sdcard/config/mqtt.conf
echo "mqttUser#:#${USER}"
echo "mqttPass#:#${PASS}"
echo "mqttHost#:#${HOST}"
echo "mqttPort#:#${PORT}"
echo "mqttLocation#:#${LOCATION}"
echo "mqttDeviceName#:#${DEVICE_NAME}"
echo "mqttAutodiscoveryPrefix#:#${AUTODISCOVERY_PREFIX}"
echo "mqttStatusInterval#:#${STATUSINTERVAL}"
;;
get_config_mail)
if [ ! -f "/system/sdcard/config/sendmail.conf" ]; then
$(cp /system/sdcard/config/sendmail.conf.dist /system/sdcard/config/sendmail.conf)
fi
source /system/sdcard/config/sendmail.conf
echo "from#:#${FROM}"
echo "fromName#:#${FROMNAME}"
echo "auth#:#${AUTH}"
echo "pass#:#${PASS}"
echo "to#:#${TO}"
echo "server#:#${SERVER}"
echo "port#:#${PORT}"
echo "subject#:#${SUBJECT}"
echo "body#:#${BODY}"
echo "numberOfPictures#:#${NUMBEROFPICTURES}"
echo "timeBetweenSnapshot#:#${TIMEBETWEENSNAPSHOT}"
echo "quality#:#${QUALITY}"
;;
get_config_telegram)
if [ ! -f "/system/sdcard/config/telegram.conf" ]; then
$(cp /system/sdcard/config/telegram.conf.dist /system/sdcard/config/telegram.conf)
fi
source /system/sdcard/config/telegram.conf
echo "apiToken#:#${apiToken}"
echo "userChatID#:#${userChatId}"
;;
get_config_matrix)
if [ ! -f "/system/sdcard/config/matrix.conf" ]; then
$(cp /system/sdcard/config/matrix.conf.dist /system/sdcard/config/matrix.conf)
fi
source /system/sdcard/config/matrix.conf
echo "host#:#${host}"
echo "portM#:#${port}"
echo "roomID#:#${room_id}"
echo "sender#:#${sender}"
echo "accessToken#:#${access_token}"
;;
save_config_mqtt)
echo "Save mqtt"
if [ -n "${F_mqttUser+x}" ]; then
F_mqttUser=$(printf '%b' "${F_mqttUser//%/\\x}")
rewrite_config /system/sdcard/config/mqtt.conf USER $F_mqttUser
echo "MQTT user set to $F_mqttUser<br/>"
fi
if [ -n "${F_mqttPass+x}" ]; then
F_mqttPass=$(printf '%b' "${F_mqttPass//%/\\x}")
rewrite_config /system/sdcard/config/mqtt.conf PASS $F_mqttPass
echo "MQTT password set<br/>"
fi
if [ -n "${F_mqttHost+x}" ]; then
F_mqttHost=$(printf '%b' "${F_mqttHost//%/\\x}")
rewrite_config /system/sdcard/config/mqtt.conf HOST $F_mqttHost
echo "MQTT host set to $F_mqttHost<br/>"
fi
if [ -n "${F_mqttPort+x}" ]; then
F_mqttPort=$(printf '%b' "${F_mqttPort//%/\\x}")
rewrite_config /system/sdcard/config/mqtt.conf PORT $F_mqttPort
echo "MQTT port set to $F_mqttPort<br/>"
fi
if [ -n "${F_mqttLocation+x}" ]; then
F_mqttLocation=$(printf '%b' "${F_mqttLocation//%/\\x}")
rewrite_config /system/sdcard/config/mqtt.conf LOCATION "\"$F_mqttLocation\""
echo "MQTT location set to $F_mqttLocation<br/>"
fi
if [ -n "${F_mqttDeviceName+x}" ]; then
F_mqttDeviceName=$(printf '%b' "${F_mqttDeviceName//%/\\x}")
rewrite_config /system/sdcard/config/mqtt.conf DEVICE_NAME "\"$F_mqttDeviceName\""
echo "MQTT device name set to $F_mqttDeviceName<br/>"
fi
if [ -n "${F_mqttAutodiscoveryPrefix+x}" ]; then
F_mqttAutodiscoveryPrefix=$(printf '%b' "${F_mqttAutodiscoveryPrefix//%/\\x}")
rewrite_config /system/sdcard/config/mqtt.conf AUTODISCOVERY_PREFIX "\"$F_mqttAutodiscoveryPrefix\""
echo "MQTT autodiscovery topic set to $F_mqttAutodiscoveryPrefix<br/>"
fi
if [ -n "${F_mqttStatusInterval+x}" ]; then
F_mqttStatusInterval=$(printf '%b' "${F_mqttStatusInterval//%/\\x}")
rewrite_config /system/sdcard/config/mqtt.conf STATUSINTERVAL $F_mqttStatusInterval
echo "MQTT status interval set to $F_mqttStatusInterval<br/>"
fi
;;
save_config_mail)
if [ -n "${F_from+x}" ]; then
F_from=$(printf '%b' "${F_from//%/\\x}")
rewrite_config /system/sdcard/config/sendmail.conf FROM "\"$F_from\""
echo "Sendmail from address set to $F_from<br/>"
fi
if [ -n "${F_fromName+x}" ]; then
F_fromName=$(printf '%b' "${F_fromName//%/\\x}")
rewrite_config /system/sdcard/config/sendmail.conf FROMNAME "\"$F_fromName\""
echo "Sendmail from name set to $F_fromName<br/>"
fi
if [ -n "${F_auth+x}" ]; then
F_auth=$(printf '%b' "${F_auth//%/\\x}")
rewrite_config /system/sdcard/config/sendmail.conf AUTH "\"$F_auth\""
echo "Sendmail auth user set to $F_auth<br/>"
fi
if [ -n "${F_pass+x}" ]; then
F_pass=$(printf '%b' "${F_pass//%/\\x}")
rewrite_config /system/sdcard/config/sendmail.conf PASS "\"$F_pass\""
echo "Sendmail set password<br/>"
fi
if [ -n "${F_to+x}" ]; then
F_to=$(printf '%b' "${F_to//%/\\x}")
rewrite_config /system/sdcard/config/sendmail.conf TO "\"$F_to\""
echo "Sendmail destination address set to $F_to<br/>"
fi
if [ -n "${F_server+x}" ]; then
F_server=$(printf '%b' "${F_server//%/\\x}")
rewrite_config /system/sdcard/config/sendmail.conf SERVER $F_server
echo "Sendmail server hostname set to $F_server<br/>"
fi
if [ -n "${F_port+x}" ]; then
F_port=$(printf '%b' "${F_port//%/\\x}")
rewrite_config /system/sdcard/config/sendmail.conf PORT $F_port
echo "Sendmail server port set to $F_port<br/>"
fi
if [ -n "${F_subject+x}" ]; then
F_subject=$(printf '%b' "${F_subject//%/\\x}")
rewrite_config /system/sdcard/config/sendmail.conf SUBJECT "\"$F_subject\""
echo "Sendmail subject set to $F_subject<br/>"
fi
if [ -n "${F_body+x}" ]; then
F_body=$(printf '%b' "${F_body//%/\\x}")
rewrite_config /system/sdcard/config/sendmail.conf BODY "\"$F_body\""
echo "Sendmail body set to $F_body<br/>"
fi
if [ -n "${F_numberOfPictures+x}" ]; then
F_numberOfPictures=$(printf '%b' "${F_numberOfPictures//%/\\x}")
rewrite_config /system/sdcard/config/sendmail.conf NUMBEROFPICTURES $F_numberOfPictures
echo "Sendmail number of pictures set to $F_numberOfPictures<br/>"
fi
if [ -n "${F_timeBetweenSnapshot+x}" ]; then
F_timeBetweenSnapshot=$(printf '%b' "${F_timeBetweenSnapshot//%/\\x}")
rewrite_config /system/sdcard/config/sendmail.conf TIMEBETWEENSNAPSHOT $F_timeBetweenSnapshot
echo "Sendmail time betweend snapshot set to $F_timeBetweenSnapshot<br/>"
fi
if [ -n "${F_quality+x}" ]; then
F_quality=$(printf '%b' "${F_quality//%/\\x}")
rewrite_config /system/sdcard/config/sendmail.conf QUALITY $F_quality
echo "Sendmail quality of pictures set to $F_quality<br/>"
fi
;;
save_config_telegram)
if [ -n "${F_apiToken+x}" ]; then
F_apiToken=$(printf '%b' "${F_apiToken//%/\\x}")
rewrite_config /system/sdcard/config/telegram.conf apiToken "\"$F_apiToken\""
echo "Telegram api token set to $F_apiToken<br/>"
fi
if [ -n "${F_userChatID+x}" ]; then
F_userChatID=$(printf '%b' "${F_userChatID//%/\\x}")
rewrite_config /system/sdcard/config/telegram.conf userChatId "\"$F_userChatID\""
echo "Matrix server host set to $F_userChatID<br/>"
fi
;;
save_config_matrix)
if [ -n "${F_host+x}" ]; then
F_host=$(printf '%b' "${F_host//%/\\x}")
rewrite_config /system/sdcard/config/matrix.conf host $F_host
echo "Matrix server host set to $F_host<br/>"
fi
if [ -n "${F_portM+x}" ]; then
F_portM=$(printf '%b' "${F_portM//%/\\x}")
rewrite_config /system/sdcard/config/matrix.conf port $F_portM
echo "Matrix server port set to $F_portM<br/>"
fi
if [ -n "${F_roomID+x}" ]; then
F_roomID=$(printf '%b' "${F_roomID//%/\\x}")
rewrite_config /system/sdcard/config/matrix.conf room_id $F_roomID
echo "Matrix room ID set to $F_roomID<br/>"
fi
if [ -n "${F_sender+x}" ]; then
F_sender=$(printf '%b' "${F_sender//%/\\x}")
rewrite_config /system/sdcard/config/matrix.conf sender $F_sender
echo "Matrix server sender set to $F_sender<br/>"
fi
if [ -n "${F_accessToken+x}" ]; then
F_accessToken=$(printf '%b' "${F_accessToken//%/\\x}")
rewrite_config /system/sdcard/config/matrix.conf access_token $F_accessToken
echo "Matrix server access token set<br/>"
fi
;;
*)
echo "Unsupported command '$F_cmd'"
;;
esac
fi
exit 0

View File

@@ -0,0 +1,57 @@
#!/bin/sh
source ./func.cgi
source /system/sdcard/scripts/common_functions.sh
echo "Content-type: text"
echo "Pragma: no-cache"
echo "Cache-Control: max-age=0, no-store, no-cache"
echo ""
if [ -n "$F_cmd" ]; then
case "$F_cmd" in
events)
echo "["
find /system/sdcard/DCIM/${F_dir}/ -type f | xargs ls --full-time \
| awk '{sub(/\/system\/sdcard\/DCIM/, "viewer"); printf "{\"file\" : \"%s\", \"date\" : \"%s %s\"},", $9, $6, $7}' \
| head -c -1
echo "]"
;;
check_sdcard)
mount|grep "/system/sdcard"|grep "rw,">/dev/null
if [ $? == 1 ]; then
echo -n "nok"
else
echo -n "ok"
fi
;;
getFiles)
ip_addr=$(ip -o -4 addr show | sed 's/.* inet \([^/]*\).*/\1/' | grep -v "127.0.0.1")
for file in $(find /system/sdcard/DCIM/${F_dir}/ -type f)
do
if [[ -f $file ]]; then
file_size=$(ls -lh $file | awk '{print $5}')
file_url=$(ls -lh $file | awk '{print $9}' | sed 's/\/system\/sdcard\/DCIM/\/viewer/')
file_date=$(ls -lh $file | awk '{print $6 "-" $7 "-" $8}')
file_name=$(ls -lh $file | awk '{print $9}' | awk -F / '{print $(NF)}')
echo "${file_name}#:#${file_size}#:#${file_date}#:#${file_url}"
fi
done
return
;;
sdcardInfo)
echo "sdcardSize#:#$(df -h /system/sdcard | awk 'NR==2{print$4}')"
echo "sdcardUsed#:#$(df -h /system/sdcard | awk 'NR==2{print$3}')"
echo "sdcardUsedPercent#:#$(df -h /system/sdcard | awk 'NR==2{print$5}')"
;;
del_file)
F_file=$(echo ${F_file} | sed -e 's/%2F/\//g' | sed -e 's/viewer/system\/sdcard\/DCIM/')
echo "Remove ${F_file}"
rm $F_file
;;
*)
echo "Unsupported command '$F_cmd'"
;;
esac
fi

View File

@@ -0,0 +1,67 @@
#!/bin/sh
. /system/sdcard/www/cgi-bin/func.cgi
. /system/sdcard/scripts/common_functions.sh
export LD_LIBRARY_PATH=/system/lib
export LD_LIBRARY_PATH=/thirdlib:$LD_LIBRARY_PATH
echo "Content-type: text/html"
echo "Pragma: no-cache"
echo "Cache-Control: max-age=0, no-store, no-cache"
echo ""
if [ -n "$F_cmd" ]; then
case "$F_cmd" in
get_config)
echo "hostname#:#$(hostname)"
echo "theme#:#"
echo "ntp#:#$(cat /system/sdcard/config/ntp_srv.conf)"
echo "timezone#:#$(/system/sdcard/bin/busybox awk -F '\t' -v tzn="$(cat /system/sdcard/config/timezone.conf)" '{print "<option value=\""$1"\""; if ($1==tzn) print "selected"; print ">" $1 "</option>"}' /system/sdcard/www/json/timezones.tsv | tr -d '\n')"
echo "currenttime#:#Current time is $(date) - $(cat /etc/TZ)"
;;
save_config)
if [ -n ${F_hostname} ]; then
hst=$(printf '%b' "${F_hostname//%/\\x}")
if [ "$(cat /system/sdcard/config/hostname.conf)" != "$hst" ]; then
echo -n "<p>Setting hostname to '$hst' "
echo "$hst" > /system/sdcard/config/hostname.conf
if hostname "$hst"; then
echo "Success</p>"
else
echo "Failed</p>"
fi
fi
fi
if [ -n ${F_password} ]; then
password=$(printf '%b' "${F_password//%/\\x}")
echo "<p>Setting http password to : $password</p>"
http_password "$password"
fi
if [ -n ${F_timezone} ]; then
timezone_name=$(printf '%b' "${F_timezone//%/\\x}")
if [ "$(cat /system/sdcard/config/timezone.conf)" != "$timezone_name" ]; then
echo "<p>Setting time zone to '$timezone_name'</p>"
echo "$timezone_name" > /system/sdcard/config/timezone.conf
# Set system timezone from timezone name
set_timezone
fi
fi
if [ -n ${F_ntp} ]; then
ntp=$(printf '%b' "${F_ntp//%/\\x}")
if [ $ntp != $(cat /system/sdcard/config/ntp_srv.conf) ]; then
echo "<p>Setting NTP Server to ${ntp} "
echo "$ntp" > /system/sdcard/config/ntp_srv.conf
fi
fi
return
;;
*)
echo "Unsupported command '$F_cmd'"
;;
esac
fi
exit 0

View File

@@ -1,13 +0,0 @@
#!/bin/sh
echo "Content-type: text/html"
echo "Pragma: no-cache"
echo "Cache-Control: max-age=0, no-store, no-cache"
echo ""
cat << EOF
Update:
<pre>`/system/sdcard/autoupdate.sh -v -f -d /system/sdcard/ 2>&1`</pre>
</body>
</html>
EOF

View File

@@ -1,287 +0,0 @@
<!-- Use http://odyniec.net/projects/imgareaselect/ -->
<h1 class="is-size-4">Configure Motion Settings</h1>
<p>
Select motion detection region. Changing the region will restart the rtsp server.
</p>
<div id="motion_img_container" style="margin: 1em 0; position:relative;">
<img id="motion_picture" src="cgi-bin/currentpic.cgi" />
<span id="region_disabled" class="has-text-danger is-size-1" style="display: none; position: absolute; top: 10%; left: 30%; padding: 0.25em 0.5em; background-color: rgba(20, 20, 20, 0.5); border-radius: 0.25em;">
Region disabled
</span>
</div>
<div class="column is-two-thirds">
<form id="confMotionForm" action="cgi-bin/action.cgi?cmd=set_region_of_interest" method="post">
<input id="x0" name="x0" type="hidden" />
<input id="y0" name="y0" type="hidden" />
<input id="x1" name="x1" type="hidden" />
<input id="y1" name="y1" type="hidden" />
<input id="restart_server" name="restart_server" type="hidden" />
<div class="field">
<label class="label">Region Boundaries</label>
<div class="control">
<span id="region_xy"></span>
</div>
</div>
<div class="field">
<div class="control">
<label class="checkbox">
<input type="checkbox" name="motion_detection" id="motion_detection"> Enable motion detection
</label>
</div>
</div>
<div class="field">
<label class="label">Set sensitivity</label>
<div class="control">
<div class="select">
<select name="motion_sensitivity" id="motion_sensitivity">
<option value="0">Very Low</option>
<option value="1">Low</option>
<option value="2">Moderate</option>
<option value="3">High</option>
<option value="4">Very High</option>
</select>
</div>
</div>
</div>
<div class="field">
<label class="label">Display motion indicator if motion is detected</label>
<div class="control">
<div class="select">
<select name="motion_indicator_color" id="motion_indicator_color">
<option value="-1">Deactivated</option>
<option value="0">White</option>
<option value="1">Black</option>
<option value="2">Red</option>
<option value="3">Green</option>
<option value="4">Blue</option>
<option value="5">Cyan</option>
<option value="6">Yellow</option>
<option value="7">Purple</option>
</select>
</div>
</div>
</div>
<div class="field">
<div class="control">
<label class="checkbox">
<input type="checkbox" name="motion_tracking" id="motion_tracking" onchange="setTracking(this, false)"> Enable motion tracking (Custom set motion detection region will be ignored)
</label>
</div>
</div>
<div class="field">
<label class="label">Motion Timeout</label>
<div class="control">
<input class="input" id="motion_timeout" name="motion_timeout" type="number" size="6">
</div>
<p class="help">Restore camera position after x seconds, -1 to deactivate</p>
</div>
<div class="field">
<div class="control">
<input id="configMotionSubmit" class="button is-primary" type="submit" value="Configure motion" />
</div>
</div>
</form>
</div>
<script type="text/javascript">
var originalMotionInfo;
function preview(img, selection) {
if (!selection.width || !selection.height) {
return;
}
var image = $(img);
var naturalWidth = image.prop('naturalWidth');
var naturalHeight = image.prop('naturalHeight');
var renderedWidth = image.width();
var renderedHeight = image.height();
var x0 = Math.round((selection.x1 / renderedWidth) * naturalWidth);
var y0 = Math.round((selection.y1 / renderedHeight) * naturalHeight);
var x1 = Math.round((selection.x2 / renderedWidth) * naturalWidth);
var y1 = Math.round((selection.y2 / renderedHeight) * naturalHeight);
$('#x0').val(x0);
$('#y0').val(y0);
$('#x1').val(x1);
$('#y1').val(y1);
$('#region_xy').html('[ (' + x0 + ', ' + y0 + '), (' + x1 + ', ' + y1 + ') ]');
if (originalMotionInfo.region_of_interest[0] != x0 ||
originalMotionInfo.region_of_interest[1] != y0 ||
originalMotionInfo.region_of_interest[2] != x1 ||
originalMotionInfo.region_of_interest[3] != y1) {
// restart only if region has changed
$('#restart_server').val(1);
} else {
// user has set it back to original region
$('#restart_server').val(0);
}
}
function setTracking(obj, init) {
var picture = $('#motion_picture');
var region_disabled = $('#region_disabled');
var motion_timeout = $('#motion_timeout');
var ias = picture.imgAreaSelect({
instance: true
});
if ($(obj).prop("checked")) {
ias.setOptions({
hide: true
});
picture.css('opacity', 0.5);
region_disabled.show();
motion_timeout.prop('readonly', false);
motion_timeout.css('backgroundColor', '#fff');
} else {
ias.setOptions({
show: true
});
picture.css('opacity', 1);
region_disabled.hide();
// grey out and disable field
motion_timeout.prop('readonly', true);
motion_timeout.css('backgroundColor', '#ccc');
}
ias.update();
if (init == false) {
$('#restart_server').val(1);
}
}
$(document).ready(function () {
// get motion config info
$.ajax({
'url': 'cgi-bin/getMotionInfo.cgi',
'dataType': 'json'
}).done(function (motionInfo) {
originalMotionInfo = motionInfo;
var picture = $('#motion_picture');
var renderedWidth = picture.width();
var renderedHeight = picture.height();
var naturalWidth = picture.prop('naturalWidth');
var naturalHeight = picture.prop('naturalHeight');
picture.imgAreaSelect({
handles: true,
fadeSpeed: 200,
onSelectChange: preview,
movable: true,
persistent: true,
parent: '#motion_img_container'
});
var ias = picture.imgAreaSelect({
instance: true
});
var selection = [0, 0, 0, 0];
if (motionInfo.region_of_interest[0] + motionInfo.region_of_interest[1] +
motionInfo.region_of_interest[2] + motionInfo.region_of_interest[3] == 0 ||
(motionInfo.region_of_interest[0] > naturalWidth ||
motionInfo.region_of_interest[1] > naturalHeight ||
motionInfo.region_of_interest[2] > naturalWidth ||
motionInfo.region_of_interest[3] > naturalHeight)
) {
// if no region of interest set (0, 0, 0, 0)
// or if region of interest set is greater than the current image sizes
ias.setSelection(0, 0, naturalWidth, naturalHeight, true);
topLeft = [0, 0];
selection = [0, 0, naturalWidth, naturalHeight];
if (naturalWidth > renderedWidth) {
// scaled image
selection[2] = renderedWidth;
selection[3] = renderedHeight;
}
} else {
selection = motionInfo.region_of_interest;
if (naturalWidth > renderedWidth) {
// scaled image
selection = [
Math.round((motionInfo.region_of_interest[0] / naturalWidth) * renderedWidth),
Math.round((motionInfo.region_of_interest[1] / naturalHeight) * renderedHeight),
Math.round((motionInfo.region_of_interest[2] / naturalWidth) * renderedWidth),
Math.round((motionInfo.region_of_interest[3] / naturalHeight) * renderedHeight),
];
}
}
ias.setSelection(selection[0], selection[1], selection[2], selection[3], false);
$('#region_xy').html(
'[ (' + motionInfo.region_of_interest[0] + ', ' + motionInfo.region_of_interest[1] +
'), (' + motionInfo.region_of_interest[2] + ', ' + motionInfo.region_of_interest[3] + ') ]');
$('#x0').val(motionInfo.region_of_interest[0]);
$('#y0').val(motionInfo.region_of_interest[1]);
$('#x1').val(motionInfo.region_of_interest[2]);
$('#y1').val(motionInfo.region_of_interest[3]);
$('#restart_server').val(0);
$('#motion_indicator_color').val(motionInfo.motion_indicator_color).change();
$('#motion_sensitivity').val(motionInfo.motion_sensitivity).change();
$('#motion_detection').prop('checked', motionInfo.motion_detection);
$('#motion_tracking').prop('checked', motionInfo.motion_tracking);
$('#motion_timeout').val(motionInfo.motion_timeout).change();
setTracking($('#motion_tracking')[0], true);
});
$('#confMotionForm').submit(function (event) {
var b = $('#configMotionSubmit');
b.toggleClass('is-loading');
b.prop('disabled', !b.prop('disabled'));
var motion_tracking = '';
if ($('#motion_tracking').prop('checked')) {
motion_tracking = 'true';
}
var motion_detection = '';
if ($('#motion_detection').prop('checked')) {
motion_detection = 'true';
} else {
motion_detection = 'false';
}
var formData = {
'x0': $('input[name=x0]').val(),
'y0': $('input[name=y0]').val(),
'x1': $('input[name=x1]').val(),
'y1': $('input[name=y1]').val(),
'restart_server': $('input[name=restart_server]').val(),
'motion_sensitivity': $('select[name=motion_sensitivity]').val(),
'motion_indicator_color': $('select[name=motion_indicator_color]').val(),
'motion_tracking': motion_tracking,
'motion_detection': motion_detection,
'motion_timeout': $('input[name=motion_timeout]').val()
};
$.ajax({
type: 'POST',
url: $('#confMotionForm').attr('action'),
data: formData,
dataType: 'html',
encode: true
}).done(function (res) {
b.toggleClass('is-loading');
b.prop('disabled', !b.prop('disabled'));
showResult(res);
});
event.preventDefault();
});
});
</script>

View File

@@ -0,0 +1,75 @@
<!-- Control card -->
<div class="w3-panel w3-card">
<h1> Control System</h1>
<div class="w3-row">
<a href="javascript:void(0)" onclick="openTab(event, 'services');">
<div class="w3-quarter tablink w3-bottombar w3-hover-light-grey w3-padding w3-border-theme">Services</div>
</a>
<a href="javascript:void(0)" onclick="openTab(event, 'update');showupdatepage();">
<div class="w3-quarter tablink w3-bottombar w3-hover-light-grey w3-padding">Update</div>
</a>
<a href="javascript:void(0)" onclick="openTab(event, 'config');getFiles('config');">
<div class="w3-quarter tablink w3-bottombar w3-hover-light-grey w3-padding">Backup/Restore config</div>
</a>
<a href="javascript:void(0)" onclick="openTab(event, 'power');">
<div class="w3-quarter tablink w3-bottombar w3-hover-light-grey w3-padding">Power</div>
</a>
</div>
<!-- Services Tab-->
<div id="services" class="w3-container tab">
<p></p>
<table class="w3-table-all" id="tabServices">
<thead>
<tr class="w3-theme">
<th>Service Name</th>
<th>Control</th>
<th>Autostart</th>
</tr>
</thead>
<tbody></tbody>
</table>
<p></p>
</div>
<!-- Update Tab-->
<div id="update" class="w3-container tab" style="display:none">
<h2 id='updatemsg'>Seaching for updates ...</h2>
</div>
<!-- Backup/Restore Tab-->
<div id="config" class="w3-container tab" style="display:none">
<p id=><i class="fa fa-spinner w3-spin" style="font-size:64px"></i><br/>LOADING</p>
</div>
<!-- Power control Tab-->
<div id="power" class="w3-container tab" style="display:none">
<p></p>
<div class="w3-row-padding">
<div class="w3-half">
<button class="w3-btn w3-block w3-theme" type="text" onclick="system('reboot');">Reboot</button>
</div>
<div class="w3-half">
<button class="w3-btn w3-block w3-theme" type="text" onclick="system('shutdown');">Shutdown</button>
</div>
</div>
<p></p>
</div>
<!-- modal windows-->
<div id="modal_box" class="w3-modal">
<div class="w3-modal-content">
<header class="w3-container w3-theme">
<span onclick="document.getElementById('modal_box').style.display='none'"
class="w3-button w3-display-topright">&times;</span>
<h2 id="modal_title"></h2>
</header>
<div class="w3-container">
<p id="modal_content">Waiting ...</p>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="js/control.js"></script>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 219 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 219 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 B

File diff suppressed because one or more lines are too long

View File

@@ -1 +0,0 @@
@-webkit-keyframes spinAround{from{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes spinAround{from{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.quickview{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;background-color:#fff;max-width:calc(100% - 50px);position:fixed;top:0;bottom:0;z-index:35;-webkit-transform:translateZ(0);transform:translateZ(0);-webkit-transition:.3s ease;transition:.3s ease;-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-perspective:1000;perspective:1000;will-change:transform}.quickview.is-marginless{max-width:100%}@media screen and (max-width:768px){.quickview{width:100%;right:-100%}}@media screen and (min-width:769px),print{.quickview{width:50%;right:-50%}}@media screen and (min-width:1024px){.quickview{width:35%;right:-35%}}@media screen and (min-width:1216px){.quickview{width:30%;right:-30%}}@media screen and (min-width:1408px){.quickview{width:25%;right:-25%}}@media screen and (max-width:768px){.quickview.is-left{left:-100%}}@media screen and (min-width:769px),print{.quickview.is-left{left:-50%}}@media screen and (min-width:1024px){.quickview.is-left{left:-35%}}@media screen and (min-width:1216px){.quickview.is-left{left:-30%}}@media screen and (min-width:1408px){.quickview.is-left{left:-25%}}.quickview.is-active{right:0;-webkit-box-shadow:5px 0 13px 3px rgba(0,0,0,.1);box-shadow:5px 0 13px 3px rgba(0,0,0,.1)}.quickview.is-active.is-left{left:0}.quickview-header{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:0 1rem;min-height:3.25em!important;border-bottom:1px solid #dbdbdb}.quickview-header.is-white{background-color:#fff}.quickview-header.is-white .title{color:#0a0a0a}.quickview-header.is-black{background-color:#0a0a0a}.quickview-header.is-black .title{color:#fff}.quickview-header.is-light{background-color:#f5f5f5}.quickview-header.is-light .title{color:#363636}.quickview-header.is-dark{background-color:#363636}.quickview-header.is-dark .title{color:#f5f5f5}.quickview-header.is-primary{background-color:#00d1b2}.quickview-header.is-primary .title{color:#fff}.quickview-header.is-link{background-color:#3273dc}.quickview-header.is-link .title{color:#fff}.quickview-header.is-info{background-color:#209cee}.quickview-header.is-info .title{color:#fff}.quickview-header.is-success{background-color:#23d160}.quickview-header.is-success .title{color:#fff}.quickview-header.is-warning{background-color:#ffdd57}.quickview-header.is-warning .title{color:rgba(0,0,0,.7)}.quickview-header.is-danger{background-color:#ff3860}.quickview-header.is-danger .title{color:#fff}.quickview-header .title{font-size:1rem;font-weight:300;margin-bottom:0}.quickview-header .title img{max-height:2em}.quickview-body{-webkit-box-flex:1;-ms-flex:1 1 0%;flex:1 1 0%;overflow-y:auto}.quickview-footer{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:0 1rem;min-height:4rem;background-color:#f5f5f5;border-top:1px solid #dbdbdb}.quickview-footer>*{margin:0 .4rem}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

0
firmware_mod/www/css/sw_night.css Normal file → Executable file
View File

View File

@@ -0,0 +1,22 @@
.w3-theme-l5 {color:#000 !important; background-color:#f0f0f0 !important}
.w3-theme-l4 {color:#000 !important; background-color:#cccccc !important}
.w3-theme-l3 {color:#fff !important; background-color:#999999 !important}
.w3-theme-l2 {color:#fff !important; background-color:#666666 !important}
.w3-theme-l1 {color:#fff !important; background-color:#333333 !important}
.w3-theme-d1 {color:#fff !important; background-color:#000000 !important}
.w3-theme-d2 {color:#fff !important; background-color:#000000 !important}
.w3-theme-d3 {color:#fff !important; background-color:#000000 !important}
.w3-theme-d4 {color:#fff !important; background-color:#000000 !important}
.w3-theme-d5 {color:#fff !important; background-color:#000000 !important}
.w3-theme-light {color:#000 !important; background-color:#f0f0f0 !important}
.w3-theme-dark {color:#fff !important; background-color:#000000 !important}
.w3-theme-action {color:#fff !important; background-color:#000000 !important}
.w3-theme {color:#fff !important; background-color:#000000 !important}
.w3-text-theme {color:#000000 !important}
.w3-border-theme {border-color:#000000 !important}
.w3-hover-theme:hover {color:#fff !important; background-color:#000000 !important}
.w3-hover-text-theme:hover {color:#000000 !important}
.w3-hover-border-theme:hover {border-color:#000000 !important}

View File

@@ -0,0 +1,29 @@
body { background-color: #121212; color:white}
.w3-container{ background-color: #444444;}
.w3-table-all { color: black;}
.w3-sidebar {background-color: #444444;}
.panel {color: black;}
#cam-control, #btn-ptz-left, #btn-ptz-right, #btn-ptz-up, #btn-ptz-down, #btn-ptz-calibrate { background-color: transparent;}
.w3-theme-l5 {color:#000 !important; background-color:#f6f6f6 !important}
.w3-theme-l4 {color:#000 !important; background-color:#dfdfdf !important}
.w3-theme-l3 {color:#000 !important; background-color:#c0c0c0 !important}
.w3-theme-l2 {color:#fff !important; background-color:#a0a0a0 !important}
.w3-theme-l1 {color:#fff !important; background-color:#818181 !important}
.w3-theme-d1 {color:#fff !important; background-color:#575757 !important}
.w3-theme-d2 {color:#fff !important; background-color:#4e4e4e !important}
.w3-theme-d3 {color:#fff !important; background-color:#444444 !important}
.w3-theme-d4 {color:#fff !important; background-color:#3a3a3a !important}
.w3-theme-d5 {color:#fff !important; background-color:#303030 !important}
.w3-theme-light {color:#000 !important; background-color:#f6f6f6 !important}
.w3-theme-dark {color:#fff !important; background-color:#303030 !important}
.w3-theme-action {color:#fff !important; background-color:#303030 !important}
.w3-theme {color:#fff !important; background-color:#616161 !important}
.w3-text-theme {color:#616161 !important}
.w3-border-theme {border-color:#616161 !important}
.w3-hover-theme:hover {color:#fff !important; background-color:#616161 !important}
.w3-hover-text-theme:hover {color:#616161 !important}
.w3-hover-border-theme:hover {border-color:#616161 !important}

View File

@@ -0,0 +1,22 @@
.w3-theme-l5 {color:#000 !important; background-color:#f9f9f9 !important}
.w3-theme-l4 {color:#000 !important; background-color:#ececec !important}
.w3-theme-l3 {color:#000 !important; background-color:#d8d8d8 !important}
.w3-theme-l2 {color:#000 !important; background-color:#c5c5c5 !important}
.w3-theme-l1 {color:#000 !important; background-color:#b1b1b1 !important}
.w3-theme-d1 {color:#fff !important; background-color:#8e8e8e !important}
.w3-theme-d2 {color:#fff !important; background-color:#7e7e7e !important}
.w3-theme-d3 {color:#fff !important; background-color:#6f6f6f !important}
.w3-theme-d4 {color:#fff !important; background-color:#5f5f5f !important}
.w3-theme-d5 {color:#fff !important; background-color:#4f4f4f !important}
.w3-theme-light {color:#000 !important; background-color:#f9f9f9 !important}
.w3-theme-dark {color:#fff !important; background-color:#4f4f4f !important}
.w3-theme-action {color:#fff !important; background-color:#4f4f4f !important}
.w3-theme {color:#fff !important; background-color:#9e9e9e !important}
.w3-text-theme {color:#9e9e9e !important}
.w3-border-theme {border-color:#9e9e9e !important}
.w3-hover-theme:hover {color:#fff !important; background-color:#9e9e9e !important}
.w3-hover-text-theme:hover {color:#9e9e9e !important}
.w3-hover-border-theme:hover {border-color:#9e9e9e !important}

View File

@@ -0,0 +1,23 @@
.w3-theme-l5 {color:#000 !important; background-color:#f3f4fb !important}
.w3-theme-l4 {color:#000 !important; background-color:#d8dcf1 !important}
.w3-theme-l3 {color:#000 !important; background-color:#b1b8e3 !important}
.w3-theme-l2 {color:#fff !important; background-color:#8995d6 !important}
.w3-theme-l1 {color:#fff !important; background-color:#6271c8 !important}
.w3-theme-d1 {color:#fff !important; background-color:#3949a3 !important}
.w3-theme-d2 {color:#fff !important; background-color:#334191 !important}
.w3-theme-d3 {color:#fff !important; background-color:#2d397f !important}
.w3-theme-d4 {color:#fff !important; background-color:#26316d !important}
.w3-theme-d5 {color:#fff !important; background-color:#20295b !important}
.w3-theme-light {color:#000 !important; background-color:#f3f4fb !important}
.w3-theme-dark {color:#fff !important; background-color:#20295b !important}
.w3-theme-action {color:#fff !important; background-color:#20295b !important}
.w3-theme {color:#fff !important; background-color:#3f51b5 !important}
.w3-text-theme {color:#3f51b5 !important}
.w3-border-theme {border-color:#3f51b5 !important}
.w3-hover-theme:hover {color:#fff !important; background-color:#3f51b5 !important}
.w3-hover-text-theme:hover {color:#3f51b5 !important}
.w3-hover-border-theme:hover {border-color:#3f51b5 !important}

View File

@@ -0,0 +1,23 @@
.w3-theme-l5 {color:#000 !important; background-color:#f8fbf4 !important}
.w3-theme-l4 {color:#000 !important; background-color:#e8f3db !important}
.w3-theme-l3 {color:#000 !important; background-color:#d1e7b7 !important}
.w3-theme-l2 {color:#000 !important; background-color:#b9db93 !important}
.w3-theme-l1 {color:#000 !important; background-color:#a2cf6f !important}
.w3-theme-d1 {color:#fff !important; background-color:#7eb63d !important}
.w3-theme-d2 {color:#fff !important; background-color:#70a236 !important}
.w3-theme-d3 {color:#fff !important; background-color:#628e2f !important}
.w3-theme-d4 {color:#fff !important; background-color:#547a29 !important}
.w3-theme-d5 {color:#fff !important; background-color:#466522 !important}
.w3-theme-light {color:#000 !important; background-color:#f8fbf4 !important}
.w3-theme-dark {color:#fff !important; background-color:#466522 !important}
.w3-theme-action {color:#fff !important; background-color:#466522 !important}
.w3-theme {color:#fff !important; background-color:#8bc34a !important}
.w3-text-theme {color:#8bc34a !important}
.w3-border-theme {border-color:#8bc34a !important}
.w3-hover-theme:hover {color:#fff !important; background-color:#8bc34a !important}
.w3-hover-text-theme:hover {color:#8bc34a !important}
.w3-hover-border-theme:hover {border-color:#8bc34a !important}

View File

@@ -0,0 +1,22 @@
.w3-theme-l5 {color:#000 !important; background-color:#f4f9ff !important}
.w3-theme-l4 {color:#000 !important; background-color:#daedff !important}
.w3-theme-l3 {color:#000 !important; background-color:#b6daff !important}
.w3-theme-l2 {color:#000 !important; background-color:#91c8ff !important}
.w3-theme-l1 {color:#000 !important; background-color:#6cb6ff !important}
.w3-theme-d1 {color:#fff !important; background-color:#2793ff !important}
.w3-theme-d2 {color:#fff !important; background-color:#0683ff !important}
.w3-theme-d3 {color:#fff !important; background-color:#0072e4 !important}
.w3-theme-d4 {color:#fff !important; background-color:#0062c4 !important}
.w3-theme-d5 {color:#fff !important; background-color:#0052a3 !important}
.w3-theme-light {color:#000 !important; background-color:#f4f9ff !important}
.w3-theme-dark {color:#fff !important; background-color:#0052a3 !important}
.w3-theme-action {color:#fff !important; background-color:#0052a3 !important}
.w3-theme {color:#fff !important; background-color:#45a1ff !important}
.w3-text-theme {color:#45a1ff !important}
.w3-border-theme {border-color:#45a1ff !important}
.w3-hover-theme:hover {color:#fff !important; background-color:#45a1ff !important}
.w3-hover-text-theme:hover {color:#45a1ff !important}
.w3-hover-border-theme:hover {border-color:#45a1ff !important}

View File

@@ -0,0 +1,22 @@
.w3-theme-l5 {color:#000 !important; background-color:#fff9f0 !important}
.w3-theme-l4 {color:#000 !important; background-color:#ffebcc !important}
.w3-theme-l3 {color:#000 !important; background-color:#ffd699 !important}
.w3-theme-l2 {color:#000 !important; background-color:#ffc266 !important}
.w3-theme-l1 {color:#000 !important; background-color:#ffad33 !important}
.w3-theme-d1 {color:#fff !important; background-color:#e68a00 !important}
.w3-theme-d2 {color:#fff !important; background-color:#cc7a00 !important}
.w3-theme-d3 {color:#fff !important; background-color:#b36b00 !important}
.w3-theme-d4 {color:#fff !important; background-color:#995c00 !important}
.w3-theme-d5 {color:#fff !important; background-color:#804d00 !important}
.w3-theme-light {color:#000 !important; background-color:#fff9f0 !important}
.w3-theme-dark {color:#fff !important; background-color:#804d00 !important}
.w3-theme-action {color:#fff !important; background-color:#804d00 !important}
.w3-theme {color:#000 !important; background-color:#ff9800 !important}
.w3-text-theme {color:#ff9800 !important}
.w3-border-theme {border-color:#ff9800 !important}
.w3-hover-theme:hover {color:#000 !important; background-color:#ff9800 !important}
.w3-hover-text-theme:hover {color:#ff9800 !important}
.w3-hover-border-theme:hover {border-color:#ff9800 !important}

View File

@@ -0,0 +1,22 @@
.w3-theme-l5 {color:#000 !important; background-color:#fef2f6 !important}
.w3-theme-l4 {color:#000 !important; background-color:#fbd2e0 !important}
.w3-theme-l3 {color:#000 !important; background-color:#f6a6c1 !important}
.w3-theme-l2 {color:#fff !important; background-color:#f279a1 !important}
.w3-theme-l1 {color:#fff !important; background-color:#ed4d82 !important}
.w3-theme-d1 {color:#fff !important; background-color:#d91557 !important}
.w3-theme-d2 {color:#fff !important; background-color:#c1134d !important}
.w3-theme-d3 {color:#fff !important; background-color:#a91143 !important}
.w3-theme-d4 {color:#fff !important; background-color:#910e3a !important}
.w3-theme-d5 {color:#fff !important; background-color:#790c30 !important}
.w3-theme-light {color:#000 !important; background-color:#fef2f6 !important}
.w3-theme-dark {color:#fff !important; background-color:#790c30 !important}
.w3-theme-action {color:#fff !important; background-color:#790c30 !important}
.w3-theme {color:#fff !important; background-color:#e91e63 !important}
.w3-text-theme {color:#e91e63 !important}
.w3-border-theme {border-color:#e91e63 !important}
.w3-hover-theme:hover {color:#fff !important; background-color:#e91e63 !important}
.w3-hover-text-theme:hover {color:#e91e63 !important}
.w3-hover-border-theme:hover {border-color:#e91e63 !important}

View File

@@ -0,0 +1,22 @@
.w3-theme-l5 {color:#000 !important; background-color:#e9fffd !important}
.w3-theme-l4 {color:#000 !important; background-color:#b7fff8 !important}
.w3-theme-l3 {color:#000 !important; background-color:#6efff1 !important}
.w3-theme-l2 {color:#000 !important; background-color:#26ffe9 !important}
.w3-theme-l1 {color:#fff !important; background-color:#00dcc6 !important}
.w3-theme-d1 {color:#fff !important; background-color:#008578 !important}
.w3-theme-d2 {color:#fff !important; background-color:#00766a !important}
.w3-theme-d3 {color:#fff !important; background-color:#00685d !important}
.w3-theme-d4 {color:#fff !important; background-color:#005950 !important}
.w3-theme-d5 {color:#fff !important; background-color:#004a43 !important}
.w3-theme-light {color:#000 !important; background-color:#e9fffd !important}
.w3-theme-dark {color:#fff !important; background-color:#004a43 !important}
.w3-theme-action {color:#fff !important; background-color:#004a43 !important}
.w3-theme {color:#fff !important; background-color:#009688 !important}
.w3-text-theme {color:#009688 !important}
.w3-border-theme {border-color:#009688 !important}
.w3-hover-theme:hover {color:#fff !important; background-color:#009688 !important}
.w3-hover-text-theme:hover {color:#009688 !important}
.w3-hover-border-theme:hover {border-color:#009688 !important}

View File

@@ -0,0 +1,39 @@
.w3-btn, .w3-btn:link, .w3-btn:visited {background-color: #8AC007;}
.w3-code {border-left: 4px solid #8AC007 !important;}
.w3-sidenav h2 {color: #8AC007;font-size:20px;margin-left: 16px;}
.w3-topnav {font-size: 20px}
.w3-example {margin-top:16px}
#main {margin-left: 220px;}
.w3-sidenav {font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;width: 220px;}
.active {background-color:#8AC007 !important;color:#fff !important;}
@media only screen and (max-width: 728px) {
.w3-sidenav {display: none;}
.w3-opennav {display:inline-block !important;}
#main {margin-left:0% !important;}
}
.w3-theme-l5 {color:#000 !important;background-color:#f3f9e6 !important}
.w3-theme-l4 {color:#000 !important;background-color:#e8f2cd !important}
.w3-theme-l3 {color:#000 !important;background-color:#d0e69c !important}
.w3-theme-l2 {color:#000 !important;background-color:#b9d96a !important}
.w3-theme-l1 {color:#000 !important;background-color:#a1cd39 !important}
.w3-theme-d1 {color:#fff !important;background-color:#7cad06 !important}
.w3-theme-d2 {color:#fff !important;background-color:#6e9a06 !important}
.w3-theme-d3 {color:#fff !important;background-color:#618605 !important}
.w3-theme-d4 {color:#fff !important;background-color:#537304 !important}
.w3-theme-d5 {color:#fff !important;background-color:#446003 !important}
.w3-theme-light {color:#000 !important;background-color:#f3f9e6 !important}
.w3-theme-dark {color:#fff !important;background-color:#446003 !important}
.w3-theme-action {color:#fff !important;background-color:#537304 !important}
.w3-theme {color:#fff !important;background-color:#8AC007 !important}
.w3-text-theme {color:#8AC007 !important}
.w3-border-theme {border-color:#8AC007 !important}
.w3-hover-theme:hover {color:#fff !important;background-color:#8AC007 !important}
.w3-hover-text-theme:hover {color:#8AC007 !important}
.w3-hover-border-theme:hover {border-color:#8AC007 !important}

View File

@@ -0,0 +1,36 @@
.accordion {
background-color: #eee;
color: #444;
cursor: pointer;
padding: 18px;
width: 100%;
border: none;
text-align: left;
outline: none;
font-size: 15px;
transition: 0.4s;
}
.active, .accordion:hover {
background-color: #ccc;
}
.accordion:after {
content: '\002B';
color: #777;
font-weight: bold;
float: right;
margin-left: 5px;
}
.active:after {
content: "\2212";
}
.panel {
padding: 0 18px;
background-color: white;
max-height: 0;
overflow: hidden;
transition: max-height 0.2s ease-out;
}

View File

@@ -0,0 +1,59 @@
.switch {
position: relative;
display: inline-block;
width: 60px;
height: 34px;
}
.switch input {
opacity: 0;
width: 0;
height: 0;
}
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
-webkit-transition: .4s;
transition: .4s;
}
.slider:before {
position: absolute;
content: "";
height: 26px;
width: 26px;
left: 4px;
bottom: 4px;
background-color: white;
-webkit-transition: .4s;
transition: .4s;
}
input:checked + .slider {
background-color: #2196F3;
}
input:focus + .slider {
box-shadow: 0 0 1px #2196F3;
}
input:checked + .slider:before {
-webkit-transform: translateX(26px);
-ms-transform: translateX(26px);
transform: translateX(26px);
}
/* Rounded sliders */
.slider.round {
border-radius: 34px;
}
.slider.round:before {
border-radius: 50%;
}

View File

@@ -0,0 +1,60 @@
.switch {
position: relative;
display: inline-block;
width: 35px;
height: 21px;
}
.switch input {
opacity: 0;
width: 0;
height: 0;
}
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
-webkit-transition: .4s;
transition: .4s;
}
.slider:before {
position: absolute;
content: "";
height: 18px;
width: 18px;
left: 1px;
bottom: 1px;
top: 1px;
background-color: white;
-webkit-transition: .4s;
transition: .4s;
}
input:checked + .slider {
background-color: rgb(10, 230, 10);
}
input:focus + .slider {
box-shadow: 0 0 1px rgb(10, 230, 10);
}
input:checked + .slider:before {
-webkit-transform: translateX(13px);
-ms-transform: translateX(13px);
transform: translateX(13px);
}
/* Rounded sliders */
.slider.round {
border-radius: 16px;
}
.slider.round:before {
border-radius: 50%;
}

0
firmware_mod/www/favicon.ico Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 715 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 507 B

Some files were not shown because too many files have changed in this diff Show More