diff --git a/stpkg b/stpkg index 0bd4aeec2fcc5069e5efd3364fe077c0a5e0075e..7a8f230ebf1631b0e98d7c1ac74e49789f58952a 100755 --- a/stpkg +++ b/stpkg @@ -226,6 +226,13 @@ __upload_file() { local TYPE=$1 # The type of file (png/gif) local FILE=$2 # The file local NAME=$3 # The pretty name for the sticker + + if [ "x$STPKG_TOKEN" = "x" ]; then + read -sp "`__yellow 'Enter your access token:'`" STPKG_TOKEN + echo '' + fi + validate_token # Validate token, will exit if invalid + # TODO: Use jq here curl -s -X POST -H \ "Content-Type: $TYPE" --data-binary "@$FILE" "https://$STPKG_HOMESERV/_matrix/media/r0/upload?access_token=$STPKG_TOKEN" | \ @@ -936,11 +943,6 @@ __do_command() { STPKG_TOKEN="$2" shift 2 fi - if [ "x$STPKG_TOKEN" = "x" ]; then - read -sp "`__yellow 'Enter your access token:'`" STPKG_TOKEN - echo '' - fi - validate_token # Validate token, will exit if invalid local PARSE_FLAGS=1