Merge branch 'fix_gitlab_dl' into 'master'

fix gitlab downloader

See merge request Nanolx/NanoDroid!46
merge-requests/46/merge
Nils 10 months ago
commit 7a3b264323

@ -290,12 +290,27 @@ grab_apk_from_github () {
download_apk_common "${apk_dest}" "${3}" "${apk_url}" github
}
# try to download release asset ending with .apk
grab_apk_from_gitlab () {
[ "${BP_DEBUG}" = '1' ] && debug_message newline "curl ${curl_opts} -s -N \"https://gitlab.com/${1}/-/tags\"" "\n"
local apk_tag="$(curl -A "${useragent}" -s -N "https://gitlab.com/${1}/-/tags" | grep -m1 ref-name | sed 's/.*\">//;s/<\/.*//')"
local apk_url="$(curl -A "${useragent}" -s -N "https://gitlab.com/${1}/-/tags/${apk_tag}" | tr '<' '\n' | gawk -F \" '/uploads.*apk/{print $2}')"
local apk_url="https://gitlab.com${apk_url}"
local namespace="$(echo $1 | cut -d "/" -f1)"
local repo="$(echo $1 | cut -d "/" -f2)"
[ "${BP_DEBUG}" = '1' ] && debug_message newline "curl ${curl_opts} -s -N \"https://gitlab.com/api/v4/projects/${namespace}%2F${repo}/releases/\"" "\n"
local apk_url="$(curl -A "${useragent}" -s -N https://gitlab.com/api/v4/projects/${namespace}%2F${repo}/releases/ | jq -r '.[0].assets.links[].url' | grep '.apk')"
local apk_dest="${appsfolder[2]}/${2}/${3}"
download_apk_common "${apk_dest}" "${3}" "${apk_url}" gitlab
}
# aurora devs upload the finished apk in the release description instead of the assets so they get a custom downloader function
grab_aurora_apk_from_gitlab () {
local namespace="$(echo $1 | cut -d "/" -f1)"
local repo="$(echo $1 | cut -d "/" -f2)"
[ "${BP_DEBUG}" = '1' ] && debug_message newline "curl ${curl_opts} -s -N \"https://gitlab.com/api/v4/projects/${namespace}%2F${repo}/releases/\"" "\n"
local apk_path="$(curl -A "${useragent}" -s -N "https://gitlab.com/api/v4/projects/${namespace}%2F${repo}/releases/" | jq -r '.[0].description' | grep ".apk" | cut -d "(" -f2 | cut -d ")" -f1)"
local apk_dest="${appsfolder[2]}/${2}/${3}"
local apk_url="https://gitlab.com/${1}${apk_path}"
download_apk_common "${apk_dest}" "${3}" "${apk_url}" gitlab
}

@ -125,7 +125,7 @@ grab_apps () {
grab_apk_from_github ${gh_AMAZE[@]}
# GitLab
grab_apk_from_gitlab ${gl_AURORAWARDEN[@]}
grab_aurora_apk_from_gitlab ${gl_AURORAWARDEN[@]}
}
update_apps () {
@ -155,7 +155,7 @@ update_master () {
[ "${update_act[0]}" = "1" ] && grab_microg
[ "${update_act[7]}" = "1" ] && grab_apk_from_repo ${fd_AURORADROID[@]}
[ "${update_act[8]}" = "1" ] && grab_apk_from_repo ${fd_AURORASTORE[@]}
[ "${update_act[9]}" = "1" ] && grab_apk_from_gitlab ${gl_AURORASERVICES[@]}
[ "${update_act[9]}" = "1" ] && grab_aurora_apk_from_gitlab ${gl_AURORASERVICES[@]}
[ "${update_act[5]}" = "1" ] && grab_apk_from_repo ${fd_FDROID[@]}
[ "${update_act[6]}" = "1" ] && grab_apk_from_repo ${fd_FDROID_PE[@]}
[ "${update_act[10]}" = "1" ] && grab_apk_from_repo ${nlx_PHONESKY[@]}

Loading…
Cancel
Save