Skip to content

Commit f6dcda1

Browse files
authored
Switch to json metadata provided by kittizz/bedrock-server-downloads (#638)
1 parent fa02824 commit f6dcda1

1 file changed

Lines changed: 30 additions & 1 deletion

File tree

bedrock-entry.sh

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ set -eo pipefail
44

55
: "${DOWNLOAD_DIR:=${PWD}/.downloads}"
66
: "${PREVIEW:=false}"
7+
: "${PROCESSED_DOWNLOAD_LINKS_URL:=https://raw.githubusercontent.com/kittizz/bedrock-server-downloads/refs/heads/main/bedrock-server-downloads.json}"
78
: "${DOWNLOAD_LINKS_URL:=https://net.web.minecraft-services.net/api/v1.0/download/links}"
8-
: "${DOWNLOAD_SECONDARY_LINKS_URL:=https://net-secondary.web.minecraft-services.net/api/v1.0/download/links}"
9+
: "${DOWNLOAD_SECONDARY_LINKS_URL:=https://net.web.minecraft-services.net/api/v1.0/download/links}"
910
: "${RESOLVE_XUID_API_URL:=https://mcprofile.io/api/v1/bedrock/gamertag}"
1011
: "${USE_BOX64:=true}"
1112
: "${DEBUG_CURL:=false}"
@@ -81,6 +82,34 @@ function versionFromExisting() {
8182
function lookupDownloadUrl() {
8283
platform=${1:?Missing required platform indicator}
8384

85+
# Map entry script platform arguments to the tracker's top-level keys
86+
if [[ "$platform" == "serverBedrockPreviewLinux" ]]; then
87+
local type="preview"
88+
else
89+
local type="release"
90+
fi
91+
92+
if downloadUrl=$(curl "${debugCurlArgs[@]}" -fsSL "${PROCESSED_DOWNLOAD_LINKS_URL}" | \
93+
jq --arg type "$type" -r '
94+
.[$type]
95+
| to_entries
96+
| sort_by(.key | split(".") | map(tonumber))
97+
| last
98+
| .value.linux.url // empty
99+
' 2>/dev/null
100+
); then
101+
if [[ -n "$downloadUrl" && "$downloadUrl" != "null" ]]; then
102+
echo "$downloadUrl"
103+
return 0
104+
fi
105+
fi
106+
107+
return 1
108+
}
109+
110+
function lookupDownloadUrlFromMinecraftServices() {
111+
platform=${1:?Missing required platform indicator}
112+
84113
for url in "$DOWNLOAD_LINKS_URL" "$DOWNLOAD_SECONDARY_LINKS_URL"; do
85114
if downloadUrl=$(
86115
curl "${debugCurlArgs[@]}" -fsSL "${url}" |

0 commit comments

Comments
 (0)