Misc fixed towards v1.9.0 (#3808)

* get web api info
* #3772 increase curl timeout
* #3805 change "Please Login"
This commit is contained in:
/rootzoll 2023-05-08 22:44:17 +02:00 committed by GitHub
parent 086b022698
commit 2519cc8708
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 70 additions and 7 deletions

View file

@ -457,11 +457,11 @@ if [ ${isMounted} -eq 0 ]; then
/home/admin/config.scripts/blitz.datadrive.sh status >> ${logFile}
# determine correct setup phase
infoMessage="Please Login for Setup"
infoMessage="Please start Setup"
setupPhase="setup"
if [ "${hddGotMigrationData}" != "" ]; then
infoMessage="Please Login for Migration"
infoMessage="Please start Migration"
setupPhase="migration"
# check if lightning is outdated
migrationMode="normal"
@ -480,10 +480,10 @@ if [ ${isMounted} -eq 0 ]; then
# TODO: improve version/update detection later
isRecovery=$(echo "${hddRaspiVersion}" | grep -c "${codeVersion}")
if [ "${isRecovery}" == "1" ]; then
infoMessage="Please Login for Recovery"
infoMessage="Please start Recovery"
setupPhase="recovery"
else
infoMessage="Please Login for Update"
infoMessage="Please start Update"
setupPhase="update"
fi

View file

@ -238,10 +238,11 @@ echo "--> CHECK CONFIG: sudo nginx -t"
sudo nginx -t 2>&1
echo
echo "*** BLITZAPI STATUS ***"
/home/admin/config.scripts/blitz.web.api.sh info
if [ $(sudo systemctl status blitzapi 2>/dev/null | grep -c "blitzapi.service") -lt 1 ]; then
echo "- BLITZAPI is not running"
else
echo "*** BLITZAPI SYSTEMD STATUS ***"
sudo systemctl status blitzapi -n2 --no-pager
echo
@ -251,6 +252,10 @@ else
echo
fi
echo "*** BLITZ WebUI STATUS ***"
/home/admin/config.scripts/blitz.web.ui.sh info
echo
if [ "${touchscreen}" == "" ] || [ "${touchscreen}" == "0" ] || [ "${touchscreen}" == "off" ]; then
echo "- TOUCHSCREEN is OFF by config"
else

View file

@ -12,6 +12,7 @@ FALLACK_BRANCH="dev"
# command info
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ] || [ "$1" = "-help" ]; then
echo "Manage RaspiBlitz Web API"
echo "blitz.web.api.sh info"
echo "blitz.web.api.sh on [GITHUBUSER] [REPO] [BRANCH] [?COMMITORTAG]"
echo "blitz.web.api.sh on DEFAULT"
echo "blitz.web.api.sh update-config"
@ -20,6 +21,34 @@ if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ] || [ "$1" = "-help" ];
exit 1
fi
###################
# INFO
###################
if [ "$1" = "info" ]; then
# check if installed
cd /home/blitzapi/blitz_api
if [ "$?" != "0" ]; then
echo "installed=0"
exit 1
fi
echo "installed=1"
# get github origin repo from repo directory with git command
origin=$(sudo -u blitzapi git config --get remote.origin.url)
echo "repo='${origin}'"
# get github branch from repo directory with git command
branch=$(sudo -u blitzapi git rev-parse --abbrev-ref HEAD)
echo "branch='${branch}'"
# get github commit from repo directory with git command
commit=$(sudo -u blitzapi git rev-parse HEAD)
echo "commit='${commit}'"
exit 0
fi
###################
# UPDATE CONFIG
###################

View file

@ -9,6 +9,7 @@ FALLACK_BRANCH="master"
# command info
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ] || [ "$1" = "-help" ]; then
echo "Manage RaspiBlitz WebUI"
echo "blitz.web.ui.sh info"
echo "blitz.web.ui.sh on [GITHUBUSER] [REPO] [BRANCH] [?COMMITORTAG]"
echo "blitz.web.ui.sh on DEFAULT"
echo "blitz.web.ui.sh update"
@ -16,6 +17,34 @@ if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ] || [ "$1" = "-help" ];
exit 0
fi
###################
# INFO
###################
if [ "$1" = "info" ]; then
# check if installed
cd /home/blitzapi/blitz_web
if [ "$?" != "0" ]; then
echo "installed=0"
exit 1
fi
echo "installed=1"
# get github origin repo from repo directory with git command
origin=$(sudo git config --get remote.origin.url)
echo "repo='${origin}'"
# get github branch from repo directory with git command
branch=$(sudo git rev-parse --abbrev-ref HEAD)
echo "branch='${branch}'"
# get github commit from repo directory with git command
commit=$(sudo git rev-parse HEAD)
echo "commit='${commit}'"
exit 0
fi
# check if started with sudo
if [ "$EUID" -ne 0 ]; then
echo "error='run as root'"

View file

@ -181,9 +181,9 @@ if [ ${runGlobal} -eq 1 ]; then
globalIP=""
echo "# getting public IP from third party service"
if [ "${ipv6}" == "on" ]; then
globalIP=$(curl -s -f -S -m 5 http://v6.ipv6-test.com/api/myip.php 2>/dev/null)
globalIP=$(curl -s -f -S -m 10 http://v6.ipv6-test.com/api/myip.php 2>/dev/null)
else
globalIP=$(curl -s -f -S -m 5 http://v4.ipv6-test.com/api/myip.php 2>/dev/null)
globalIP=$(curl -s -f -S -m 10 http://v4.ipv6-test.com/api/myip.php 2>/dev/null)
fi
echo "## curl returned: ${globalIP}"
echo "## curl exit code: ${?}"