init
This commit is contained in:
21
cgi-bin/j/locale.cgi
Executable file
21
cgi-bin/j/locale.cgi
Executable file
@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
mj_audio=Audio
|
||||
mj_cloud=Cloud
|
||||
mj_hls=HLS
|
||||
mj_image=Image
|
||||
mj_ipeye=IPEYE
|
||||
mj_isp=ISP
|
||||
mj_jpeg=JPEG
|
||||
mj_motionDetect=Motion
|
||||
mj_netip=NETIP
|
||||
mj_nightMode=Night
|
||||
mj_onvif=ONVIF
|
||||
mj_osd=OSD
|
||||
mj_outgoing=Outgoing
|
||||
mj_records=Record
|
||||
mj_rtsp=RTSP
|
||||
mj_system=System
|
||||
mj_video0=Video0
|
||||
mj_video1=Video1
|
||||
mj_watchdog=Watchdog
|
||||
mj_youtube=Youtube
|
||||
26
cgi-bin/j/pulse.cgi
Executable file
26
cgi-bin/j/pulse.cgi
Executable file
@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
web=$(pidof majestic)
|
||||
temp=$(ipcinfo -t 2> /dev/null)
|
||||
|
||||
if [ -n "$web" ]; then
|
||||
daynight_value=$(wget -q -T1 localhost/metrics/isp?value=isp_again -O -)
|
||||
fi
|
||||
|
||||
if [ -n "$temp" ]; then
|
||||
soc_temp="${temp%.*}°C"
|
||||
fi
|
||||
|
||||
mem_total=$(awk '/MemTotal/ {print $2}' /proc/meminfo)
|
||||
mem_free=$(awk '/MemFree/ {print $2}' /proc/meminfo)
|
||||
mem_used=$(( 100 - (mem_free / (mem_total / 100)) ))
|
||||
overlay_used=$(df | grep /overlay | xargs | cut -d' ' -f5)
|
||||
uptime=$(awk '{m=$1/60; h=m/60; printf "%sd %sh %sm %ss\n", int(h/24), int(h%24), int(m%60), int($1%60) }' /proc/uptime)
|
||||
payload=$(printf '{"soc_temp":"%s","time_now":"%s","timezone":"%s","mem_used":"%d","overlay_used":"%d","daynight_value":"%d","uptime":"%s"}' \
|
||||
"${soc_temp}" "$(date +%s)" "$(cat /etc/timezone)" "${mem_used}" "${overlay_used//%/}" "${daynight_value:=-1}" "$uptime")
|
||||
|
||||
echo "HTTP/1.1 200 OK
|
||||
Content-type: application/json
|
||||
Pragma: no-cache
|
||||
|
||||
${payload}
|
||||
"
|
||||
24
cgi-bin/j/run.cgi
Executable file
24
cgi-bin/j/run.cgi
Executable file
@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
echo "HTTP/1.1 200 OK
|
||||
Content-type: text/html; charset=UTF-8
|
||||
Cache-Control: no-store
|
||||
Pragma: no-cache
|
||||
"
|
||||
|
||||
[ -n "$QUERY_STRING" ] && eval $(echo "$QUERY_STRING" | sed "s/&/;/g")
|
||||
[ -n "$cmd" ] && c=$(echo $cmd | base64 -d)
|
||||
[ -n "$web" ] && c=$(echo $web | base64 -d) && t="timeout 3"
|
||||
[ -z "$c" ] && echo "No command!" && exit 1
|
||||
|
||||
prompt() {
|
||||
echo "<b>$(whoami)@$(hostname):$PWD# ${1}</b>"
|
||||
}
|
||||
|
||||
export PATH=/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin
|
||||
cd /tmp || return
|
||||
|
||||
prompt "$c"
|
||||
eval "$t $c" 2>&1
|
||||
prompt
|
||||
|
||||
exit 0
|
||||
13
cgi-bin/j/time.cgi
Executable file
13
cgi-bin/j/time.cgi
Executable file
@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
if ntpd -n -q -N; then
|
||||
payload='{"result":"success","message":"Camera time synchronized with NTP server."}'
|
||||
else
|
||||
payload='{"result":"danger","message":"Synchronization failed!"}'
|
||||
fi
|
||||
|
||||
echo "HTTP/1.1 200 OK
|
||||
Content-type: application/json
|
||||
Pragma: no-cache
|
||||
|
||||
${payload}
|
||||
"
|
||||
Reference in New Issue
Block a user