mirror of
https://github.com/billz/raspap-webgui.git
synced 2025-03-01 10:31:47 +00:00
Update _get_release() w/ API rate limit and undefined release var check
This commit is contained in:
parent
18114df2bd
commit
a9804b2f9c
@ -235,7 +235,21 @@ function _display_welcome() {
|
|||||||
|
|
||||||
# Fetch latest release from GitHub or RaspAP Installer API
|
# Fetch latest release from GitHub or RaspAP Installer API
|
||||||
function _get_release() {
|
function _get_release() {
|
||||||
readonly RASPAP_LATEST=$(curl -s "https://api.github.com/repos/$repo/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")' )
|
local response
|
||||||
|
local host="api.github.com"
|
||||||
|
response=$(curl -s "https://$host/repos/$repo/releases/latest")
|
||||||
|
|
||||||
|
if echo "$response" | grep -q '"API rate limit exceeded"'; then
|
||||||
|
_install_status 1 "GitHub API rate limit exceeded. Try again later or use a GitHub token."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
readonly RASPAP_LATEST=$(echo "$response" | grep -Po '"tag_name": "\K.*?(?=")')
|
||||||
|
|
||||||
|
if [ -z "$RASPAP_LATEST" ]; then
|
||||||
|
_install_status 1 "Failed to fetch latest release. Check network connectivity."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$insiders" == 1 ]; then
|
if [ "$insiders" == 1 ]; then
|
||||||
repo="RaspAP/raspap-insiders"
|
repo="RaspAP/raspap-insiders"
|
||||||
repo_common="RaspAP/raspap-webgui"
|
repo_common="RaspAP/raspap-webgui"
|
||||||
@ -273,6 +287,7 @@ function _install_status() {
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Checks connectivity to github.com
|
||||||
function _check_internet() {
|
function _check_internet() {
|
||||||
component="Install"
|
component="Install"
|
||||||
_install_log "Checking internet connectivity..."
|
_install_log "Checking internet connectivity..."
|
||||||
|
Loading…
x
Reference in New Issue
Block a user