diff options
author | Ezekiel Smith <ezekielsmith@protonmail.com> | 2022-06-14 23:52:00 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-14 23:52:00 +1000 |
commit | 27239b2dde3b2d6ea300cf4a80518258caae07b1 (patch) | |
tree | 4ceeb5699cd481b39491cc17cbc61f548c8fc81a /launcher/modplatform/flame/FlamePackIndex.cpp | |
parent | 349fc4143d4c83c50aa6340bbe7dc537a6fbf949 (diff) | |
parent | e64438016040c1a7ad1834a5735d34d6d1ea0cdb (diff) | |
download | PrismLauncher-27239b2dde3b2d6ea300cf4a80518258caae07b1.tar.gz PrismLauncher-27239b2dde3b2d6ea300cf4a80518258caae07b1.tar.bz2 PrismLauncher-27239b2dde3b2d6ea300cf4a80518258caae07b1.zip |
Merge pull request #634 from flowln/donate_links
More links for CF / Modrinth mods / modpacks
Diffstat (limited to 'launcher/modplatform/flame/FlamePackIndex.cpp')
-rw-r--r-- | launcher/modplatform/flame/FlamePackIndex.cpp | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/launcher/modplatform/flame/FlamePackIndex.cpp b/launcher/modplatform/flame/FlamePackIndex.cpp index bece7843..ba1622d1 100644 --- a/launcher/modplatform/flame/FlamePackIndex.cpp +++ b/launcher/modplatform/flame/FlamePackIndex.cpp @@ -6,7 +6,6 @@ void Flame::loadIndexedPack(Flame::IndexedPack& pack, QJsonObject& obj) { pack.addonId = Json::requireInteger(obj, "id"); pack.name = Json::requireString(obj, "name"); - pack.websiteUrl = Json::ensureString(Json::ensureObject(obj, "links"), "websiteUrl", ""); pack.description = Json::ensureString(obj, "summary", ""); auto logo = Json::requireObject(obj, "logo"); @@ -46,6 +45,32 @@ void Flame::loadIndexedPack(Flame::IndexedPack& pack, QJsonObject& obj) if (!found) { throw JSONValidationError(QString("Pack with no good file, skipping: %1").arg(pack.name)); } + + loadIndexedInfo(pack, obj); +} + +void Flame::loadIndexedInfo(IndexedPack& pack, QJsonObject& obj) +{ + auto links_obj = Json::ensureObject(obj, "links"); + + pack.extra.websiteUrl = Json::ensureString(links_obj, "issuesUrl"); + if(pack.extra.websiteUrl.endsWith('/')) + pack.extra.websiteUrl.chop(1); + + pack.extra.issuesUrl = Json::ensureString(links_obj, "issuesUrl"); + if(pack.extra.issuesUrl.endsWith('/')) + pack.extra.issuesUrl.chop(1); + + pack.extra.sourceUrl = Json::ensureString(links_obj, "sourceUrl"); + if(pack.extra.sourceUrl.endsWith('/')) + pack.extra.sourceUrl.chop(1); + + pack.extra.wikiUrl = Json::ensureString(links_obj, "wikiUrl"); + if(pack.extra.wikiUrl.endsWith('/')) + pack.extra.wikiUrl.chop(1); + + pack.extraInfoLoaded = true; + } void Flame::loadIndexedPackVersions(Flame::IndexedPack& pack, QJsonArray& arr) |