mirror of
				https://github.com/billz/raspap-webgui.git
				synced 2025-03-01 10:31:47 +00:00 
			
		
		
		
	Use Hilink API
This commit is contained in:
		@@ -47,7 +47,7 @@ case $opt in
 | 
				
			|||||||
    if [ ! "$res" = "none" ]; then
 | 
					    if [ ! "$res" = "none" ]; then
 | 
				
			||||||
      if [ "$type" = "hilink" ]; then
 | 
					      if [ "$type" = "hilink" ]; then
 | 
				
			||||||
        if [ "$res" = "LTE" ]; then res="4G"
 | 
					        if [ "$res" = "LTE" ]; then res="4G"
 | 
				
			||||||
        elif [ "$res" = "WCDMA" ]]; then  res="3G";
 | 
					        elif [ "$res" = "WCDMA" ]; then  res="3G";
 | 
				
			||||||
        else res="2G"; fi
 | 
					        else res="2G"; fi
 | 
				
			||||||
      else
 | 
					      else
 | 
				
			||||||
        if [ $res -eq 7 ]; then res="4G"
 | 
					        if [ $res -eq 7 ]; then res="4G"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -21,7 +21,7 @@ function _setAPIParams() {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if [ -z "$1" ]; then echo "none"; exit; fi
 | 
					if [ -z "$1" ]; then echo "none"; exit; fi
 | 
				
			||||||
opt="${1,,}"
 | 
					property="${1,,}"
 | 
				
			||||||
shift
 | 
					shift
 | 
				
			||||||
hostip="192.168.8.1"
 | 
					hostip="192.168.8.1"
 | 
				
			||||||
while [ -n "$1" ]; do
 | 
					while [ -n "$1" ]; do
 | 
				
			||||||
@@ -47,7 +47,7 @@ else
 | 
				
			|||||||
    info_file="/tmp/huawei_infos_${hostip}_${id -u}.dat"
 | 
					    info_file="/tmp/huawei_infos_${hostip}_${id -u}.dat"
 | 
				
			||||||
    if [ -f "$info_file" ]; then
 | 
					    if [ -f "$info_file" ]; then
 | 
				
			||||||
        age=$(( $(date +%s) - $(stat $info_file -c %Y) )) 
 | 
					        age=$(( $(date +%s) - $(stat $info_file -c %Y) )) 
 | 
				
			||||||
        if [[ $age -gt 5 ]]; then rm -f $info_file; fi
 | 
					        if [[ $age -gt 10 ]]; then rm -f $info_file; fi
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if [ -f "$info_file" ]; then
 | 
					    if [ -f "$info_file" ]; then
 | 
				
			||||||
@@ -58,10 +58,10 @@ else
 | 
				
			|||||||
        if ! _initHilinkAPI; then echo "none"; exit; fi
 | 
					        if ! _initHilinkAPI; then echo "none"; exit; fi
 | 
				
			||||||
        infos=$(_getAllInformations)
 | 
					        infos=$(_getAllInformations)
 | 
				
			||||||
        _closeHilinkAPI
 | 
					        _closeHilinkAPI
 | 
				
			||||||
        if [ ! -z "$infos" ]; then echo "$infos" > $info_file; fi
 | 
					        if [ ! -z "$infos" ]; then echo -n "$infos" > $info_file; fi
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    case "$opt" in
 | 
					    case "$property" in
 | 
				
			||||||
        device|devicename)
 | 
					        device|devicename)
 | 
				
			||||||
          key="devicename"
 | 
					          key="devicename"
 | 
				
			||||||
          ;;
 | 
					          ;;
 | 
				
			||||||
@@ -84,7 +84,7 @@ else
 | 
				
			|||||||
          key="fullname"
 | 
					          key="fullname"
 | 
				
			||||||
        ;;
 | 
					        ;;
 | 
				
			||||||
        *)
 | 
					        *)
 | 
				
			||||||
          key=""
 | 
					          key="device"
 | 
				
			||||||
        ;;
 | 
					        ;;
 | 
				
			||||||
      esac
 | 
					      esac
 | 
				
			||||||
      if [ -z "$key" ]; then result="none"; fi
 | 
					      if [ -z "$key" ]; then result="none"; fi
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,8 +7,10 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# get webroot
 | 
					# get webroot
 | 
				
			||||||
webroot=$(cat /etc/lighttpd/lighttpd.conf | sed -rn 's/server.document-root\s*=\s*\"(.*)\"\s*$/\1/p')
 | 
					webroot=$(cat /etc/lighttpd/lighttpd.conf | sed -rn 's/server.document-root\s*=\s*\"(.*)\"\s*$/\1/p')
 | 
				
			||||||
if [ -z "$webroot" ] || [ ! -d "$webroot" ]; then
 | 
					webuser=$(cat /etc/lighttpd/lighttpd.conf | sed -rn 's/server.username\s*=\s*\"(.*)\"\s*$/\1/p')
 | 
				
			||||||
  exit
 | 
					if [ -z "$webroot" ] || [ ! -d "$webroot" ] || [ -z "$webuser" ]; then 
 | 
				
			||||||
 | 
					    echo "$0 : Problem to obtain webroot directory and/or web user - exit" | systemd-cat 
 | 
				
			||||||
 | 
					    exit
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
cd $webroot
 | 
					cd $webroot
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -21,7 +23,7 @@ fi
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
[ -z "$state" ] && exit
 | 
					[ -z "$state" ] && exit
 | 
				
			||||||
 | 
					
 | 
				
			||||||
php << _EOF_
 | 
					sudo -u $webuser php << _EOF_
 | 
				
			||||||
<?php
 | 
					<?php
 | 
				
			||||||
require_once("includes/config.php");
 | 
					require_once("includes/config.php");
 | 
				
			||||||
require_once("includes/get_clients.php");
 | 
					require_once("includes/get_clients.php");
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user