Skip to content

Commit 5b9ab91

Browse files
authored
Update installer (#247)
* remove useless API key per @asaddon and @VladFlorinIlie suggestions. We will now only go by the users IP address (60req./hr) ratelimit.
1 parent b885048 commit 5b9ab91

File tree

2 files changed

+11
-16
lines changed

2 files changed

+11
-16
lines changed

installer

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#██║████╗ ██║██╔════╝╚══██╔══╝██╔══██╗██║ ██║ ██╔════╝██╔══██╗ SomeWhereOverTheRainBow #
1717
#██║██╔██╗ ██║███████╗ ██║ ███████║██║ ██║ █████╗ ██████╔╝ Contributors: #
1818
#██║██║╚██╗██║╚════██║ ██║ ██╔══██║██║ ██║ ██╔══╝ ██╔══██╗ JackYaz,gspannu,thelonelycoder #
19-
#██║██║ ╚████║███████║ ██║ ██║ ██║███████╗███████╗███████╗██║ ██║ v1.9.1 #
19+
#██║██║ ╚████║███████║ ██║ ██║ ██║███████╗███████╗███████╗██║ ██║ v1.9.2 #
2020
#╚═╝╚═╝ ╚═══╝╚══════╝ ╚═╝ ╚═╝ ╚═╝╚══════╝╚══════╝╚══════╝╚═╝ ╚═╝ #
2121
#################################################################################################################
2222

@@ -28,29 +28,24 @@
2828
export LC_ALL=C
2929
export PATH="/sbin:/bin:/usr/sbin:/usr/bin:${PATH}"
3030

31-
AI_VERSION="v1.9.1"
31+
AI_VERSION="v1.9.2"
3232
export AI_VERSION
3333
readonly API_FILE="/tmp/AGH_GIT_API_$$.json"
3434
readonly LATEST_URL="https://api.github.com/repos/AdguardTeam/AdGuardHome/releases"
35-
if openssl version | grep -q "1.1.1"; then
36-
API_AUTH="$(printf "%s\n" "U2FsdGVkX193tvNAm/h0gqP8WFAbXP6rvJH+2ydlGOgX4nVc0jt4pVLTZhchaAvA" | openssl enc -aes-256-cbc -d -base64 -pass pass:adguardhome -pbkdf2)"
37-
API_SECRET="$(printf "%s\n" "U2FsdGVkX1/o/jNigvt2vDaQ8cn+8zHIxbS2NUKKCjMrPGCq3b1HIDE0f8q3gDXe8SxfTh9HQcxxnR2grWBwuwkTqwbAcE7okW4EHMHVpTXRNthxm2RYkNLFIrRKYDP0rLbdd7/g28c3trlPGqc9ng==" | openssl enc -aes-256-cbc -d -base64 -pass pass:adguardhome -pbkdf2)"
38-
API_HEADER="-H "\""${API_AUTH} ${API_SECRET}"\"""
39-
fi
4035
varcnt=0
4136
readonly MAX_RETRIES="1"
4237
until [ -n "${REMOTE_VER}" ] && [ -n "${REMOTE_BETA}" ]; do
43-
if [ "${varcnt}" -lt "${MAX_RETRIES}" ] || { [ "${varcnt}" -eq "${MAX_RETRIES}" ] && [ -z "${API_HEADER}" ]; }; then
44-
curl -D /tmp/$$_headers.out --retry 3 --connect-timeout 3 --retry-delay 1 --max-time $((3 * 5)) --retry-connrefused -sL "${LATEST_URL}?per_page=5" -o "${API_FILE}"
45-
elif { [ "${varcnt}" -eq "${MAX_RETRIES}" ] && [ -n "${API_HEADER}" ]; }; then
46-
curl -D /tmp/$$_headers.out --retry 3 --connect-timeout 3 --retry-delay 1 --max-time $((3 * 5)) --retry-connrefused -sL "${LATEST_URL}?per_page=5" -o "${API_FILE}" "${API_HEADER}"
47-
elif [ "${varcnt}" -gt "${MAX_RETRIES}" ]; then
48-
printf "%s\n" "One or more critical variables could not be set in a timely manner." "It is possible we have hit the github api ratelimit (60req./hr), and our token work around did not work (5000req./hr)." "For more information, please read /tmp/$$_headers.out." "Please be sure to check your internet connection, and please try again later." "The installer script will now exit."
38+
curl -D /tmp/$$_headers.out --retry 3 --connect-timeout 3 --retry-delay 1 --max-time $((3 * 5)) --retry-connrefused -sL "${LATEST_URL}?per_page=5" -o "${API_FILE}"
39+
if [ -s "${API_FILE}" ]; then
40+
REMOTE_VER="$(awk '/"tag_name":/ {t=$2} /"prerelease": false/ {gsub(/[",]/,"",t); print t; exit}' "${API_FILE}")"
41+
REMOTE_BETA="$(awk '/"tag_name":/ {t=$2} /"prerelease": true/ {gsub(/[",]/,"",t); print t; exit}' "${API_FILE}")"
42+
break
43+
fi
44+
if [ "${varcnt}" -gt "${MAX_RETRIES}" ]; then
45+
printf "%s\n" "One or more critical variables could not be set in a timely manner." "It is possible we have hit the github api ratelimit (60req./hr) per requesters IP." "For more information, please read /tmp/$$_headers.out." "Please be sure to check your internet connection, and please try again later." "The installer script will now exit."
4946
sleep 3s
5047
exit 1
5148
fi
52-
if [ -z "${REMOTE_VER}" ] && [ -f "${API_FILE}" ]; then REMOTE_VER="$(awk '/"tag_name":/ {t=$2} /"prerelease": false/ {gsub(/[",]/,"",t); print t; exit}' "${API_FILE}")"; fi
53-
if [ -z "${REMOTE_BETA}" ] && [ -f "${API_FILE}" ]; then REMOTE_BETA="$(awk '/"tag_name":/ {t=$2} /"prerelease": true/ {gsub(/[",]/,"",t); print t; exit}' "${API_FILE}")"; fi
5449
varcnt="$((varcnt + 1))"
5550
done
5651
rm -rf "$API_FILE" "/tmp/$$_headers.out"

installer.md5sum

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8b38f74ccaf21d21518aab1b6e663836
1+
9ff07a3598f48a0dd77fdd4346fd00ec

0 commit comments

Comments
 (0)