#!/bin/bash if ! session_verify "${cookies[sh_session]}"; then jq -n '{status: $ARGS.positional[0], msg: $ARGS.positional[1]}' --args -1 "You're not logged in!" return fi source "${cfg[namespace]}/code/common.sh" if [[ "${post_data[phone]}" != "" && "${post_data[code]}" != "" ]]; then tokens='' while [[ "$tokens" == '' ]]; do tokens=$(curl -s -X POST -H "Content-type: application/json" --data '{"phoneOS":"Android"}' "https://api-inmobile-pl.easypack24.net/v1/confirmSMSCode/${post_data[phone]}/${post_data[code]}") sleep 0.5 done if [[ $(echo $tokens | jq .status) == "404" ]]; then jq -n '{status: $ARGS.positional[0], msg: $ARGS.positional[1]}' --args -1 "wrongData" else add_account_refreshtoken $(echo $tokens | jq -r .refreshToken) add_account_authtoken $(echo $tokens | jq -r .authToken) jq -n '{status: $ARGS.positional[0], msg: $ARGS.positional[1]}' --args 200 "success" fi fi