diff --git a/matrixpack.sh b/matrixpack.sh index 72c221645dd3371a266d22519c4f60fe401951c1..06ab1e42690a7f0feb8943ccd93641d27da2cb27 100755 --- a/matrixpack.sh +++ b/matrixpack.sh @@ -62,7 +62,8 @@ packname=${dir##*/} slug=$(slugify "$packname") homeserver=$(slug_homeserver $2) -# Checking if the homeserver exist +# Checking if the homeserver exist. +# If the homeserver does not exist, the file headers is not created curl "https://$homeserver" -I -o headers -s if test -f "headers"; then rm headers @@ -71,7 +72,9 @@ else exit 1 fi -# Checking if the token exist +# Checking if the token exist. +# Save the error value on file "headers" and +# compare the error 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") ]]