fix: migrate PaperMC to v3 API, fix NeoForge beta fallback, add test suite
- Migrate Paper loader from sunset v2 API to v3 (fill.papermc.io) - Fix NeoForge: fall back to beta versions when no stable exists (set -e + grep) - Fix setEula/setperms ordering (was writing eula.txt before /data was writable) - Fix setEula/serverInfoWrite to use absolute paths (/data/server/) - Add VOLUME directive removal (was shadowing bind mounts) - Add comprehensive API test suite (110 tests across 6 suites) - Move test.sh to tests/integration.sh, switch to named volumes - Add Docker build cache to CI workflows - Add .editorconfig, expand .gitignore, improve README docs
This commit is contained in:
@@ -5,29 +5,37 @@ _bedrockDownload() {
|
||||
local platform="$1"
|
||||
local version="${2:-}"
|
||||
|
||||
log "Fetching Bedrock download URL (platform: ${platform})..."
|
||||
local DL_URL
|
||||
DL_URL=$(curl -sL -A "Mozilla/5.0 (X11; Linux x86_64)" "$BEDROCK_API_URL" | jq -r '.result.links[] | select(.downloadType == "'"$platform"'") | .downloadUrl // empty')
|
||||
DL_URL=$(curl -sL -A "Mozilla/5.0 (X11; Linux x86_64)" --connect-timeout 10 --max-time 30 \
|
||||
"$BEDROCK_API_URL" |
|
||||
jq -r ".result.links[] | select(.downloadType == \"${platform}\") | .downloadUrl // empty")
|
||||
|
||||
if [[ -z "$DL_URL" ]]; then
|
||||
DL_URL=$(curl -sL -A "Mozilla/5.0 (X11; Linux x86_64)" "$BEDROCK_FALLBACK_URL" |
|
||||
warn "Primary API failed, trying fallback source..."
|
||||
DL_URL=$(curl -sL -A "Mozilla/5.0 (X11; Linux x86_64)" --connect-timeout 10 --max-time 30 \
|
||||
"$BEDROCK_FALLBACK_URL" |
|
||||
jq --arg type "$( [[ "$platform" == *Preview* ]] && echo preview || echo release )" -r '
|
||||
.[$type] | to_entries | sort_by(.key | split(".") | map(tonumber)) | last | .value.linux.url // empty
|
||||
')
|
||||
fi
|
||||
|
||||
if [[ -z "$DL_URL" ]]; then
|
||||
echo "Failed to look up Bedrock download URL"
|
||||
crash
|
||||
die "Failed to look up Bedrock download URL"
|
||||
fi
|
||||
|
||||
if [[ -n "$version" ]]; then
|
||||
DL_URL=$(echo "$DL_URL" | sed -E "s/(bedrock-server-)[^/]+(\.zip)/\1${version}\2/")
|
||||
fi
|
||||
|
||||
local VER
|
||||
VER=$(echo "$DL_URL" | grep -oP 'bedrock-server-\K[\d.]+(?=\.zip)')
|
||||
echo "$DL_URL"
|
||||
curl -o bedrock-server.zip -L -A "Mozilla/5.0 (X11; Linux x86_64)" "$DL_URL"
|
||||
log "Downloading Bedrock server version ${VER}..."
|
||||
curl -fL -o bedrock-server.zip -A "Mozilla/5.0 (X11; Linux x86_64)" "$DL_URL"
|
||||
unzip -o bedrock-server.zip
|
||||
rm -f bedrock-server.zip
|
||||
chmod +x bedrock_server
|
||||
log "Bedrock ${VER} downloaded."
|
||||
}
|
||||
|
||||
getBedrock() {
|
||||
|
||||
Reference in New Issue
Block a user