Use Stormux IPFS gateway for game downloads
This commit is contained in:
@@ -29,36 +29,40 @@ download_with_fallback() {
|
||||
totalBytes="$(get_remote_file_size "${sourceUrl}")"
|
||||
|
||||
printf 'Trying curl with resume support: %s\n' "${sourceUrl}" >&2
|
||||
if run_download_command "${outputPath}" "${totalBytes}" "${errorFile}" curl -4 -C - "${curlArgs[@]}" --output "${outputPath}" "${sourceUrl}"; then
|
||||
run_download_command "${outputPath}" "${totalBytes}" "${errorFile}" curl -4 -C - "${curlArgs[@]}" --output "${outputPath}" "${sourceUrl}"
|
||||
curlExitCode=$?
|
||||
if [[ "${curlExitCode}" -eq 0 ]]; then
|
||||
rm -f "${errorFile}"
|
||||
return 0
|
||||
fi
|
||||
curlExitCode=$?
|
||||
|
||||
rm -f "${outputPath}"
|
||||
printf 'Trying fresh IPv4 curl download: %s\n' "${sourceUrl}" >&2
|
||||
if run_download_command "${outputPath}" "${totalBytes}" "${errorFile}" curl -4 "${curlArgs[@]}" --output "${outputPath}" "${sourceUrl}"; then
|
||||
run_download_command "${outputPath}" "${totalBytes}" "${errorFile}" curl -4 "${curlArgs[@]}" --output "${outputPath}" "${sourceUrl}"
|
||||
retryExitCode=$?
|
||||
if [[ "${retryExitCode}" -eq 0 ]]; then
|
||||
rm -f "${errorFile}"
|
||||
return 0
|
||||
fi
|
||||
retryExitCode=$?
|
||||
|
||||
rm -f "${outputPath}"
|
||||
printf 'Trying fresh curl download with any address family: %s\n' "${sourceUrl}" >&2
|
||||
if run_download_command "${outputPath}" "${totalBytes}" "${errorFile}" curl "${curlArgs[@]}" --output "${outputPath}" "${sourceUrl}"; then
|
||||
run_download_command "${outputPath}" "${totalBytes}" "${errorFile}" curl "${curlArgs[@]}" --output "${outputPath}" "${sourceUrl}"
|
||||
fallbackExitCode=$?
|
||||
if [[ "${fallbackExitCode}" -eq 0 ]]; then
|
||||
rm -f "${errorFile}"
|
||||
return 0
|
||||
fi
|
||||
fallbackExitCode=$?
|
||||
|
||||
if command -v wget > /dev/null 2>&1; then
|
||||
rm -f "${outputPath}"
|
||||
printf 'Trying wget fallback: %s\n' "${sourceUrl}" >&2
|
||||
if run_download_command "${outputPath}" "${totalBytes}" "${errorFile}" wget --tries=3 --timeout=20 --read-timeout=30 --output-document="${outputPath}" "${sourceUrl}"; then
|
||||
run_download_command "${outputPath}" "${totalBytes}" "${errorFile}" wget --tries=3 --timeout=20 --read-timeout=30 --output-document="${outputPath}" "${sourceUrl}"
|
||||
wgetExitCode=$?
|
||||
if [[ "${wgetExitCode}" -eq 0 ]]; then
|
||||
rm -f "${errorFile}"
|
||||
return 0
|
||||
fi
|
||||
wgetExitCode=$?
|
||||
fi
|
||||
|
||||
downloadAttemptExitCodes="curl: ${curlExitCode}, ${retryExitCode}, ${fallbackExitCode}"
|
||||
|
||||
@@ -19,7 +19,7 @@ installPath="${installPath:-${HOME}/.local/games}"
|
||||
cache="${cache:-${XDG_CACHE_HOME:-${HOME}/.cache}/stormux-game-install}"
|
||||
launchRoot="${launchRoot:-${HOME}/.local/.launch}"
|
||||
redownload="${redownload:-false}"
|
||||
ipfsGateway="${ipfsGateway:-https://gateway.pinata.cloud}"
|
||||
ipfsGateway="${ipfsGateway:-https://ipfs.stormux.org}"
|
||||
fex="${fex:-}"
|
||||
|
||||
export installPath cache launchRoot redownload ipfsGateway fex gameName
|
||||
|
||||
Reference in New Issue
Block a user