blob: 459cdc9908347d8d8f2507f608968e504a805c70 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# Copyright (C) 2024-2026 Maria Lisina
# Copyright (C) 2024-2026 Danil Lisin
# SPDX-License-Identifier: Apache-2.0
if ! ib_auth_data="$(
curl --connect-timeout ${connrefused_timeout} \
--data-urlencode "username=${ib_login}" \
--data-urlencode "api_key=${ib_key}" \
--get \
--max-time ${external_timeout} \
--proxy "${external_proxy}" \
--retry 1 \
--retry-connrefused \
--retry-max-time $((external_timeout - connrefused_timeout)) \
--silent \
--user-agent "${useragent}" \
"${ib_auth}/user.json"
)"
then
output_text="Failed to access ${ib_name} API"
log_text="ib_auth (${update_id}): ${output_text}"
source "${units}/log.zsh"
return
fi
if ! jq -e '.' <<< "${ib_auth_data}" > /dev/null
then
output_text="Invalid username or API key"
fi
|