@@ -4,6 +4,8 @@ set -eo pipefail
4
4
5
5
: " ${DOWNLOAD_DIR:= ${PWD} / .downloads} "
6
6
: " ${PREVIEW:= false} "
7
+ # Both net and net-secondary hostnames work
8
+ : " ${DOWNLOAD_LINKS_URL:= https:// net-secondary.web.minecraft-services.net/ api/ v1.0/ download/ links} "
7
9
8
10
function isTrue() {
9
11
[[ " ${1,,} " =~ ^(true| on| 1)$ ]] && return 0
@@ -25,8 +27,8 @@ function lookupVersion() {
25
27
platform=${1:? Missing required platform indicator}
26
28
customVersion=${2:- }
27
29
28
- DOWNLOAD_URL=$(
29
- curl -fsSL " ${getUrlPage } " |
30
+ if ! DOWNLOAD_URL=$(
31
+ curl -fsSL " ${DOWNLOAD_LINKS_URL } " |
30
32
jq --arg platform " $platform " -rR '
31
33
try(fromjson) catch({}) |
32
34
.result.links // halt_error(1) |
@@ -45,7 +47,24 @@ function lookupVersion() {
45
47
)
46
48
end
47
49
'
48
- )
50
+ ) ; then
51
+ case " $platform " in
52
+ serverBedrockLinux)
53
+ type=latest
54
+ ;;
55
+ serverBedrockPreviewLinux)
56
+ type=preview
57
+ ;;
58
+ * )
59
+ echo " ERROR invalid platform $platform "
60
+ exit 2
61
+ esac
62
+
63
+ if ! DOWNLOAD_URL=$( curl -fsSL " https://mc-bds-helper.vercel.app/api/$type " ) ; then
64
+ echo " ERROR failed to lookup Bedrock version and download URL"
65
+ exit 1
66
+ fi
67
+ fi
49
68
50
69
if [[ -n " ${customVersion} " && -n " ${DOWNLOAD_URL} " ]]; then
51
70
DOWNLOAD_URL=$( replace_version_in_url " ${DOWNLOAD_URL} " " ${customVersion} " )
73
92
74
93
export HOME=" ${PWD} "
75
94
76
- # Looks like both net and net-secondary hostnames work
77
- getUrlPage=https://net-secondary.web.minecraft-services.net/api/v1.0/download/links
78
-
79
95
if [[ ${EULA^^} != TRUE ]]; then
80
96
echo
81
97
echo " EULA must be set to TRUE to indicate agreement with the Minecraft End User License"
0 commit comments