From c0ac258d5b20c5f617748811c87f56cbc6fb406b Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Fri, 22 Mar 2024 17:57:11 -0400 Subject: [PATCH] Enable use of custom ports #214 - This should resolve this request! --- universal/functions.bash | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/universal/functions.bash b/universal/functions.bash index 6fce1d4..a7958b2 100644 --- a/universal/functions.bash +++ b/universal/functions.bash @@ -36,13 +36,15 @@ verifyApiAccess () { do arrApiTest="" arrApiVersion="" - if [ "$arrPort" == "8989" ] || [ "$arrPort" == "7878" ]; then + if [ -z "$arrApiTest" ]; then arrApiVersion="v3" - elif [ "$arrPort" == "8686" ] || [ "$arrPort" == "8787" ]; then - arrApiVersion="v1" + arrApiTest="$(curl -s "$arrUrl/api/$arrApiVersion/system/status?apikey=$arrApiKey" | jq -r .instanceName)" fi - arrApiTest=$(curl -s "$arrUrl/api/$arrApiVersion/system/status?apikey=$arrApiKey" | jq -r .instanceName) - if [ "$arrApiTest" == "$arrName" ]; then + if [ -z "$arrApiTest" ]; then + arrApiVersion="v1" + arrApiTest="$(curl -s "$arrUrl/api/$arrApiVersion/system/status?apikey=$arrApiKey" | jq -r .instanceName)" + fi + if [ ! -z "$arrApiTest" ]; then break else log "$arrName is not ready, sleeping until valid response..."