@@ -14,14 +14,13 @@ echoerr() {
1414github_release () {
1515 owner_repo=$1
1616 version=$2
17- header=$3
1817 test -z " $version " && version=" latest"
1918 if [ " $version " = " latest" ]; then
2019 giturl=" https://api.github.com/repos/${owner_repo} /releases/latest"
2120 else
2221 giturl=" https://api.github.com/repos/${owner_repo} /releases/tags/${version} "
2322 fi
24- json=$( http_copy " $giturl " " $header " )
23+ json=$( http_copy " $giturl " )
2524 test -z " $json " && return 1
2625 version=$( echo " $json " | tr -s ' \n' ' ' | sed ' s/.*"tag_name": *"//' | sed ' s/".*//' )
2726 test -z " $version " && return 1
@@ -31,12 +30,7 @@ github_release() {
3130http_download_curl () {
3231 local_file=$1
3332 source_url=$2
34- header=$3
35- if [ -z " $header " ]; then
36- code=$( curl -w ' %{http_code}' -sL --proto ' =https' --tlsv1.2 -o " $local_file " " $source_url " )
37- else
38- code=$( curl -w ' %{http_code}' -sL --proto ' =https' --tlsv1.2 -H " $header " -o " $local_file " " $source_url " )
39- fi
33+ code=$( curl -w ' %{http_code}' -sL --proto ' =https' --tlsv1.2 -o " $local_file " " $source_url " )
4034 if [ " $code " != " 200" ]; then
4135 log_debug " http_download_curl received HTTP status $code "
4236 return 1
@@ -47,12 +41,7 @@ http_download_curl() {
4741http_download_wget () {
4842 local_file=$1
4943 source_url=$2
50- header=$3
51- if [ -z " $header " ]; then
52- wget -q -O " $local_file " " $source_url "
53- else
54- wget -q --header " $header " -O " $local_file " " $source_url "
55- fi
44+ wget -q -O " $local_file " " $source_url "
5645}
5746
5847http_download () {
@@ -70,7 +59,7 @@ http_download() {
7059
7160http_copy () {
7261 tmp=$( mktemp)
73- http_download " ${tmp} " " $1 " " $2 " || return 1
62+ http_download " ${tmp} " " $1 " || return 1
7463 body=$( cat " $tmp " )
7564 rm -f " ${tmp} "
7665 echo " $body "
@@ -222,11 +211,7 @@ TAG="${1-latest}"
222211INSTALL_DIR=" ${2-$HOME / .local/ bin} "
223212PROJ_NAME=" loops_cli"
224213SHORT_BIN_NAME=" loops"
225- AUTH_HEADER=" "
226- if [ -n " $GITHUB_TOKEN " ]; then
227- AUTH_HEADER=" Authorization: Bearer ${GITHUB_TOKEN} "
228- fi
229- GH_RELEASE=$( github_release " $GH_REPO " " $TAG " " $AUTH_HEADER " )
214+ GH_RELEASE=$( github_release " $GH_REPO " " $TAG " )
230215if [ " $OS " = " windows" ]; then
231216 GH_RELEASE_FILENAME=" ${PROJ_NAME} _${OS} _${ARCH} .zip"
232217else
@@ -239,11 +224,11 @@ CHECKSUMS_URL="${GH_ASSETS_URL}/${GH_RELEASE}/${CHECKSUMS_FILENAME}"
239224
240225execute () {
241226 TMPDIR=$( mktemp -d)
242- if ! http_download " ${TMPDIR} /${GH_RELEASE_FILENAME} " " $DOWNLOAD_URL " " $AUTH_HEADER " ; then
227+ if ! http_download " ${TMPDIR} /${GH_RELEASE_FILENAME} " " $DOWNLOAD_URL " ; then
243228 log_err " Failed to download $DOWNLOAD_URL "
244229 return 1
245230 fi
246- if ! http_download " ${TMPDIR} /${CHECKSUMS_FILENAME} " " $CHECKSUMS_URL " " $AUTH_HEADER " ; then
231+ if ! http_download " ${TMPDIR} /${CHECKSUMS_FILENAME} " " $CHECKSUMS_URL " ; then
247232 log_err " Failed to download checksums from $CHECKSUMS_URL "
248233 return 1
249234 fi
0 commit comments