From d0d92996a3340c9526abc895df23f957fc7a70b2 Mon Sep 17 00:00:00 2001 From: Doc Date: Sun, 22 May 2022 00:21:59 -0400 Subject: [PATCH] Update download API for Magma --- game_eggs/minecraft/java/magma/egg-magma.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/game_eggs/minecraft/java/magma/egg-magma.json b/game_eggs/minecraft/java/magma/egg-magma.json index 49e63930..9be55697 100644 --- a/game_eggs/minecraft/java/magma/egg-magma.json +++ b/game_eggs/minecraft/java/magma/egg-magma.json @@ -4,7 +4,7 @@ "version": "PTDL_v1", "update_url": null }, - "exported_at": "2022-01-11T09:07:47-05:00", + "exported_at": "2022-05-22T00:20:47-04:00", "name": "Magma", "author": "support@pterodactyl.io", "description": "Magma is most powerful Forge server providing you with Forge mods and Bukkit Plugins using Spigot and Paper for Performance Optimization and Stability.", @@ -28,7 +28,7 @@ }, "scripts": { "installation": { - "script": "apt update\r\napt install -y curl jq\r\n\r\nif [[ ! -d \/mnt\/server ]]; then\r\n mkdir \/mnt\/server\r\nfi\r\n\r\ncd \/mnt\/server\/\r\n\r\n# get release info and download links\r\nLATEST_JSON=$(curl --silent \"https:\/\/api.magmafoundation.org\/api\/resources\/magma\/1.16.5\/${BRANCH}\/latest\")\r\nOLD_JSON=$(curl --silent \"https:\/\/api.magmafoundation.org\/api\/resources\/magma\/1.12\/${BRANCH}\/latest\")\r\n\r\nif [[ -z \"${MC_VERSION}\" ]] || [[ \"${MC_VERSION}\" == \"latest\" ]]; then\r\n echo -e \"Version not set. Defaulting to latest\"\r\n DOWNLOAD_LINK=$(echo ${LATEST_JSON} | jq .assets | jq -r .[].browser_download_url | grep -i installer.jar)\r\n\r\nelif [[ $MC_VERSION =~ ^1\\.(16|17|18|19|20|21|22|23) ]]; then\r\n CUSTOM_JSON=$(curl --silent \"https:\/\/api.magmafoundation.org\/api\/resources\/magma\/${MC_VERSION}\/${BRANCH}\/latest\")\r\n DOWNLOAD_LINK=$(echo ${CUSTOM_JSON} | jq .assets | jq -r .[].browser_download_url | grep -i installer.jar)\r\nelif [[ \"${MC_VERSION}\" == \"1.12\" ]]; then\r\n CUSTOM_JSON=$(curl --silent \"https:\/\/api.magmafoundation.org\/api\/resources\/magma\/1.12\/${BRANCH}\/latest\")\r\n DOWNLOAD_LINK=$(echo ${OLD_JSON} | jq .assets | jq -r .[].browser_download_url | grep -i server.jar)\r\nelse\r\n # Try to locate version by exact tag name. This will most likely always fail, because the tag names are in a weird format. Leaving it here just in case someone wants to fetch exact tag releases.\r\n VERSION_CHECK=$(echo ${OLD_JSON} | jq -r --arg MC_VERSION \"${MC_VERSION}\" '.[] | select(.tag_name==$MC_VERSION) | .tag_name')\r\n if [[ \"${MC_VERSION}\" == \"${VERSION_CHECK}\" ]]; then\r\n DOWNLOAD_LINK=$(echo ${OLD_JSON} | jq -r --arg MC_VERSION \"${MC_VERSION}\" '.[] | select(.tag_name==$MC_VERSION) | .assets[].browser_download_url' | grep -i installer.jar)\r\n else\r\n echo -e \"Specified ${MC_VERSION} version not found. Defaulting to latest\"\r\n DOWNLOAD_LINK=$(echo ${LATEST_JSON} | jq .assets | jq -r .[].browser_download_url)\r\n fi\r\nfi\r\n\r\n# validate download link\r\nif [ ! -z \"${DOWNLOAD_LINK}\" ]; then\r\n echo -e \"Validating downlaod link\"\r\n if curl --output \/dev\/null --silent --head --fail ${DOWNLOAD_LINK}; then\r\n echo -e \"link is valid. setting download link to ${DOWNLOAD_LINK}\"\r\n DOWNLOAD_LINK=${DOWNLOAD_LINK}\r\n else\r\n echo -e \"Download URL ${DOWNLOAD_LINK} is invalid. Terminating install.\"\r\n exit 2\r\n fi\r\nfi\r\n\r\nfunction downloadMagma {\r\n echo -e \"running: curl -sSL -o installer.jar ${DOWNLOAD_LINK}\"\r\n curl -sSL -o installer.jar -sSL ${DOWNLOAD_LINK}\r\n}\r\n\r\nif [[ $MC_VERSION =~ ^1\\.(16|17|18|19|20|21|22|23) ]] || [[ -z \"${MC_VERSION}\" ]] || [[ \"${MC_VERSION}\" == \"latest\" ]] ; then\r\n downloadMagma\r\n echo -e \"1.16.5 or newer version detected. Running installer\"\r\n java -jar installer.jar --installServer || { echo -e \"install failed\" exit 4; }\r\n mv forge-*.jar $SERVER_JARFILE\r\n echo -e \"Deleting installer.jar file.\\n\"\r\n rm -rf *installer.jar\r\nelse\r\n downloadMagma\r\n echo -e \"Older magma version detected. Skipping installer\"\r\n mv installer.jar $SERVER_JARFILE\r\nfi\r\n\r\necho -e \"Install Complete\"", + "script": "apt update\r\napt install -y curl jq\r\n\r\nif [[ ! -d \/mnt\/server ]]; then\r\n mkdir \/mnt\/server\r\nfi\r\n\r\ncd \/mnt\/server\/\r\n\r\n# get release info and download links\r\nLATEST_JSON=$(curl --silent \"https:\/\/api.magmafoundation.org\/api\/v2\/1.16.5\/latest\")\r\n\r\nif [[ -z \"${TAG_VERSION}\" ]]; then\r\n TAG_VERSION = \"latest\"\r\nfi\r\n\r\nif [[ -z \"${MC_VERSION}\" ]] || [[ \"${MC_VERSION}\" == \"latest\" ]]; then\r\n echo -e \"Version not set. Defaulting to latest\"\r\n DOWNLOAD_LINK=$(echo ${LATEST_JSON} | jq -r .link | grep -i installer.jar)\r\nelif [[ $MC_VERSION =~ ^1\\.(16|17|18|19|20|21|22|23) ]]; then\r\n CUSTOM_JSON=$(curl --silent \"https:\/\/api.magmafoundation.org\/api\/v2\/${MC_VERSION}\/${TAG_VERSION}\")\r\n DOWNLOAD_LINK=$(echo ${CUSTOM_JSON} | jq -r .link | grep -i installer.jar)\r\nelif [[ \"${MC_VERSION}\" == \"1.12\" ]]; then\r\n CUSTOM_JSON=$(curl --silent \"https:\/\/api.magmafoundation.org\/api\/v2\/1.12\/${TAG_VERSION}\")\r\n DOWNLOAD_LINK=$(echo ${CUSTOM_JSON} | jq -r .link | grep -i server.jar)\r\nelse\r\n echo -e \"Specified ${MC_VERSION} version not found. Defaulting to latest\"\r\n DOWNLOAD_LINK=$(echo ${LATEST_JSON} | jq .link)\r\nfi\r\n\r\n# validate download link\r\nif [ ! -z \"${DOWNLOAD_LINK}\" ]; then\r\n echo -e \"Validating download link\"\r\n if curl --output \/dev\/null --silent --head --fail ${DOWNLOAD_LINK}; then\r\n echo -e \"link is valid. setting download link to ${DOWNLOAD_LINK}\"\r\n DOWNLOAD_LINK=${DOWNLOAD_LINK}\r\n else\r\n echo -e \"Download URL ${DOWNLOAD_LINK} is invalid. Terminating install.\"\r\n exit 2\r\n fi\r\nfi\r\n\r\nfunction downloadMagma {\r\n echo -e \"running: curl -sSL -o installer.jar ${DOWNLOAD_LINK}\"\r\n curl -sSL -o installer.jar -sSL ${DOWNLOAD_LINK}\r\n}\r\n\r\nif [[ $MC_VERSION =~ ^1\\.(16|17|18|19|20|21|22|23) ]] || [[ -z \"${MC_VERSION}\" ]] || [[ \"${MC_VERSION}\" == \"latest\" ]] ; then\r\n downloadMagma\r\n echo -e \"1.16.5 or newer version detected. Running installer\"\r\n java -jar installer.jar --installServer || { echo -e \"install failed\" exit 4; }\r\n mv forge-*.jar $SERVER_JARFILE\r\n echo -e \"Deleting installer.jar file.\\n\"\r\n rm -rf *installer.jar\r\nelse\r\n downloadMagma\r\n echo -e \"Older magma version detected. Skipping installer\"\r\n mv installer.jar $SERVER_JARFILE\r\nfi\r\n\r\necho -e \"Install Complete\"", "container": "openjdk:8-jdk-slim", "entrypoint": "bash" } @@ -53,13 +53,13 @@ "rules": "nullable|string|max:20" }, { - "name": "Branch [dev or stable]", - "description": "Branch to install. Valid options: dev or stable", - "env_variable": "BRANCH", - "default_value": "dev", + "name": "Tag Version", + "description": "Optional.\r\n\r\nSpecify the tag version to install. Leave empty or set latest to install latest", + "env_variable": "TAG_VERSION", + "default_value": "latest", "user_viewable": true, "user_editable": true, - "rules": "required|string|in:dev,stable" + "rules": "nullable|string|max:20" } ] -} +} \ No newline at end of file