diff options
author | Sefa Eyeoglu <contact@scrumplex.net> | 2023-08-17 09:24:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-17 09:24:35 +0200 |
commit | 85f36ebed7e1295547cd2324d1baf7834be89c31 (patch) | |
tree | cb1482f2724875b56780bb1083015db26143e5d4 /launcher/modplatform/flame/FlameAPI.cpp | |
parent | c88088c91a92a371a9bc2b7384c2897157772b7e (diff) | |
parent | 5e2d1ffdfbb3f673c063029c9a6c55071cba160a (diff) | |
download | PrismLauncher-85f36ebed7e1295547cd2324d1baf7834be89c31.tar.gz PrismLauncher-85f36ebed7e1295547cd2324d1baf7834be89c31.tar.bz2 PrismLauncher-85f36ebed7e1295547cd2324d1baf7834be89c31.zip |
Merge pull request #981 from Ryex/curseforge-url-handle
Diffstat (limited to 'launcher/modplatform/flame/FlameAPI.cpp')
-rw-r--r-- | launcher/modplatform/flame/FlameAPI.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/launcher/modplatform/flame/FlameAPI.cpp b/launcher/modplatform/flame/FlameAPI.cpp index 73ed1011..74d7db97 100644 --- a/launcher/modplatform/flame/FlameAPI.cpp +++ b/launcher/modplatform/flame/FlameAPI.cpp @@ -204,6 +204,17 @@ Task::Ptr FlameAPI::getFiles(const QStringList& fileIds, std::shared_ptr<QByteAr return netJob; } +Task::Ptr FlameAPI::getFile(const QString& addonId, const QString& fileId, std::shared_ptr<QByteArray> response) const +{ + auto netJob = makeShared<NetJob>(QString("Flame::GetFile"), APPLICATION->network()); + netJob->addNetAction( + Net::ApiDownload::makeByteArray(QUrl(QString("https://api.curseforge.com/v1/mods/%1/files/%2").arg(addonId, fileId)), response)); + + QObject::connect(netJob.get(), &NetJob::failed, [addonId, fileId] { qDebug() << "Flame API file failure" << addonId << fileId; }); + + return netJob; +} + // https://docs.curseforge.com/?python#tocS_ModsSearchSortField static QList<ResourceAPI::SortingMethod> s_sorts = { { 1, "Featured", QObject::tr("Sort by Featured") }, { 2, "Popularity", QObject::tr("Sort by Popularity") }, |