diff --git a/matrixpack.sh b/matrixpack.sh index dd4370c87fc98e4c04165a1bd9406655829c7ce4..f743a267ba050d06bd673629975c1d552b64fb35 100755 --- a/matrixpack.sh +++ b/matrixpack.sh @@ -53,13 +53,13 @@ curl "https://$homeserver" -I -o headers -s if test -f "headers"; then rm headers else - echo 1>&2 "$0:FATAL: The homeserver \"$2\" is not correct." + echo 1>&2 "$0:FATAL: The homeserver \"$2\" is incorrect." exit 1 fi # Checking if the token exist. # Save the error value on file "headers" and -# compare the error to verify the token +# evaluate it to verify the token curl -s -X POST "https://$homeserver/_matrix/media/r0/upload?access_token=$token" | python3 -c "import sys, json; print(json.load(sys.stdin)['errcode'])" >> headers while read line; do if [[ ($line == "M_UNKNOWN") ]] @@ -67,7 +67,7 @@ while read line; do rm headers else if [[ ($line == "M_UNKNOWN_TOKEN") ]] then - echo "$0:ERROR: The token provided does not exist" + echo "$0:ERROR: The token provided is incorrect or does not exist in this homeserver" rm headers exit 1 else