mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-24 11:16:51 +00:00
tools/update-scan: set API timeout to 5 seconds
This commit is contained in:
parent
a239329685
commit
013261ccab
@ -23,7 +23,7 @@ test_github_api() {
|
||||
if [[ -n "${github_token}" || -n "${github_user}" ]]; then
|
||||
github_api_token="-u ${github_user}:${github_token}"
|
||||
# check if token works
|
||||
if curl -sL -I "${github_api_token}" https://api.github.com/user | grep -q -e "^[Ss]tatus: 200" -e "^HTTP/2 200"; then
|
||||
if curl -m 5 -sL -I "${github_api_token}" https://api.github.com/user | grep -q -e "^[Ss]tatus: 200" -e "^HTTP/2 200"; then
|
||||
echo "Github api usage activated"
|
||||
github_api="yes"
|
||||
else
|
||||
@ -58,7 +58,7 @@ check_for_update() {
|
||||
fi
|
||||
|
||||
# check if package exists at tracker
|
||||
RMO_API_RESPONSE=$(curl -sL "https://release-monitoring.org/api/project/LibreELEC/${PKG_NAME}" || true)
|
||||
RMO_API_RESPONSE=$(curl -m 5 -sL "https://release-monitoring.org/api/project/LibreELEC/${PKG_NAME}" || true)
|
||||
upstream_version=$(echo "${RMO_API_RESPONSE}" | jq -r '.version' || true)
|
||||
|
||||
# special handling based on release-monitoring formatting
|
||||
@ -77,14 +77,14 @@ check_for_update() {
|
||||
[[ "${github_api}" = "yes" ]]; then
|
||||
|
||||
github_repos=$(echo "${PKG_URL}" | grep -oP '(?<=https:\/\/github.com\/)?[0-9A-Za-z._-]+\/[0-9A-Za-z._-]+(?=/archive|/tags|/releases)')
|
||||
le_master_version_date="Commit date: $(curl -sL ${github_api_token} https://api.github.com/repos/${github_repos}/git/commits/${PKG_VERSION} | jq -r '.committer.date')"
|
||||
upstream_default_branch=$(curl -sL "${github_api_token}" "https://api.github.com/repos/${github_repos}" | jq -r '.default_branch')
|
||||
upstream_latest_commit=$(curl -sL "${github_api_token}" "https://api.github.com/repos/${github_repos}/git/refs/heads/${upstream_default_branch}" | jq -r '.object.url')
|
||||
upstream_latest_commit_date=$(curl -sL "${github_api_token}" "${upstream_latest_commit}" | jq -r '.committer.date')
|
||||
GH_API_TAG=$(curl -sL "${github_api_token}" "https://api.github.com/repos/${github_repos}/tags")
|
||||
le_master_version_date="Commit date: $(curl -m 5 -sL ${github_api_token} https://api.github.com/repos/${github_repos}/git/commits/${PKG_VERSION} | jq -r '.committer.date')"
|
||||
upstream_default_branch=$(curl -m 5 -sL "${github_api_token}" "https://api.github.com/repos/${github_repos}" | jq -r '.default_branch')
|
||||
upstream_latest_commit=$(curl -m 5 -sL "${github_api_token}" "https://api.github.com/repos/${github_repos}/git/refs/heads/${upstream_default_branch}" | jq -r '.object.url')
|
||||
upstream_latest_commit_date=$(curl -m 5 -sL "${github_api_token}" "${upstream_latest_commit}" | jq -r '.committer.date')
|
||||
GH_API_TAG=$(curl -m 5 -sL "${github_api_token}" "https://api.github.com/repos/${github_repos}/tags")
|
||||
upstream_latest_tag=$(echo "${GH_API_TAG}" | jq -r '.[0].name')
|
||||
upstream_latest_tag_url=$(echo "${GH_API_TAG}" | jq -r '.[0].commit.url')
|
||||
upstream_latest_tag_date=$(curl -sL "${github_api_token}" "${upstream_latest_tag_url}" | jq -r '.commit.committer.date')
|
||||
upstream_latest_tag_date=$(curl -m 5 -sL "${github_api_token}" "${upstream_latest_tag_url}" | jq -r '.commit.committer.date')
|
||||
|
||||
# compare upstream with local version
|
||||
if [ "${PKG_VERSION}" != "${upstream_latest_commit##*/}" ]; then
|
||||
|
Loading…
x
Reference in New Issue
Block a user