diff options
author | flow <flowlnlnln@gmail.com> | 2022-05-24 12:14:08 -0300 |
---|---|---|
committer | flow <flowlnlnln@gmail.com> | 2022-05-24 12:14:08 -0300 |
commit | c5eb6fe6fb733c62c071473a8d1102c44e133c17 (patch) | |
tree | 31ba2d310c1c886068d1c2cbc3e948b2f79aff25 /launcher/modplatform | |
parent | ae2ef324f297adee33968b50e70d9cf5d8ed72fb (diff) | |
download | PrismLauncher-c5eb6fe6fb733c62c071473a8d1102c44e133c17.tar.gz PrismLauncher-c5eb6fe6fb733c62c071473a8d1102c44e133c17.tar.bz2 PrismLauncher-c5eb6fe6fb733c62c071473a8d1102c44e133c17.zip |
feat: add links for curseforge mods
NOT DOWNLOAD LINKS! (someone would ask it i'm sure :p)
Diffstat (limited to 'launcher/modplatform')
-rw-r--r-- | launcher/modplatform/flame/FlameAPI.h | 5 | ||||
-rw-r--r-- | launcher/modplatform/flame/FlameModIndex.cpp | 21 | ||||
-rw-r--r-- | launcher/modplatform/flame/FlameModIndex.h | 1 |
3 files changed, 26 insertions, 1 deletions
diff --git a/launcher/modplatform/flame/FlameAPI.h b/launcher/modplatform/flame/FlameAPI.h index 6ce474c8..3b5c5782 100644 --- a/launcher/modplatform/flame/FlameAPI.h +++ b/launcher/modplatform/flame/FlameAPI.h @@ -41,7 +41,10 @@ class FlameAPI : public NetworkModAPI { .arg(gameVersionStr); }; - inline auto getModInfoURL(QString& id) const -> QString override { return {}; }; + inline auto getModInfoURL(QString& id) const -> QString override + { + return QString("https://api.curseforge.com/v1/mods/%1").arg(id); + }; inline auto getVersionsURL(VersionSearchArgs& args) const -> QString override { diff --git a/launcher/modplatform/flame/FlameModIndex.cpp b/launcher/modplatform/flame/FlameModIndex.cpp index ba0824cf..1a2f2bd4 100644 --- a/launcher/modplatform/flame/FlameModIndex.cpp +++ b/launcher/modplatform/flame/FlameModIndex.cpp @@ -25,6 +25,27 @@ void FlameMod::loadIndexedPack(ModPlatform::IndexedPack& pack, QJsonObject& obj) packAuthor.url = Json::requireString(author, "url"); pack.authors.append(packAuthor); } + + loadExtraPackData(pack, obj); +} + +void FlameMod::loadExtraPackData(ModPlatform::IndexedPack& pack, QJsonObject& obj) +{ + auto links_obj = Json::ensureObject(obj, "links"); + + pack.extraData.issuesUrl = Json::ensureString(links_obj, "issuesUrl"); + if(pack.extraData.issuesUrl.endsWith('/')) + pack.extraData.issuesUrl.chop(1); + + pack.extraData.sourceUrl = Json::ensureString(links_obj, "sourceUrl"); + if(pack.extraData.sourceUrl.endsWith('/')) + pack.extraData.sourceUrl.chop(1); + + pack.extraData.wikiUrl = Json::ensureString(links_obj, "wikiUrl"); + if(pack.extraData.wikiUrl.endsWith('/')) + pack.extraData.wikiUrl.chop(1); + + pack.extraDataLoaded = true; } void FlameMod::loadIndexedPackVersions(ModPlatform::IndexedPack& pack, diff --git a/launcher/modplatform/flame/FlameModIndex.h b/launcher/modplatform/flame/FlameModIndex.h index d3171d94..c631a6f3 100644 --- a/launcher/modplatform/flame/FlameModIndex.h +++ b/launcher/modplatform/flame/FlameModIndex.h @@ -12,6 +12,7 @@ namespace FlameMod { void loadIndexedPack(ModPlatform::IndexedPack& m, QJsonObject& obj); +void loadExtraPackData(ModPlatform::IndexedPack& m, QJsonObject& obj); void loadIndexedPackVersions(ModPlatform::IndexedPack& pack, QJsonArray& arr, const shared_qobject_ptr<QNetworkAccessManager>& network, |