From 6f44f2b49333027f66ba530cf5f7cad3ecd22d0e Mon Sep 17 00:00:00 2001 From: localhost_frssoft Date: Wed, 6 Apr 2022 16:23:40 +0300 Subject: [PATCH] Check connect --- peertube-cli.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/peertube-cli.sh b/peertube-cli.sh index a915a40..dfc0308 100755 --- a/peertube-cli.sh +++ b/peertube-cli.sh @@ -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