From 2d68308d4920be4c28a73d7646814765eee7b7a2 Mon Sep 17 00:00:00 2001 From: flow Date: Wed, 2 Mar 2022 23:01:23 -0300 Subject: refactor: move url creation for mods to modplatform/ Moves all things related to creating the URLs of the mod platforms that go to network tasks to a single place, so that: 1. Maintaining and fixing eventual issues is more straightforward. 2. Makes it possible to factor out more common code between the different modplatform pages --- launcher/ui/pages/modplatform/ModPage.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'launcher/ui/pages/modplatform/ModPage.cpp') diff --git a/launcher/ui/pages/modplatform/ModPage.cpp b/launcher/ui/pages/modplatform/ModPage.cpp index 8af534a6..2d47e31c 100644 --- a/launcher/ui/pages/modplatform/ModPage.cpp +++ b/launcher/ui/pages/modplatform/ModPage.cpp @@ -101,13 +101,8 @@ void ModPage::onSelectionChanged(QModelIndex first, QModelIndex second) auto netJob = new NetJob(QString("%1::ModVersions(%2)").arg(debugName()).arg(current.name), APPLICATION->network()); auto response = new QByteArray(); QString addonId = current.addonId.toString(); - //FIXME - if(debugName() == "Modrinth") - netJob->addNetAction( - Net::Download::makeByteArray(QString("https://api.modrinth.com/v2/project/%1/version").arg(addonId), response)); - else - netJob->addNetAction( - Net::Download::makeByteArray(QString("https://addons-ecs.forgesvc.net/api/v2/addon/%1/files").arg(addonId), response)); + + netJob->addNetAction(Net::Download::makeByteArray(apiProvider()->getVersionsURL(addonId), response)); QObject::connect(netJob, &NetJob::succeeded, this, [this, response, addonId]{ onModVersionSucceed(this, response, addonId); -- cgit