diff options
author | Petr Mrázek <peterix@gmail.com> | 2020-07-18 16:18:02 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2020-07-18 16:22:05 +0200 |
commit | e7f373496ed51d30d87eb1b75410d4f02f0412ec (patch) | |
tree | db040fd29b1a95968324ef0b52fbc48d228d9f25 /api/logic/minecraft | |
parent | 3158082b16009907e1abed0308498d10788f0f42 (diff) | |
download | PrismLauncher-e7f373496ed51d30d87eb1b75410d4f02f0412ec.tar.gz PrismLauncher-e7f373496ed51d30d87eb1b75410d4f02f0412ec.tar.bz2 PrismLauncher-e7f373496ed51d30d87eb1b75410d4f02f0412ec.zip |
GH-3234 Add support for custom meta URLs at build time
This is not particularly interesting for non-developers.
Also includes some internal restructuring of URL constants in general.
Diffstat (limited to 'api/logic/minecraft')
-rw-r--r-- | api/logic/minecraft/AssetsUtils.cpp | 4 | ||||
-rw-r--r-- | api/logic/minecraft/Library.cpp | 3 | ||||
-rw-r--r-- | api/logic/minecraft/Library.h | 1 | ||||
-rw-r--r-- | api/logic/minecraft/MinecraftUpdate.cpp | 1 | ||||
-rw-r--r-- | api/logic/minecraft/OneSixVersionFormat.cpp | 5 | ||||
-rw-r--r-- | api/logic/minecraft/auth/YggdrasilTask.cpp | 4 | ||||
-rw-r--r-- | api/logic/minecraft/update/FMLLibrariesTask.cpp | 3 |
7 files changed, 12 insertions, 9 deletions
diff --git a/api/logic/minecraft/AssetsUtils.cpp b/api/logic/minecraft/AssetsUtils.cpp index f94f68b1..68089080 100644 --- a/api/logic/minecraft/AssetsUtils.cpp +++ b/api/logic/minecraft/AssetsUtils.cpp @@ -27,7 +27,7 @@ #include "FileSystem.h" #include "net/Download.h" #include "net/ChecksumValidator.h" -#include "net/URLConstants.h" +#include "BuildConfig.h" namespace { QSet<QString> collectPathsFromDir(QString dirPath) @@ -308,7 +308,7 @@ QString AssetObject::getLocalPath() QUrl AssetObject::getUrl() { - return URLConstants::RESOURCE_BASE + getRelPath(); + return BuildConfig.RESOURCE_BASE + getRelPath(); } QString AssetObject::getRelPath() diff --git a/api/logic/minecraft/Library.cpp b/api/logic/minecraft/Library.cpp index 9ff8dcdc..b3c7657c 100644 --- a/api/logic/minecraft/Library.cpp +++ b/api/logic/minecraft/Library.cpp @@ -5,6 +5,7 @@ #include <net/ChecksumValidator.h> #include <Env.h> #include <FileSystem.h> +#include <BuildConfig.h> void Library::getApplicableFiles(OpSys system, QStringList& jar, QStringList& native, QStringList& native32, @@ -171,7 +172,7 @@ QList< std::shared_ptr< NetAction > > Library::getDownloads( if (m_repositoryURL.isEmpty()) { - return URLConstants::LIBRARY_BASE + raw_storage; + return BuildConfig.LIBRARY_BASE + raw_storage; } if(m_repositoryURL.endsWith('/')) diff --git a/api/logic/minecraft/Library.h b/api/logic/minecraft/Library.h index 014f6745..acdd6c9c 100644 --- a/api/logic/minecraft/Library.h +++ b/api/logic/minecraft/Library.h @@ -12,7 +12,6 @@ #include "Rule.h" #include "minecraft/OpSys.h" #include "GradleSpecifier.h" -#include "net/URLConstants.h" #include "MojangDownloadInfo.h" #include "multimc_logic_export.h" diff --git a/api/logic/minecraft/MinecraftUpdate.cpp b/api/logic/minecraft/MinecraftUpdate.cpp index ca3e7617..68dd437d 100644 --- a/api/logic/minecraft/MinecraftUpdate.cpp +++ b/api/logic/minecraft/MinecraftUpdate.cpp @@ -25,7 +25,6 @@ #include "BaseInstance.h" #include "minecraft/PackProfile.h" #include "minecraft/Library.h" -#include "net/URLConstants.h" #include <FileSystem.h> #include "update/FoldersTask.h" diff --git a/api/logic/minecraft/OneSixVersionFormat.cpp b/api/logic/minecraft/OneSixVersionFormat.cpp index a0b6fd0e..7ac9e2db 100644 --- a/api/logic/minecraft/OneSixVersionFormat.cpp +++ b/api/logic/minecraft/OneSixVersionFormat.cpp @@ -198,7 +198,10 @@ VersionFilePtr OneSixVersionFormat::versionFileFromJson(const QJsonDocument &doc // FIXME: this will eventually break... else { - lib->setAbsoluteUrl(URLConstants::getLegacyJarUrl(out->minecraftVersion)); + out->addProblem( + ProblemSeverity::Error, + QObject::tr("URL for the main jar could not be determined - Mojang removed the server that we used as fallback.") + ); } out->mainJar = lib; } diff --git a/api/logic/minecraft/auth/YggdrasilTask.cpp b/api/logic/minecraft/auth/YggdrasilTask.cpp index 71f5d950..570fe1ea 100644 --- a/api/logic/minecraft/auth/YggdrasilTask.cpp +++ b/api/logic/minecraft/auth/YggdrasilTask.cpp @@ -25,7 +25,7 @@ #include <Env.h> -#include <net/URLConstants.h> +#include <BuildConfig.h> #include <QDebug> @@ -42,7 +42,7 @@ void YggdrasilTask::executeTask() // Get the content of the request we're going to send to the server. QJsonDocument doc(getRequestContent()); - QUrl reqUrl(URLConstants::AUTH_BASE + getEndpoint()); + QUrl reqUrl(BuildConfig.AUTH_BASE + getEndpoint()); QNetworkRequest netRequest(reqUrl); netRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); diff --git a/api/logic/minecraft/update/FMLLibrariesTask.cpp b/api/logic/minecraft/update/FMLLibrariesTask.cpp index 850130a1..85993e81 100644 --- a/api/logic/minecraft/update/FMLLibrariesTask.cpp +++ b/api/logic/minecraft/update/FMLLibrariesTask.cpp @@ -4,6 +4,7 @@ #include "FMLLibrariesTask.h" #include "minecraft/MinecraftInstance.h" #include "minecraft/PackProfile.h" +#include "BuildConfig.h" FMLLibrariesTask::FMLLibrariesTask(MinecraftInstance * inst) { @@ -63,7 +64,7 @@ void FMLLibrariesTask::executeTask() for (auto &lib : fmlLibsToProcess) { auto entry = metacache->resolveEntry("fmllibs", lib.filename); - QString urlString = (lib.ours ? URLConstants::FMLLIBS_OUR_BASE_URL : URLConstants::FMLLIBS_FORGE_BASE_URL) + lib.filename; + QString urlString = (lib.ours ? BuildConfig.FMLLIBS_OUR_BASE_URL : BuildConfig.FMLLIBS_FORGE_BASE_URL) + lib.filename; dljob->addNetAction(Net::Download::makeCached(QUrl(urlString), entry)); } |