aboutsummaryrefslogtreecommitdiff
path: root/launcher/modplatform/flame
diff options
context:
space:
mode:
authorflow <flowlnlnln@gmail.com>2022-06-03 20:45:44 -0300
committerflow <flowlnlnln@gmail.com>2022-07-17 11:33:42 -0300
commitc3f6c3dd8228b23b403af6b091a888ea3cc436ca (patch)
treef7ed9324ef36db1f774b00ba22a5dbc289d416cd /launcher/modplatform/flame
parent844b2457769d61131f97b5e82bb134568dfd42ed (diff)
downloadPrismLauncher-c3f6c3dd8228b23b403af6b091a888ea3cc436ca.tar.gz
PrismLauncher-c3f6c3dd8228b23b403af6b091a888ea3cc436ca.tar.bz2
PrismLauncher-c3f6c3dd8228b23b403af6b091a888ea3cc436ca.zip
feat: add changelog to mod providers
The Modrinth changelog is fairly straight-forward, as it's given to us directly with the API call we already did. Flame, on the other hand, requires us to do another call to get the changelog, so it can introduce quite a heavy performance impact. This way, we make it optional to get such changelog. Signed-off-by: flow <flowlnlnln@gmail.com>
Diffstat (limited to 'launcher/modplatform/flame')
-rw-r--r--launcher/modplatform/flame/FlameModIndex.cpp7
-rw-r--r--launcher/modplatform/flame/FlameModIndex.h2
2 files changed, 7 insertions, 2 deletions
diff --git a/launcher/modplatform/flame/FlameModIndex.cpp b/launcher/modplatform/flame/FlameModIndex.cpp
index 0ad1d4ba..a3222f44 100644
--- a/launcher/modplatform/flame/FlameModIndex.cpp
+++ b/launcher/modplatform/flame/FlameModIndex.cpp
@@ -7,6 +7,7 @@
#include "net/NetJob.h"
static ModPlatform::ProviderCapabilities ProviderCaps;
+static FlameAPI api;
void FlameMod::loadIndexedPack(ModPlatform::IndexedPack& pack, QJsonObject& obj)
{
@@ -91,7 +92,7 @@ void FlameMod::loadIndexedPackVersions(ModPlatform::IndexedPack& pack,
pack.versionsLoaded = true;
}
-auto FlameMod::loadIndexedPackVersion(QJsonObject& obj) -> ModPlatform::IndexedVersion
+auto FlameMod::loadIndexedPackVersion(QJsonObject& obj, bool load_changelog) -> ModPlatform::IndexedVersion
{
auto versionArray = Json::requireArray(obj, "gameVersions");
if (versionArray.isEmpty()) {
@@ -124,5 +125,9 @@ auto FlameMod::loadIndexedPackVersion(QJsonObject& obj) -> ModPlatform::IndexedV
break;
}
}
+
+ if(load_changelog)
+ file.changelog = api.getModFileChangelog(file.addonId.toInt(), file.fileId.toInt());
+
return file;
}
diff --git a/launcher/modplatform/flame/FlameModIndex.h b/launcher/modplatform/flame/FlameModIndex.h
index 9c6c1c6c..a839dd83 100644
--- a/launcher/modplatform/flame/FlameModIndex.h
+++ b/launcher/modplatform/flame/FlameModIndex.h
@@ -17,6 +17,6 @@ void loadIndexedPackVersions(ModPlatform::IndexedPack& pack,
QJsonArray& arr,
const shared_qobject_ptr<QNetworkAccessManager>& network,
BaseInstance* inst);
-auto loadIndexedPackVersion(QJsonObject& obj) -> ModPlatform::IndexedVersion;
+auto loadIndexedPackVersion(QJsonObject& obj, bool load_changelog = false) -> ModPlatform::IndexedVersion;
} // namespace FlameMod