From 0a4fb63e5ed264edc87a5004990a018467418ca6 Mon Sep 17 00:00:00 2001 From: Mitsunee Date: Wed, 3 Jul 2019 18:48:16 +0200 Subject: [PATCH 1/3] Update README.md added library versions to help people who want to mess around with the source as well as making the instructions more clear and compliant with the changes I'm making. --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f8e5f60..a563b29 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ **Curse Modpack Downloader** -Downloads modpacks from curse, given a URL. Experimental. Requires gson and zip4j. +Downloads modpacks from curse, given a URL and Curse File ID. Experimental. Requires gson (2.8.x) and zip4j (1.3.2). Licensed under the [WTFPL](http://www.wtfpl.net/). Have fun. @@ -10,7 +10,7 @@ Licensed under the [WTFPL](http://www.wtfpl.net/). Have fun. * Download CMPDL on the [Releases](https://github.com/Vazkii/CMPDL/releases) page. Run it. * Find the pack you want. We'll use [Proton](https://minecraft.curseforge.com/projects/proton) as an example. - * Copy the URL of the project home on CurseForge. It should look like the one on the last point. Paste this URL on the "Modpack URL" field on CMPDL. (you can also choose a local modpack file) - * To specify a version of the modpack, enter that version in the "Curse File ID" field + * Copy the URL of the project home on CurseForge. It should look like the one on the last point. Paste this URL on the "Modpack URL" field on CMPDL. (you can also choose a local modpack zip file) + * Specify a version of the modpack, enter that version in the "Curse File ID" field. You can find the ID at the end of the urls under "Recent Files" in the sidebar on the project page or in the project's "Files" tab. * Press Download and wait. * Copy your modpack files over to wherever you want them. From 3964d5170e375e7bb2b69791132c9b2878484f95 Mon Sep 17 00:00:00 2001 From: Mitsunee Date: Wed, 3 Jul 2019 18:52:12 +0200 Subject: [PATCH 2/3] Fix curseforge urls and added warning about latest Adjusted the urls to follow curseforge's changes. I couldn't figure out how to get the latest version so I added an explanation similar to the one for FTB packs. This should make the program, while not as convenient as just copying one url, functional again. --- src/vazkii/cmpdl/CMPDL.java | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/vazkii/cmpdl/CMPDL.java b/src/vazkii/cmpdl/CMPDL.java index 1811b13..5787d92 100644 --- a/src/vazkii/cmpdl/CMPDL.java +++ b/src/vazkii/cmpdl/CMPDL.java @@ -55,7 +55,7 @@ public static void downloadFromURL(String url, String version) throws Exception if(downloading) return; - if(url.contains("feed-the-beast.com") && version.equals("latest")) { + if(url.contains("feed-the-beast.com") && (version.equals("latest") || version == null || version.isEmpty())) { log("WARNING: For modpacks hosted in the FTB site, you need to provide a version, \"latest\" will not work!"); log("To find the version number to insert in the Curse File ID field, click the latest file on the sidebar on the right of the modpack's page."); log("The number you need to input is the number at the end of the URL."); @@ -65,6 +65,16 @@ public static void downloadFromURL(String url, String version) throws Exception return; } + if(url.contains("curseforge.com") && (version.equals("latest") || version == null || version.isEmpty())) { + log("WARNING: packversion \"latest\" is currently unsupported as curseforge have changed their url format."); + log("To find the version number to insert in the Curse File ID field, check the url of the file on the modpack's \"files\" page."); + log("The number you need to input is the number at the end of the URL."); + log("For example, if you wanted to download https://www.curseforge.com/minecraft/modpacks/crucial/files/2732998"); + log("Then you would use 2732998 as the Curse File ID. Do not change the Modpack URL. Change that and click Download again to continue."); + Interface.setStatus("Awaiting Further Input"); + return; + } + missingMods = new ArrayList(); downloading = true; log("~ Starting magical modpack download sequence ~"); @@ -77,14 +87,9 @@ public static void downloadFromURL(String url, String version) throws Exception packUrl = packUrl.replaceAll(".$", ""); String packVersion = version; - if(version == null || version.isEmpty()) - packVersion = "latest"; String fileUrl; - if (packVersion.equals("latest")) - fileUrl = packUrl + "/files/latest"; - else - fileUrl = packUrl + "/files/" + packVersion + "/download"; + fileUrl = packUrl + "/download/" + packVersion + "/file"; String finalUrl = getLocationHeader(fileUrl); log("File URL: " + fileUrl); @@ -341,7 +346,7 @@ public static void downloadFile(Manifest.FileData file, File modsDir, int remain String projectUrl = getLocationHeader(baseUrl); projectUrl = projectUrl.replaceAll("\\?cookieTest=1", ""); - String fileDlUrl = projectUrl + "/files/" + file.fileID + "/download"; + String fileDlUrl = projectUrl + "/download/" + file.fileID + "/file"; log("File download URL is " + fileDlUrl); String finalUrl = getLocationHeader(fileDlUrl); From cc3c6873665934e7aba07d6ca4985ad0be3790fd Mon Sep 17 00:00:00 2001 From: Mitsunee Date: Wed, 3 Jul 2019 18:53:25 +0200 Subject: [PATCH 3/3] Remove "latest" text from Curse File ID field temporary change until using "latest" as the File ID works again. --- src/vazkii/cmpdl/Interface.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vazkii/cmpdl/Interface.java b/src/vazkii/cmpdl/Interface.java index abcec91..8eeaba9 100644 --- a/src/vazkii/cmpdl/Interface.java +++ b/src/vazkii/cmpdl/Interface.java @@ -135,7 +135,7 @@ public Frame() { urlLabel = new JLabel("Modpack URL :"); urlField = new JTextField("", 54); versionLabel = new JLabel("Curse File ID :"); - versionField = new JTextField("latest", 20); + versionField = new JTextField("", 20); logArea = new JTextArea(34, 68); logArea.setBackground(Color.WHITE);