feat: support Fanavaran car-body flow in UI

This commit is contained in:
2026-10-31 14:45:26 +03:30
parent 82d204bd66
commit c185145394
10 changed files with 1210 additions and 108 deletions
+21 -1
View File
@@ -4,7 +4,7 @@ set -euo pipefail
usage() {
cat <<'USAGE'
Usage:
scripts/fanavaran-auth.sh <tejaratno|parsian>
scripts/fanavaran-auth.sh <tejaratno|parsian|moallem>
Calls Fanavaran GetAppToken, then Login with the returned appToken.
Outputs the appToken and authenticationToken, and writes raw responses to:
@@ -40,6 +40,15 @@ case "$client" in
contract_id='28'
location='210050'
;;
moallem)
app_name='ItTalie'
app_secret='itT@l!3@api'
fanavaran_username='itTalieUser'
fanavaran_password='itT@l!3@user'
corp_id='5650'
contract_id='304'
location='30900'
;;
*)
printf 'Unknown Fanavaran client: %s\n\n' "$client" >&2
usage >&2
@@ -51,6 +60,13 @@ base_url="${FANAVARAN_BASE_URL:-https://apimanager.iraneit.com/BimeApiManager/ap
auth_dir="files/fanavaran-auth/$client"
mkdir -p "$auth_dir"
curl_proxy_args() {
local proxy="${CURL_PROXY:-${ALL_PROXY:-}}"
if [[ -n "$proxy" ]]; then
printf '%s' "--proxy $proxy"
fi
}
app_token_headers="$auth_dir/get-app-token.headers"
app_token_body="$auth_dir/get-app-token.body.json"
login_headers="$auth_dir/login.headers"
@@ -88,7 +104,9 @@ printf 'Fanavaran client: %s\n' "$client"
printf 'Base URL: %s\n\n' "$base_url"
printf '1. Calling GetAppToken...\n'
# shellcheck disable=SC2046
curl -sS -D "$app_token_headers" -o "$app_token_body" \
$(curl_proxy_args) \
-X POST "$base_url/EITAuthentication/GetAppToken" \
-H "appname: $app_name" \
-H "secret: $app_secret" \
@@ -102,7 +120,9 @@ if [[ -z "$app_token" ]]; then
fi
printf '2. Calling Login...\n'
# shellcheck disable=SC2046
curl -sS -D "$login_headers" -o "$login_body" \
$(curl_proxy_args) \
-X POST "$base_url/EITAuthentication/Login" \
-H "appToken: $app_token" \
-H "userName: $fanavaran_username" \