From ae32ce07381ad88eb922268f07858d3c9886cda0 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sat, 24 May 2025 08:24:23 -0500 Subject: [PATCH] mohist: use https://api.mohistmc.com download API (#3464) --- scripts/start-deployMohist | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/scripts/start-deployMohist b/scripts/start-deployMohist index 85b301d8..68cb2b74 100755 --- a/scripts/start-deployMohist +++ b/scripts/start-deployMohist @@ -9,35 +9,34 @@ isDebugging && set -x resolveVersion : "${MOHIST_BUILD:=lastSuccessfulBuild}" -mohistBaseUrl="https://mohistmc.com/api/v2/projects/mohist/" -mohistApiUrl="${mohistBaseUrl}${VERSION}/builds/" +# Docs at https://mohistmc.com/mohistmc-api +mohistApiUrl="https://api.mohistmc.com/project/mohist" +mohistDownloadsPage="https://mohistmc.com/downloadSoftware?project=mohist" -function logMohistAvailableVerisons(){ - logError " check ${mohistBaseUrl} for available versions" - logError " and set VERSION accordingly" -} - -if ! get --exists "${mohistApiUrl}"; then +if ! get --exists "${mohistApiUrl}/${VERSION}/builds"; then logError "Mohist builds do not exist for ${VERSION}" - logMohistAvailableVerisons + logError " check ${mohistDownloadsPage} for available versions" + logError " and set VERSION accordingly" exit 1 fi if [[ "${MOHIST_BUILD}" == "lastSuccessfulBuild" ]]; then # Get the latest build number from the API - buildNumber=$( - get --json-path '$.builds[-1].number' "${mohistApiUrl}" - ) + if ! buildNumber=$( + get --json-path '$[0].id' "${mohistApiUrl}/${VERSION}/builds" + ); then + logError "failed to list Mohist builds for ${VERSION}" + exit 1 + fi MOHIST_BUILD="${buildNumber}" fi -downloadUrl=$( - get --json-path "$.builds[?(@.number==${MOHIST_BUILD})].url" "${mohistApiUrl}" -) +downloadUrl="${mohistApiUrl}/${VERSION}/builds/${MOHIST_BUILD}/download" if [[ -z "${downloadUrl}" ]]; then logError "Could not find build ${MOHIST_BUILD} for version ${VERSION}" - logMohistAvailableVerisons + logError " check ${mohistDownloadsPage} for available versions" + logError " and set VERSION accordingly" exit 1 fi