Use PolyMC's CurseForge workaround (#47)
* Curseforge workarounds This should allow people to use Curseforge without having to manually paste a working key into the settings or change the user agent. Signed-off-by: Lenny McLennington <lenny@sneed.church> * chore: update cf api key api url Sascha says the domain name we're using is not gonna be renewed, so I'm switching it to a domain controlled by me instead so that this won't be a problem in the future. Signed-off-by: Lenny McLennington <lenny@sneed.church> * feat: add ability to disable cf api key fetching by setting the cf api key api url to a blank string Signed-off-by: Lenny McLennington <lenny@sneed.church> * don't ask before fetching key * change polymc mention to pollymc Signed-off-by: Lenny McLennington <lenny@sneed.church> Co-authored-by: Lenny McLennington <lenny@sneed.church>
This commit is contained in:
@@ -40,6 +40,7 @@
|
||||
#include <QApplication>
|
||||
#include <QFileDialog>
|
||||
|
||||
#include "net/FetchFlameAPIKey.h"
|
||||
#include "ui/dialogs/ProgressDialog.h"
|
||||
#include "ui/dialogs/CustomMessageBox.h"
|
||||
#include "net/PasteUpload.h"
|
||||
@@ -49,6 +50,31 @@
|
||||
#include <DesktopServices.h>
|
||||
#include <BuildConfig.h>
|
||||
|
||||
QString GuiUtil::fetchFlameKey(QWidget *parentWidget)
|
||||
{
|
||||
if (BuildConfig.FLAME_API_KEY_API_URL.isEmpty())
|
||||
return "";
|
||||
|
||||
ProgressDialog prog(parentWidget);
|
||||
auto flameKeyTask = std::make_unique<FetchFlameAPIKey>();
|
||||
prog.execWithTask(flameKeyTask.get());
|
||||
|
||||
if (!flameKeyTask->wasSuccessful())
|
||||
{
|
||||
auto message = QObject::tr("Fetching the Curseforge API key failed. Reason: %1").arg(flameKeyTask->failReason());
|
||||
if (!(APPLICATION->capabilities() & Application::SupportsFlame))
|
||||
{
|
||||
message += "\n\n" + QObject::tr("Downloading Curseforge modpacks will not work unless you manually set a valid Curseforge Core API key in the settings.");
|
||||
}
|
||||
|
||||
CustomMessageBox::selectable(parentWidget,
|
||||
QObject::tr("Failed to fetch Curseforge API key."),
|
||||
message, QMessageBox::Critical)->exec();
|
||||
}
|
||||
|
||||
return flameKeyTask->m_result;
|
||||
}
|
||||
|
||||
QString GuiUtil::uploadPaste(const QString &text, QWidget *parentWidget)
|
||||
{
|
||||
ProgressDialog dialog(parentWidget);
|
||||
|
Reference in New Issue
Block a user