Check connect

This commit is contained in:
localhost_frssoft 2022-04-06 16:23:40 +03:00
parent 3b590001a9
commit 6f44f2b493
1 changed files with 17 additions and 0 deletions

View File

@ -17,6 +17,15 @@ torrent_init()
fi
}
check_connect()
{
if [ -n "$(curl --head -s $instance_point/config | grep 'HTTP\/. 200')" ]; then
echo 'OK'
else
echo
fi
}
peertube_api_check_ratelimit()
{
curl -s --head "$instance_point/" | grep rate
@ -226,6 +235,10 @@ menu_settings()
done
}
if [ -z $(check_connect) ]; then
echo 'Connect error...'
echo 'Please retry later or switch instance'
fi
version=$(peertube_api_version_server)
torrent_init
videosmenu='All Videos'
@ -273,6 +286,10 @@ while true; do
cat $instance_hist | sort | uniq | tee $instance_hist 1>>/dev/null
export instance
export instance_point="https://$instance/api/v1"
if [ -z $(check_connect) ]; then
echo 'Connect error...'
echo 'Please retry later or switch instance'
fi
export version=$(peertube_api_version_server)
conf_instance_state=$(echo 'Permanent\nTemporaly' | fzy)
if [ "$conf_instance_state" = 'Permanent' ]; then