diff --git a/stpkg b/stpkg index b8c12780f981ee1a2387cb0a2fc28730dc138f33..ae9b9751fe13f919b0dcb5d90db6d809c85e3bc4 100755 --- a/stpkg +++ b/stpkg @@ -226,11 +226,6 @@ __upload_file() { 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 - validate_token # Validate token, will exit if invalid - fi - MXC=$(curl -s -X POST -H \ "Content-Type: $TYPE" --data-binary "@$FILE" "https://$STPKG_HOMESERV/_matrix/media/r0/upload?access_token=$STPKG_TOKEN" | \ tee /tmp/toto | jq -r ".content_uri") @@ -602,6 +597,11 @@ process_sticker_file() { FILE="$1" local -n JSON_REF="$2" + if [ "x$STPKG_TOKEN" = "x" ]; then + read -sp "`__yellow 'Enter your access token:'`" STPKG_TOKEN + validate_token # Validate token, will exit if invalid + fi + # Get the names and extensions local INIT_TYPE=$(file_get_type "$FILE") local INIT_EXT=$(file_get_ext_from_type "$INIT_TYPE")