aboutsummaryrefslogtreecommitdiff
path: root/launcher/modplatform/flame/FlameModIndex.cpp
diff options
context:
space:
mode:
authorflow <thiagodonato300@gmail.com>2022-05-07 19:39:00 -0300
committerflow <flowlnlnln@gmail.com>2022-05-23 14:58:08 -0300
commit0985adfd74758891c2e61c2de7f930119cab1386 (patch)
treeace9b0cb3744a0ffbbeebfa3aab2ef5d15eb7f9b /launcher/modplatform/flame/FlameModIndex.cpp
parent59d628208b403bfb2442291cbca139cbdfcd325f (diff)
downloadPrismLauncher-0985adfd74758891c2e61c2de7f930119cab1386.tar.gz
PrismLauncher-0985adfd74758891c2e61c2de7f930119cab1386.tar.bz2
PrismLauncher-0985adfd74758891c2e61c2de7f930119cab1386.zip
change: support newest changes with packwiz regarding CF
Diffstat (limited to 'launcher/modplatform/flame/FlameModIndex.cpp')
-rw-r--r--launcher/modplatform/flame/FlameModIndex.cpp25
1 files changed, 18 insertions, 7 deletions
diff --git a/launcher/modplatform/flame/FlameModIndex.cpp b/launcher/modplatform/flame/FlameModIndex.cpp
index 63411275..00dac411 100644
--- a/launcher/modplatform/flame/FlameModIndex.cpp
+++ b/launcher/modplatform/flame/FlameModIndex.cpp
@@ -30,6 +30,17 @@ void FlameMod::loadIndexedPack(ModPlatform::IndexedPack& pack, QJsonObject& obj)
}
}
+static QString enumToString(int hash_algorithm)
+{
+ switch(hash_algorithm){
+ default:
+ case 1:
+ return "sha1";
+ case 2:
+ return "md5";
+ }
+}
+
void FlameMod::loadIndexedPackVersions(ModPlatform::IndexedPack& pack,
QJsonArray& arr,
const shared_qobject_ptr<QNetworkAccessManager>& network,
@@ -63,14 +74,14 @@ void FlameMod::loadIndexedPackVersions(ModPlatform::IndexedPack& pack,
file.fileName = Json::requireString(obj, "fileName");
auto hash_list = Json::ensureArray(obj, "hashes");
- if(!hash_list.isEmpty()){
+ for(auto h : hash_list){
+ auto hash_entry = Json::ensureObject(h);
auto hash_types = ProviderCaps.hashType(ModPlatform::Provider::FLAME);
- for(auto& hash_type : hash_types) {
- if(hash_list.contains(hash_type)) {
- file.hash = Json::requireString(hash_list, "value");
- file.hash_type = hash_type;
- break;
- }
+ auto hash_algo = enumToString(Json::ensureInteger(hash_entry, "algo", 1, "algorithm"));
+ if(hash_types.contains(hash_algo)){
+ file.hash = Json::requireString(hash_entry, "value");
+ file.hash_type = hash_algo;
+ break;
}
}