For Top Speed always try to get a valid download link.

This commit is contained in:
Storm Dragon
2026-04-14 00:12:51 -04:00
parent ae37f1a71f
commit 03e72a8263
2 changed files with 52 additions and 38 deletions

View File

@@ -1,6 +1,6 @@
# Linux Game Manager Core Map # Linux Game Manager Core Map
Last refreshed: 2026-04-12 Last refreshed: 2026-04-14
## Top-Level Structure ## Top-Level Structure
@@ -16,7 +16,7 @@ Last refreshed: 2026-04-12
- Installers: 42 (`.install/*.sh`) - Installers: 42 (`.install/*.sh`)
- Launcher definitions: 42 (`.launch/*.game`) - Launcher definitions: 42 (`.launch/*.game`)
- Launcher runnable entries: 30 (`.launch/*.sh`, both symlinks and files) - Launcher runnable entries: 31 (`.launch/*.sh`, both symlinks and files)
- Update scripts: 5 (`.update/*.sh`) - Update scripts: 5 (`.update/*.sh`)
Regenerate this snapshot with: Regenerate this snapshot with:
@@ -30,7 +30,8 @@ python3 .codex/skills/linux-game-manager-dev/scripts/audit_game_catalog.py
1. **Install flow** 1. **Install flow**
- `game_installer` builds menu from `.install/*.sh`. - `game_installer` builds menu from `.install/*.sh`.
- Selected installer is sourced in the current shell. - Selected installer is sourced in the current shell.
- Shared downloads try `curl` first, fall back to `wget` when available, and reject obvious HTML error pages for unknown file types. - Shared downloads try `curl` first, fall back to `wget` when available, validate archive payloads before install, and reject obvious HTML error pages for unknown file types.
- `download_named()` shares the same cache validation path as `download()`, so resolved asset URLs must still produce a valid payload for their file extension.
- If `.launch/<game>.game` exists and `.launch/<game>.sh` does not, the manager creates a symlink using the repository root, even if the installer changed directories. - If `.launch/<game>.game` exists and `.launch/<game>.sh` does not, the manager creates a symlink using the repository root, even if the installer changed directories.
2. **Launch flow** 2. **Launch flow**

View File

@@ -556,15 +556,29 @@ download() {
ui_msgbox "Linux Game Manager" "Linux Game Manager" "Could not download \"$i\"...\n\ndownload exit codes: ${downloadAttemptExitCodes}\nError details: ${downloadErrorLog}" ui_msgbox "Linux Game Manager" "Linux Game Manager" "Could not download \"$i\"...\n\ndownload exit codes: ${downloadAttemptExitCodes}\nError details: ${downloadErrorLog}"
exit 1 exit 1
fi; } | ui_progressbox "Linux Game Manager" "Downloading \"$dest\" from \"$i\"" fi; } | ui_progressbox "Linux Game Manager" "Downloading \"$dest\" from \"$i\""
validate_downloaded_cache_file "${dest}"
done
}
validate_downloaded_cache_file() {
local dest="$1"
local downloadError=0 local downloadError=0
case "${dest##*.}" in case "${dest##*.}" in
"pk3"|"zip") "pk3"|"zip")
if ! (
set -o pipefail
unzip -tq "${cache}/${dest}" | ui_progressbox "Linux Game Manager" "Validating ${dest##*.} file" unzip -tq "${cache}/${dest}" | ui_progressbox "Linux Game Manager" "Validating ${dest##*.} file"
downloadError=$? ); then
downloadError=1
fi
;; ;;
"7z") "7z")
if ! (
set -o pipefail
7z t "${cache}/${dest}" | ui_progressbox "Linux Game Manager" "Validating 7z file" 7z t "${cache}/${dest}" | ui_progressbox "Linux Game Manager" "Validating 7z file"
downloadError=$? ); then
downloadError=1
fi
;; ;;
"exe") "exe")
# Check if it's a valid Windows executable by looking at the MZ header # Check if it's a valid Windows executable by looking at the MZ header
@@ -578,7 +592,6 @@ download() {
fi fi
;; ;;
*) *)
# Add HTML check for other file types
if file -b "${cache}/${dest}" | grep -q "HTML document" ; then if file -b "${cache}/${dest}" | grep -q "HTML document" ; then
downloadError=1 downloadError=1
else else
@@ -586,12 +599,11 @@ download() {
fi fi
;; ;;
esac esac
if [[ $downloadError -ne 0 ]]; then if [[ ${downloadError} -ne 0 ]]; then
rm -fv "${cache}/${dest}" rm -fv "${cache}/${dest}"
alert "Linux Game Manager" "Linux Game Manager" "Error downloading \"${dest}\". Installation cannot continue." alert "Linux Game Manager" "Linux Game Manager" "Error downloading \"${dest}\". Installation cannot continue."
exit 1 exit 1
fi fi
done
} }
download_named() { download_named() {
@@ -614,6 +626,7 @@ download_named() {
ui_msgbox "Linux Game Manager" "Linux Game Manager" "Could not download \"$dest\"...\n\ndownload exit codes: ${downloadAttemptExitCodes}\nError details: ${downloadErrorLog}" ui_msgbox "Linux Game Manager" "Linux Game Manager" "Could not download \"$dest\"...\n\ndownload exit codes: ${downloadAttemptExitCodes}\nError details: ${downloadErrorLog}"
exit 1 exit 1
fi fi
validate_downloaded_cache_file "${dest}"
} }
get_installer() { get_installer() {