DOWNLOAD_LINKS_URL is now configurable and fallback to mc-bds-helper (#531)
This commit is contained in:
1 parent
2fa056e6e4
commit
95952cdac1
1 file changed
+22
-6
+22
-6
@@ -4,6 +4,8 @@ set -eo pipefail
|
|||||||
|
|
||||||
: "${DOWNLOAD_DIR:=${PWD}/.downloads}"
|
: "${DOWNLOAD_DIR:=${PWD}/.downloads}"
|
||||||
: "${PREVIEW:=false}"
|
: "${PREVIEW:=false}"
|
||||||
|
# Both net and net-secondary hostnames work
|
||||||
|
: "${DOWNLOAD_LINKS_URL:=https://net-secondary.web.minecraft-services.net/api/v1.0/download/links}"
|
||||||
|
|
||||||
function isTrue() {
|
function isTrue() {
|
||||||
[[ "${1,,}" =~ ^(true|on|1)$ ]] && return 0
|
[[ "${1,,}" =~ ^(true|on|1)$ ]] && return 0
|
||||||
@@ -25,8 +27,8 @@ function lookupVersion() {
|
|||||||
platform=${1:?Missing required platform indicator}
|
platform=${1:?Missing required platform indicator}
|
||||||
customVersion=${2:-}
|
customVersion=${2:-}
|
||||||
|
|
||||||
DOWNLOAD_URL=$(
|
if ! DOWNLOAD_URL=$(
|
||||||
curl -fsSL "${getUrlPage}" |
|
curl -fsSL "${DOWNLOAD_LINKS_URL}" |
|
||||||
jq --arg platform "$platform" -rR '
|
jq --arg platform "$platform" -rR '
|
||||||
try(fromjson) catch({}) |
|
try(fromjson) catch({}) |
|
||||||
.result.links // halt_error(1) |
|
.result.links // halt_error(1) |
|
||||||
@@ -45,7 +47,24 @@ function lookupVersion() {
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
'
|
'
|
||||||
)
|
); then
|
||||||
|
case "$platform" in
|
||||||
|
serverBedrockLinux)
|
||||||
|
type=latest
|
||||||
|
;;
|
||||||
|
serverBedrockPreviewLinux)
|
||||||
|
type=preview
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "ERROR invalid platform $platform"
|
||||||
|
exit 2
|
||||||
|
esac
|
||||||
|
|
||||||
|
if ! DOWNLOAD_URL=$(curl -fsSL "https://mc-bds-helper.vercel.app/api/$type"); then
|
||||||
|
echo "ERROR failed to lookup Bedrock version and download URL"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ -n "${customVersion}" && -n "${DOWNLOAD_URL}" ]]; then
|
if [[ -n "${customVersion}" && -n "${DOWNLOAD_URL}" ]]; then
|
||||||
DOWNLOAD_URL=$(replace_version_in_url "${DOWNLOAD_URL}" "${customVersion}")
|
DOWNLOAD_URL=$(replace_version_in_url "${DOWNLOAD_URL}" "${customVersion}")
|
||||||
@@ -73,9 +92,6 @@ fi
|
|||||||
|
|
||||||
export HOME="${PWD}"
|
export HOME="${PWD}"
|
||||||
|
|
||||||
# Looks like both net and net-secondary hostnames work
|
|
||||||
getUrlPage=https://net-secondary.web.minecraft-services.net/api/v1.0/download/links
|
|
||||||
|
|
||||||
if [[ ${EULA^^} != TRUE ]]; then
|
if [[ ${EULA^^} != TRUE ]]; then
|
||||||
echo
|
echo
|
||||||
echo "EULA must be set to TRUE to indicate agreement with the Minecraft End User License"
|
echo "EULA must be set to TRUE to indicate agreement with the Minecraft End User License"
|
||||||
|
|||||||
Reference in new issue
Block a user