feat: add links for curseforge mods

NOT DOWNLOAD LINKS! (someone would ask it i'm sure :p)
This commit is contained in:
flow 2022-05-24 12:14:08 -03:00
parent ae2ef324f2
commit c5eb6fe6fb
No known key found for this signature in database
GPG Key ID: 8D0F221F0A59F469
3 changed files with 26 additions and 1 deletions

View File

@ -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
{

View File

@ -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,

View File

@ -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,