diff options
author | timoreo <timo.oreo34@gmail.com> | 2022-01-31 17:18:11 +0100 |
---|---|---|
committer | timoreo <timo.oreo34@gmail.com> | 2022-01-31 17:18:11 +0100 |
commit | aa2c27bf6984f9ea2d67411c0f28d802d40834af (patch) | |
tree | cd1c4989c94dbd2a57b7c8891bbc195a3a97de61 /launcher/ui | |
parent | efc44c56a62def0242353dde9c84452690209465 (diff) | |
download | PrismLauncher-aa2c27bf6984f9ea2d67411c0f28d802d40834af.tar.gz PrismLauncher-aa2c27bf6984f9ea2d67411c0f28d802d40834af.tar.bz2 PrismLauncher-aa2c27bf6984f9ea2d67411c0f28d802d40834af.zip |
Update to Modrinth API V2
Diffstat (limited to 'launcher/ui')
-rw-r--r-- | launcher/ui/pages/modplatform/modrinth/ModrinthModel.cpp | 6 | ||||
-rw-r--r-- | launcher/ui/pages/modplatform/modrinth/ModrinthPage.cpp | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/launcher/ui/pages/modplatform/modrinth/ModrinthModel.cpp b/launcher/ui/pages/modplatform/modrinth/ModrinthModel.cpp index 4f6a491e..71574156 100644 --- a/launcher/ui/pages/modplatform/modrinth/ModrinthModel.cpp +++ b/launcher/ui/pages/modplatform/modrinth/ModrinthModel.cpp @@ -157,7 +157,7 @@ void ListModel::fetchMore(const QModelIndex& parent) } performPaginatedSearch(); } -const char* sorts[4]{"relevance","downloads","updated","newest"}; +const char* sorts[5]{"relevance","downloads","follows","updated","newest"}; void ListModel::performPaginatedSearch() { @@ -166,12 +166,12 @@ void ListModel::performPaginatedSearch() bool hasFabric = !((MinecraftInstance *)((ModrinthPage *)parent())->m_instance)->getPackProfile()->getComponentVersion("net.fabricmc.fabric-loader").isEmpty(); auto netJob = new NetJob("Modrinth::Search", APPLICATION->network()); auto searchUrl = QString( - "https://api.modrinth.com/api/v1/mod?" + "https://api.modrinth.com/v2/search?" "offset=%1&" "limit=25&" "query=%2&" "index=%3&" - "filters=categories=\"%4\" AND versions=\"%5\"" + "facets=[[\"categories:%4\"],[\"versions:%5\"],[\"project_type:mod\"]]" ) .arg(nextSearchOffset) .arg(currentSearchTerm) diff --git a/launcher/ui/pages/modplatform/modrinth/ModrinthPage.cpp b/launcher/ui/pages/modplatform/modrinth/ModrinthPage.cpp index 61912cd7..ee3c9e76 100644 --- a/launcher/ui/pages/modplatform/modrinth/ModrinthPage.cpp +++ b/launcher/ui/pages/modplatform/modrinth/ModrinthPage.cpp @@ -27,6 +27,7 @@ ModrinthPage::ModrinthPage(ModDownloadDialog *dialog, BaseInstance *instance) // index is used to set the sorting with the modrinth api ui->sortByBox->addItem(tr("Sort by Relevence")); ui->sortByBox->addItem(tr("Sort by Downloads")); + ui->sortByBox->addItem(tr("Sort by Follows")); ui->sortByBox->addItem(tr("Sort by last updated")); ui->sortByBox->addItem(tr("Sort by newest")); @@ -99,8 +100,7 @@ void ModrinthPage::onSelectionChanged(QModelIndex first, QModelIndex second) auto netJob = new NetJob(QString("Modrinth::ModVersions(%1)").arg(current.name), APPLICATION->network()); std::shared_ptr<QByteArray> response = std::make_shared<QByteArray>(); QString addonId = current.addonId; - addonId.remove(0,6); - netJob->addNetAction(Net::Download::makeByteArray(QString("https://api.modrinth.com/api/v1/mod/%1/version").arg(addonId), response.get())); + netJob->addNetAction(Net::Download::makeByteArray(QString("https://api.modrinth.com/v2/project/%1/version").arg(addonId), response.get())); QObject::connect(netJob, &NetJob::succeeded, this, [this, response, netJob] { |