diff --git a/services/wolf.sh b/services/wolf.sh index 2db65fb..2e7c322 100644 --- a/services/wolf.sh +++ b/services/wolf.sh @@ -2024,8 +2024,27 @@ _cache_ge_proton() { url="https://github.com/GloriousEggroll/proton-ge-custom/releases/download/$version/$version.tar.gz" else echo "Fetching latest GE-Proton release info..." + # A plain grep+cut over the raw JSON used to break outright once a + # release started shipping more than one .tar.gz-suffixed asset (a + # second architecture build, a differently-named tarball, etc.) — + # grep then returns more than one line, and $(...) glues them + # together with an embedded newline instead of picking just one, + # which curl rejects outright ("URL rejected: Malformed input to a + # URL function") rather than a clean single URL. Parse the JSON for + # real instead of pattern-matching the raw text. url=$(curl -sL https://api.github.com/repos/GloriousEggroll/proton-ge-custom/releases/latest \ - | grep browser_download_url | grep '\.tar\.gz' | cut -d'"' -f4) + | python3 -c ' +import sys, json +try: + release = json.load(sys.stdin) +except Exception: + print("") + raise SystemExit +assets = [a for a in release.get("assets", []) if a.get("name", "").endswith(".tar.gz")] +x64 = [a for a in assets if "x86_64" in a.get("name", "")] +pick = x64 or assets +print(pick[0]["browser_download_url"] if pick else "") +' 2>/dev/null) if [ -z "$url" ]; then echo "Could not determine GE-Proton download URL (GitHub rate-limited or offline?)." return 1 @@ -3143,8 +3162,23 @@ PYEOF echo "Using pre-downloaded GE-Proton: $NAME" else echo "Fetching latest GE-Proton release info..." + # See _cache_ge_proton()'s own comment above for why this parses + # the JSON for real instead of grep+cut over the raw text — + # more than one matching .tar.gz asset used to glue into one + # multi-line, curl-rejected "Malformed input to a URL function". URL=$(curl -sL https://api.github.com/repos/GloriousEggroll/proton-ge-custom/releases/latest \ - | grep browser_download_url | grep '\.tar\.gz' | cut -d'"' -f4) + | python3 -c ' +import sys, json +try: + release = json.load(sys.stdin) +except Exception: + print("") + raise SystemExit +assets = [a for a in release.get("assets", []) if a.get("name", "").endswith(".tar.gz")] +x64 = [a for a in assets if "x86_64" in a.get("name", "")] +pick = x64 or assets +print(pick[0]["browser_download_url"] if pick else "") +' 2>/dev/null) if [ -z "$URL" ]; then echo "Could not determine GE-Proton download URL (GitHub rate-limited or offline?)." exit 1 @@ -6175,8 +6209,23 @@ MD ( CACHE_DIR="$WOLF_DIR/ge-proton-cache" mkdir -p "$CACHE_DIR" + # See the matching comment on manage.sh's own ge-proton command for + # why this parses the JSON for real instead of grep+cut over the raw + # text — more than one matching .tar.gz asset used to glue into one + # multi-line, curl-rejected "Malformed input to a URL function". URL=$(curl -sL https://api.github.com/repos/GloriousEggroll/proton-ge-custom/releases/latest \ - | grep browser_download_url | grep '\.tar\.gz' | cut -d'"' -f4) + | python3 -c ' +import sys, json +try: + release = json.load(sys.stdin) +except Exception: + print("") + raise SystemExit +assets = [a for a in release.get("assets", []) if a.get("name", "").endswith(".tar.gz")] +x64 = [a for a in assets if "x86_64" in a.get("name", "")] +pick = x64 or assets +print(pick[0]["browser_download_url"] if pick else "") +' 2>/dev/null) if [ -z "$URL" ]; then log_warning "Could not fetch GE-Proton URL — run './manage.sh ge-proton' later." else