| 954 | } |
| 955 | |
| 956 | void Application::performMainStartupAction() |
| 957 | { |
| 958 | m_status = Application::Initialized; |
| 959 | |
| 960 | if(!m_instanceIdToLaunch.isEmpty()) |
| 961 | { |
| 962 | auto inst = instances()->getInstanceById(m_instanceIdToLaunch); |
| 963 | if(inst) |
| 964 | { |
| 965 | MinecraftServerTargetPtr serverToJoin = nullptr; |
| 966 | MinecraftAccountPtr accountToUse = nullptr; |
| 967 | |
| 968 | qDebug() << "<> Instance" << m_instanceIdToLaunch << "launching"; |
| 969 | if(!m_serverToJoin.isEmpty()) |
| 970 | { |
| 971 | // FIXME: validate the server string |
| 972 | serverToJoin.reset(new MinecraftServerTarget(MinecraftServerTarget::parse(m_serverToJoin))); |
| 973 | qDebug() << " Launching with server" << m_serverToJoin; |
| 974 | } |
| 975 | |
| 976 | if(!m_profileToUse.isEmpty()) |
| 977 | { |
| 978 | accountToUse = accounts()->getAccountByProfileName(m_profileToUse); |
| 979 | if(!accountToUse) { |
| 980 | return; |
| 981 | } |
| 982 | qDebug() << " Launching with account" << m_profileToUse; |
| 983 | } |
| 984 | |
| 985 | launch(inst, true, false, nullptr, serverToJoin, accountToUse); |
| 986 | return; |
| 987 | } |
| 988 | } |
| 989 | |
| 990 | { |
| 991 | bool shouldFetch = m_settings->get("FlameKeyShouldBeFetchedOnStartup").toBool(); |
| 992 | if (!BuildConfig.FLAME_API_KEY_API_URL.isEmpty() && shouldFetch && !(capabilities() & Capability::SupportsFlame)) |
| 993 | { |
| 994 | auto response = QMessageBox::question(nullptr, |
| 995 | tr("Curseforge Core API Key"), |
| 996 | tr("Should PolyMC try to fetch the Official Curseforge Launcher's API Key? " |
| 997 | "Using this key technically breaks Curseforge's Terms of Service, but this distribution of PolyMC " |
| 998 | "does not come with a Curseforge API key by default, so without this key or another valid API key, " |
| 999 | "which you can always change in the settings, you won't be able to download Curseforge modpacks."), |
| 1000 | QMessageBox::Yes | QMessageBox::No); |
| 1001 | |
| 1002 | if (response == QMessageBox::Yes) |
| 1003 | { |
| 1004 | QString apiKey = GuiUtil::fetchFlameKey(); |
| 1005 | if (!apiKey.isEmpty()) |
| 1006 | { |
| 1007 | m_settings->set("FlameKeyOverride", apiKey); |
| 1008 | updateCapabilities(); |
| 1009 | } |
| 1010 | } |
| 1011 | } |
| 1012 | m_settings->set("FlameKeyShouldBeFetchedOnStartup", false); |
| 1013 | } |
nothing calls this directly
no test coverage detected