aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt7
-rw-r--r--buildconfig/BuildConfig.cpp.in4
-rw-r--r--buildconfig/BuildConfig.h2
-rw-r--r--changelog.md135
-rw-r--r--launcher/CMakeLists.txt23
-rw-r--r--launcher/MultiMC.cpp49
-rw-r--r--launcher/minecraft/auth/flows/AuthContext.cpp14
-rw-r--r--launcher/pages/global/AccountListPage.cpp21
-rw-r--r--launcher/pages/global/MultiMCPage.cpp3
-rw-r--r--launcher/updater/DownloadTask.cpp2
-rw-r--r--launcher/updater/UpdateChecker.cpp40
-rw-r--r--launcher/updater/UpdateChecker.h4
-rw-r--r--libraries/systeminfo/include/sys.h14
-rw-r--r--libraries/systeminfo/src/sys_apple.cpp29
-rw-r--r--libraries/systeminfo/src/sys_unix.cpp30
-rw-r--r--libraries/systeminfo/src/sys_win32.cpp4
-rw-r--r--notsecrets/CMakeLists.txt4
-rw-r--r--notsecrets/Secrets.cpp42
-rw-r--r--notsecrets/Secrets.h8
19 files changed, 389 insertions, 46 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index acc777fc..44028f76 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -55,7 +55,7 @@ set(MultiMC_NEWS_RSS_URL "https://multimc.org/rss.xml" CACHE STRING "URL to fetc
######## Set version numbers ########
set(MultiMC_VERSION_MAJOR 0)
set(MultiMC_VERSION_MINOR 6)
-set(MultiMC_VERSION_HOTFIX 12)
+set(MultiMC_VERSION_HOTFIX 13)
# Build number
set(MultiMC_VERSION_BUILD -1 CACHE STRING "Build number. -1 for no build number.")
@@ -64,7 +64,7 @@ set(MultiMC_VERSION_BUILD -1 CACHE STRING "Build number. -1 for no build number.
set(MultiMC_BUILD_PLATFORM "" CACHE STRING "A short string identifying the platform that this build was built for. Only used by the notification system and to display in the about dialog.")
# Channel list URL
-set(MultiMC_CHANLIST_URL "" CACHE STRING "URL for the channel list.")
+set(MultiMC_UPDATER_BASE "" CACHE STRING "Base URL for the updater.")
# Notification URL
set(MultiMC_NOTIFICATION_URL "" CACHE STRING "URL for checking for notifications.")
@@ -289,7 +289,10 @@ add_subdirectory(buildconfig)
if(MultiMC_EMBED_SECRETS)
add_subdirectory(secrets)
+else()
+ add_subdirectory(notsecrets)
endif()
+
# NOTE: this must always be last to appease the CMake deity of quirky install command evaluation order.
add_subdirectory(launcher)
diff --git a/buildconfig/BuildConfig.cpp.in b/buildconfig/BuildConfig.cpp.in
index 60d417a6..d9f4d1f1 100644
--- a/buildconfig/BuildConfig.cpp.in
+++ b/buildconfig/BuildConfig.cpp.in
@@ -12,14 +12,14 @@ Config::Config()
VERSION_BUILD = @MultiMC_VERSION_BUILD@;
BUILD_PLATFORM = "@MultiMC_BUILD_PLATFORM@";
- CHANLIST_URL = "@MultiMC_CHANLIST_URL@";
+ UPDATER_BASE = "@MultiMC_UPDATER_BASE@";
ANALYTICS_ID = "@MultiMC_ANALYTICS_ID@";
NOTIFICATION_URL = "@MultiMC_NOTIFICATION_URL@";
FULL_VERSION_STR = "@MultiMC_VERSION_MAJOR@.@MultiMC_VERSION_MINOR@.@MultiMC_VERSION_BUILD@";
GIT_COMMIT = "@MultiMC_GIT_COMMIT@";
GIT_REFSPEC = "@MultiMC_GIT_REFSPEC@";
- if(GIT_REFSPEC.startsWith("refs/heads/") && !CHANLIST_URL.isEmpty() && VERSION_BUILD >= 0)
+ if(GIT_REFSPEC.startsWith("refs/heads/") && !UPDATER_BASE.isEmpty() && !BUILD_PLATFORM.isEmpty() && VERSION_BUILD >= 0)
{
VERSION_CHANNEL = GIT_REFSPEC;
VERSION_CHANNEL.remove("refs/heads/");
diff --git a/buildconfig/BuildConfig.h b/buildconfig/BuildConfig.h
index de7d4b49..6a35d1b3 100644
--- a/buildconfig/BuildConfig.h
+++ b/buildconfig/BuildConfig.h
@@ -29,7 +29,7 @@ public:
QString BUILD_PLATFORM;
/// URL for the updater's channel
- QString CHANLIST_URL;
+ QString UPDATER_BASE;
/// User-Agent to use.
QString USER_AGENT = "MultiMC/5.0";
diff --git a/changelog.md b/changelog.md
index 31b99a6b..97454d7f 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,10 +1,135 @@
-# MultiMC 0.6.12
+# MultiMC 0.6.13
+
+This release brings initial support for Microsoft accounts, along with a nice pile of modpack platform support changes and improved Java runtime detection.
+
+Java runtimes still need an overhaul, so we're staying on the 0.6 version for a little longer.
+
+Next release should also tackle the current Forge 1.17.x issues in a systematic way.
+
+### Microsoft accounts
+
+This is the first release with Microsoft accounts in.
+
+Implementation is loosely based on documentation available from [wiki.vg](https://wiki.vg/Microsoft_Authentication_Scheme) with some notable changes:
+
+- More complete implementation including getting and displaying GamerTags [(see XR-046)](https://docs.microsoft.com/en-us/gaming/gdk/_content/gc/policies/pc/live-policies-pc#xr-046-display-name-and-gamerpic-).
+
+- Using the OAuth Device Flow instead of closely integrating with a browser engine.
+
+ MultiMC asks you to open a Microsoft login web page and put in a code that lets MultiMC authenticate.
+
+ This lets you authenticate on a completely separate device like your phone, leaving code we ship and the computer you may not even trust out of the picture.
+
+As part of this, the skin fetching no longer uses a third party service and instead gets skins directly from Mojang.
+
+Capes can also be selected in MultiMC now. With how many people will now get one for migrating their accounts, it only makes sense.
+
+### macOS update
+
+Because of issues with the Microsoft accounts, we now have two builds on macOS:
+
+- The old build with Qt 5.6 that does not work with Microsoft accounts, but can run on macOS older than 10.13.
+
+- A new build with Qt 5.15.2 that does work with Microsoft accounts, can use the new macOS dark theme and highlight colors, but requires at least macOS 10.13.
+
+MultiMC will update to the 5.15.2 builds when it detects that this is possible. **It may look like it is updating twice, just let it do its thing.**
+
+Similar approach got attempted on Windows, aiming to fix various display scaling and theming issues, but it ran into too many problems and will be attempted later, with more caution.
+
+### Modpack platforms
+
+In general, the modpack platform pages have been made more consistent with each other (GH-3118, GH-3720, GH-3731).
+
+- FTB improvements:
+
+ - Modpack file downloads are now checked with checksums and cached.
+
+ - GH-1949: Allow Legacy FTB and FTB pack downloads to be aborted.
+
+- CurseForge improvements:
+
+ - CurseForge modpack platform is now presented as CurseForge, not Twitch.
+
+ - UI has been updated to match other platforms
+
+ - Added sorting
+
+ - GH-3667: Added version selection
+
+ - GH-3611: Added ability to install beta versions
+
+ - GH-3633: When a CurseForge pack is available for multiple Minecraft versions, we assume the latest one.
+
+- ATLauncher improvements:
+
+ - Handling latest/custom/recommended mod loader versions.
+
+ - Fabric loader packs should now work.
+
+ - GH-3764: Only client mods are installed now for ATL packs.
+
+ - Improved error handling
+
+ - Optional mods are supported.
+
+ - GH-1949: Allow ATLauncher pack downloads to be aborted
+
+
+- Fixed bugs in FTB platform search.
+
+### Other changes
+
+- Forge installation is disabled on Minecraft 1.17+ because of incompatible/unresolved changes on the Forge side.
+
+ We're going to aim for fixing it in time for 1.18. Thankfully, 1.17 is more of a in-between release, so go play some 1.16.x packs!
+
+- GH-2529: On macOS, MultiMC will ask to move all the instance data to a new `Data` folder in order to fix long load times caused by macOS checking all files.
+
+- Detection of a large amount of various Java runtime flavors have been added.
+
+- It is now possible to join servers when starting an instance:
+
+ - From command line via the `--launch` and `--server` arguments.
+
+ - Or by setting this up in the instance settings page.
+
+ This may not work correctly in some cases, because it is a rarely used feature and modders do not test with it.
+
+- MultiMC now prints resolved IP addresses of Minecraft services into the game log for diagnostic purposes.
+
+- Updated instance icons based on Minecraft textures.
+
+- Forge `mods.toml` files are now used for displaying mods in the UI.
+
+- Datapack button is now disabled when no world is selected.
+
+- MultiMC warns about GLFW and OpenAL workarounds being enabled in the game log.
+
+- Languages in the translations list are now sorted by their two/three letter key
+
+- GH-3450: Displaying and recording gameplay time is now optional and can be turned off.
+
+- GH-3930: MultiMC can now track the gameplay time of the last session.
+
+- GH-3033: The version pages of instances now have a filter bar.
+
+- GH-2971: UI descriptions of texture and resource packs no longer mention mods.
+
+- Quick and dirty minimum Java runtime versions checks have been added. This needs to be expanded in the future.
+
+### Technical changes
+
+- The codebase continues to move towards being debranded and harder to build as 'MultiMC' for third parties.
+
+# Previous releases
+
+## MultiMC 0.6.12
After roughly one year of maintenance and development work by various contributors, we're just calling it a good time to release.
What got added since the last time? Quite a bit! But in general, this is more of a spring cleaning before the major changes that we need to make come in.
-### Modpack platforms
+#### Modpack platforms
We've added a whole bunch of new modpack platforms to pick from right into the new instance dialog. If you run into any unusual issues with the imported packs, report them on the bug tracker.
@@ -18,7 +143,7 @@ We've added a whole bunch of new modpack platforms to pick from right into the n
- GH-405: Added a ATLauncher pack browser
-### Other changes
+#### Other changes
- Added the option to not use OpenAL and/or GLFW libraries bundled with the game.
@@ -46,7 +171,7 @@ We've added a whole bunch of new modpack platforms to pick from right into the n
- GH-3602: Pre-launch commands could fail on first launch of the instance because the .minecraft folder has not been created yet.
-### Technical changes
+#### Technical changes
- GH-3234: At build time, the meta URL can be changed.
@@ -58,8 +183,6 @@ We've added a whole bunch of new modpack platforms to pick from right into the n
- Compatibility with unusual build environments has been increased
-# Previous releases
-
## MultiMC 0.6.11
This adds Forge 1.13+ support using [ForgeWrapper](https://github.com/ZekerZhayard/ForgeWrapper) by ZekerZhayard.
diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt
index 7a5e4173..c29ee3e1 100644
--- a/launcher/CMakeLists.txt
+++ b/launcher/CMakeLists.txt
@@ -949,9 +949,7 @@ install(TARGETS MultiMC
RUNTIME DESTINATION ${BINARY_DEST_DIR} COMPONENT Runtime
)
-if(MultiMC_EMBED_SECRETS)
- target_link_libraries(MultiMC_logic secrets)
-endif()
+target_link_libraries(MultiMC_logic secrets)
#### The MultiMC bundle mess! ####
# Bundle utilities are used to complete the portable packages - they add all the libraries that would otherwise be missing on the target system.
@@ -985,6 +983,14 @@ if(INSTALL_BUNDLE STREQUAL "full")
COMPONENT Runtime
REGEX "minimal|linuxfb|offscreen" EXCLUDE
)
+ # Style plugins
+ if(EXISTS "${QT_PLUGINS_DIR}/styles")
+ install(
+ DIRECTORY "${QT_PLUGINS_DIR}/styles"
+ DESTINATION ${PLUGIN_DEST_DIR}
+ COMPONENT Runtime
+ )
+ endif()
else()
# Image formats
install(
@@ -1016,6 +1022,17 @@ if(INSTALL_BUNDLE STREQUAL "full")
REGEX "_debug\\." EXCLUDE
REGEX "\\.dSYM" EXCLUDE
)
+ # Style plugins
+ if(EXISTS "${QT_PLUGINS_DIR}/styles")
+ install(
+ DIRECTORY "${QT_PLUGINS_DIR}/styles"
+ DESTINATION ${PLUGIN_DEST_DIR}
+ COMPONENT Runtime
+ REGEX "d\\." EXCLUDE
+ REGEX "_debug\\." EXCLUDE
+ REGEX "\\.dSYM" EXCLUDE
+ )
+ endif()
endif()
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/install_prereqs.cmake.in"
diff --git a/launcher/MultiMC.cpp b/launcher/MultiMC.cpp
index 5961a45d..c532ce82 100644
--- a/launcher/MultiMC.cpp
+++ b/launcher/MultiMC.cpp
@@ -91,7 +91,8 @@ using namespace Commandline;
"This usually fixes the problem and you can move the application elsewhere afterwards.\n"\
"\n"
-static void appDebugOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
+namespace {
+void appDebugOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{
const char *levels = "DWCFIS";
const QString format("%1 %2 %3\n");
@@ -111,6 +112,47 @@ static void appDebugOutput(QtMsgType type, const QMessageLogContext &context, co
fflush(stderr);
}
+QString getIdealPlatform(QString currentPlatform) {
+ auto info = Sys::getKernelInfo();
+ switch(info.kernelType) {
+ case Sys::KernelType::Darwin: {
+ if(info.kernelMajor >= 17) {
+ // macOS 10.13 or newer
+ return "osx64-5.15.2";
+ }
+ else {
+ // macOS 10.12 or older
+ return "osx64";
+ }
+ }
+ case Sys::KernelType::Windows: {
+ // FIXME: 5.15.2 is not stable on Windows, due to a large number of completely unpredictable and hard to reproduce issues
+ break;
+/*
+ if(info.kernelMajor == 6 && info.kernelMinor >= 1) {
+ // Windows 7
+ return "win32-5.15.2";
+ }
+ else if (info.kernelMajor > 6) {
+ // Above Windows 7
+ return "win32-5.15.2";
+ }
+ else {
+ // Below Windows 7
+ return "win32";
+ }
+*/
+ }
+ case Sys::KernelType::Undetermined:
+ case Sys::KernelType::Linux: {
+ break;
+ }
+ }
+ return currentPlatform;
+}
+
+}
+
MultiMC::MultiMC(int &argc, char **argv) : QApplication(argc, argv)
{
#if defined Q_OS_WIN32
@@ -678,7 +720,10 @@ MultiMC::MultiMC(int &argc, char **argv) : QApplication(argc, argv)
// initialize the updater
if(BuildConfig.UPDATER_ENABLED)
{
- m_updateChecker.reset(new UpdateChecker(BuildConfig.CHANLIST_URL, BuildConfig.VERSION_CHANNEL, BuildConfig.VERSION_BUILD));
+ auto platform = getIdealPlatform(BuildConfig.BUILD_PLATFORM);
+ auto channelUrl = BuildConfig.UPDATER_BASE + platform + "/channels.json";
+ qDebug() << "Initializing updater with platform: " << platform << " -- " << channelUrl;
+ m_updateChecker.reset(new UpdateChecker(channelUrl, BuildConfig.VERSION_CHANNEL, BuildConfig.VERSION_BUILD));
qDebug() << "<> Updater started.";
}
diff --git a/launcher/minecraft/auth/flows/AuthContext.cpp b/launcher/minecraft/auth/flows/AuthContext.cpp
index 1203dc5f..b4db6c2d 100644
--- a/launcher/minecraft/auth/flows/AuthContext.cpp
+++ b/launcher/minecraft/auth/flows/AuthContext.cpp
@@ -18,9 +18,7 @@
#include "katabasis/Globals.h"
#include "AuthRequest.h"
-#ifdef EMBED_SECRETS
#include "Secrets.h"
-#endif
#include "Env.h"
@@ -53,13 +51,18 @@ void AuthContext::finishActivity() {
}
void AuthContext::initMSA() {
-#ifdef EMBED_SECRETS
if(m_oauth2) {
return;
}
+
+ auto clientId = Secrets::getMSAClientID('-');
+ if(clientId.isEmpty()) {
+ return;
+ }
+
Katabasis::OAuth2::Options opts;
opts.scope = "XboxLive.signin offline_access";
- opts.clientIdentifier = Secrets::getMSAClientID('-');
+ opts.clientIdentifier = clientId;
opts.authorizationUrl = "https://login.microsoftonline.com/consumers/oauth2/v2.0/devicecode";
opts.accessTokenUrl = "https://login.microsoftonline.com/consumers/oauth2/v2.0/token";
opts.listenerPorts = {28562, 28563, 28564, 28565, 28566};
@@ -71,7 +74,6 @@ void AuthContext::initMSA() {
connect(m_oauth2, &OAuth2::linkingSucceeded, this, &AuthContext::onOAuthLinkingSucceeded);
connect(m_oauth2, &OAuth2::showVerificationUriAndCode, this, &AuthContext::showVerificationUriAndCode);
connect(m_oauth2, &OAuth2::activityChanged, this, &AuthContext::onOAuthActivityChanged);
-#endif
}
void AuthContext::initMojang() {
@@ -538,7 +540,7 @@ void AuthContext::onSTSAuthGenericDone(
}
Katabasis::Token temp;
- if(!parseXTokenResponse(replyData, temp, "STSAuthGaneric")) {
+ if(!parseXTokenResponse(replyData, temp, "STSAuthGeneric")) {
qWarning() << "Could not parse authorization response for access to xbox API...";
failResult(m_xboxProfileSucceeded);
return;
diff --git a/launcher/pages/global/AccountListPage.cpp b/launcher/pages/global/AccountListPage.cpp
index 6bb07b22..74537712 100644
--- a/launcher/pages/global/AccountListPage.cpp
+++ b/launcher/pages/global/AccountListPage.cpp
@@ -37,6 +37,8 @@
#include "BuildConfig.h"
#include <dialogs/MSALoginDialog.h>
+#include "Secrets.h"
+
AccountListPage::AccountListPage(QWidget *parent)
: QMainWindow(parent), ui(new Ui::AccountListPage)
{
@@ -70,11 +72,8 @@ AccountListPage::AccountListPage(QWidget *parent)
updateButtonStates();
- // Xbox authentication won't work without a client identifier, so disable the button
- // if the build didn't specify one (GH-4012)
-#ifndef EMBED_SECRETS
- ui->actionAddMicrosoft->setVisible(false);
-#endif
+ // Xbox authentication won't work without a client identifier, so disable the button if it is missing
+ ui->actionAddMicrosoft->setVisible(Secrets::hasMSAClientID());
}
AccountListPage::~AccountListPage()
@@ -129,6 +128,18 @@ void AccountListPage::on_actionAddMojang_triggered()
void AccountListPage::on_actionAddMicrosoft_triggered()
{
+ if(BuildConfig.BUILD_PLATFORM == "osx64") {
+ CustomMessageBox::selectable(
+ this,
+ tr("Microsoft Accounts not available"),
+ tr(
+ "Microsoft accounts are only usable on macOS 10.13 or newer, with fully updated MultiMC.\n\n"
+ "Please update both your operating system and MultiMC."
+ ),
+ QMessageBox::Warning
+ )->exec();
+ return;
+ }
MinecraftAccountPtr account = MSALoginDialog::newAccount(
this,
tr("Please enter your Mojang account email and password to add your account.")
diff --git a/launcher/pages/global/MultiMCPage.cpp b/launcher/pages/global/MultiMCPage.cpp
index d383e6ed..5d43b187 100644
--- a/launcher/pages/global/MultiMCPage.cpp
+++ b/launcher/pages/global/MultiMCPage.cpp
@@ -58,8 +58,7 @@ MultiMCPage::MultiMCPage(QWidget *parent) : QWidget(parent), ui(new Ui::MultiMCP
if(BuildConfig.UPDATER_ENABLED)
{
- QObject::connect(MMC->updateChecker().get(), &UpdateChecker::channelListLoaded, this,
- &MultiMCPage::refreshUpdateChannelList);
+ QObject::connect(MMC->updateChecker().get(), &UpdateChecker::channelListLoaded, this, &MultiMCPage::refreshUpdateChannelList);
if (MMC->updateChecker()->hasChannels())
{
diff --git a/launcher/updater/DownloadTask.cpp b/launcher/updater/DownloadTask.cpp
index 20b26ebb..2c62ad24 100644
--- a/launcher/updater/DownloadTask.cpp
+++ b/launcher/updater/DownloadTask.cpp
@@ -170,4 +170,4 @@ OperationList DownloadTask::operations()
return m_operations;
}
-} \ No newline at end of file
+}
diff --git a/launcher/updater/UpdateChecker.cpp b/launcher/updater/UpdateChecker.cpp
index be33c73c..eea73dcf 100644
--- a/launcher/updater/UpdateChecker.cpp
+++ b/launcher/updater/UpdateChecker.cpp
@@ -23,9 +23,12 @@
#define API_VERSION 0
#define CHANLIST_FORMAT 0
-UpdateChecker::UpdateChecker(QString channelListUrl, QString currentChannel, int currentBuild)
+#include "BuildConfig.h"
+#include "sys.h"
+
+UpdateChecker::UpdateChecker(QString channelUrl, QString currentChannel, int currentBuild)
{
- m_channelListUrl = channelListUrl;
+ m_channelUrl = channelUrl;
m_currentChannel = currentChannel;
m_currentBuild = currentBuild;
}
@@ -48,8 +51,7 @@ void UpdateChecker::checkForUpdate(QString updateChannel, bool notifyNoUpdate)
// later.
if (!m_chanListLoaded)
{
- qDebug() << "Channel list isn't loaded yet. Loading channel list and deferring "
- "update check.";
+ qDebug() << "Channel list isn't loaded yet. Loading channel list and deferring update check.";
m_checkUpdateWaiting = true;
m_deferredUpdateChannel = updateChannel;
updateChanList(notifyNoUpdate);
@@ -62,29 +64,43 @@ void UpdateChecker::checkForUpdate(QString updateChannel, bool notifyNoUpdate)
return;
}
- m_updateChecking = true;
-
// Find the desired channel within the channel list and get its repo URL. If if cannot be
// found, error.
+ QString stableUrl;
m_newRepoUrl = "";
for (ChannelListEntry entry : m_channels)
{
- if (entry.id == updateChannel)
+ qDebug() << "channelEntry = " << entry.id;
+ if(entry.id == "stable") {
+ stableUrl = entry.url;
+ }
+ if (entry.id == updateChannel) {
m_newRepoUrl = entry.url;
- if (entry.id == m_currentChannel)
+ qDebug() << "is intended update channel: " << entry.id;
+ }
+ if (entry.id == m_currentChannel) {
m_currentRepoUrl = entry.url;
+ qDebug() << "is current update channel: " << entry.id;
+ }
}
qDebug() << "m_repoUrl = " << m_newRepoUrl;
- // If we didn't find our channel, error.
+ if (m_newRepoUrl.isEmpty()) {
+ qWarning() << "m_repoUrl was empty. defaulting to 'stable': " << stableUrl;
+ m_newRepoUrl = stableUrl;
+ }
+
+ // If nothing applies, error
if (m_newRepoUrl.isEmpty())
{
- qCritical() << "m_repoUrl is empty!";
+ qCritical() << "failed to select any update repository for: " << updateChannel;
emit updateCheckFailed();
return;
}
+ m_updateChecking = true;
+
QUrl indexUrl = QUrl(m_newRepoUrl).resolved(QUrl("index.json"));
auto job = new NetJob("GoUpdate Repository Index");
@@ -174,7 +190,7 @@ void UpdateChecker::updateChanList(bool notifyNoUpdate)
return;
}
- if (m_channelListUrl.isEmpty())
+ if (m_channelUrl.isEmpty())
{
qCritical() << "Failed to update channel list. No channel list URL set."
<< "If you'd like to use MultiMC's update system, please pass the channel "
@@ -184,7 +200,7 @@ void UpdateChecker::updateChanList(bool notifyNoUpdate)
m_chanListLoading = true;
NetJob *job = new NetJob("Update System Channel List");
- job->addNetAction(Net::Download::makeByteArray(QUrl(m_channelListUrl), &chanlistData));
+ job->addNetAction(Net::Download::makeByteArray(QUrl(m_channelUrl), &chanlistData));
connect(job, &NetJob::succeeded, [this, notifyNoUpdate]() { chanListDownloadFinished(notifyNoUpdate); });
QObject::connect(job, &NetJob::failed, this, &UpdateChecker::chanListDownloadFailed);
chanListJob.reset(job);
diff --git a/launcher/updater/UpdateChecker.h b/launcher/updater/UpdateChecker.h
index 91b6e26e..219c3c62 100644
--- a/launcher/updater/UpdateChecker.h
+++ b/launcher/updater/UpdateChecker.h
@@ -23,7 +23,7 @@ class UpdateChecker : public QObject
Q_OBJECT
public:
- UpdateChecker(QString channelListUrl, QString currentChannel, int currentBuild);
+ UpdateChecker(QString channelUrl, QString currentChannel, int currentBuild);
void checkForUpdate(QString updateChannel, bool notifyNoUpdate);
/*!
@@ -78,7 +78,7 @@ private:
NetJobPtr chanListJob;
QByteArray chanlistData;
- QString m_channelListUrl;
+ QString m_channelUrl;
QList<ChannelListEntry> m_channels;
diff --git a/libraries/systeminfo/include/sys.h b/libraries/systeminfo/include/sys.h
index 914d2555..bd6e2486 100644
--- a/libraries/systeminfo/include/sys.h
+++ b/libraries/systeminfo/include/sys.h
@@ -4,10 +4,24 @@
namespace Sys
{
const uint64_t mebibyte = 1024ull * 1024ull;
+
+enum class KernelType {
+ Undetermined,
+ Windows,
+ Darwin,
+ Linux
+};
+
struct KernelInfo
{
QString kernelName;
QString kernelVersion;
+
+ KernelType kernelType = KernelType::Undetermined;
+ int kernelMajor = 0;
+ int kernelMinor = 0;
+ int kernelPatch = 0;
+ bool isCursed = false;
};
KernelInfo getKernelInfo();
diff --git a/libraries/systeminfo/src/sys_apple.cpp b/libraries/systeminfo/src/sys_apple.cpp
index 4bcffae4..6353b747 100644
--- a/libraries/systeminfo/src/sys_apple.cpp
+++ b/libraries/systeminfo/src/sys_apple.cpp
@@ -2,13 +2,40 @@
#include <sys/utsname.h>
+#include <QString>
+#include <QStringList>
+#include <QDebug>
+
Sys::KernelInfo Sys::getKernelInfo()
{
Sys::KernelInfo out;
struct utsname buf;
uname(&buf);
+ out.kernelType = KernelType::Darwin;
out.kernelName = buf.sysname;
- out.kernelVersion = buf.release;
+ QString release = out.kernelVersion = buf.release;
+
+ // TODO: figure out how to detect cursed-ness (macOS emulated on linux via mad hacks and so on)
+ out.isCursed = false;
+
+ out.kernelMajor = 0;
+ out.kernelMinor = 0;
+ out.kernelPatch = 0;
+ auto sections = release.split('-');
+ if(sections.size() >= 1) {
+ auto versionParts = sections[0].split('.');
+ if(versionParts.size() >= 3) {
+ out.kernelMajor = versionParts[0].toInt();
+ out.kernelMinor = versionParts[1].toInt();
+ out.kernelPatch = versionParts[2].toInt();
+ }
+ else {
+ qWarning() << "Not enough version numbers in " << sections[0] << " found " << versionParts.size();
+ }
+ }
+ else {
+ qWarning() << "Not enough '-' sections in " << release << " found " << sections.size();
+ }
return out;
}
diff --git a/libraries/systeminfo/src/sys_unix.cpp b/libraries/systeminfo/src/sys_unix.cpp
index 42c0d319..fb96c72c 100644
--- a/libraries/systeminfo/src/sys_unix.cpp
+++ b/libraries/systeminfo/src/sys_unix.cpp
@@ -6,13 +6,41 @@
#include <fstream>
#include <limits>
+#include <QString>
+#include <QStringList>
+#include <QDebug>
+
Sys::KernelInfo Sys::getKernelInfo()
{
Sys::KernelInfo out;
struct utsname buf;
uname(&buf);
+ // NOTE: we assume linux here. this needs further elaboration
+ out.kernelType = KernelType::Linux;
out.kernelName = buf.sysname;
- out.kernelVersion = buf.release;
+ QString release = out.kernelVersion = buf.release;
+
+ // linux binary running on WSL is cursed.
+ out.isCursed = release.contains("WSL", Qt::CaseInsensitive) || release.contains("Microsoft", Qt::CaseInsensitive);
+
+ out.kernelMajor = 0;
+ out.kernelMinor = 0;
+ out.kernelPatch = 0;
+ auto sections = release.split('-');
+ if(sections.size() >= 1) {
+ auto versionParts = sections[0].split('.');
+ if(versionParts.size() >= 3) {
+ out.kernelMajor = versionParts[0].toInt();
+ out.kernelMinor = versionParts[1].toInt();
+ out.kernelPatch = versionParts[2].toInt();
+ }
+ else {
+ qWarning() << "Not enough version numbers in " << sections[0] << " found " << versionParts.size();
+ }
+ }
+ else {
+ qWarning() << "Not enough '-' sections in " << release << " found " << sections.size();
+ }
return out;
}
diff --git a/libraries/systeminfo/src/sys_win32.cpp b/libraries/systeminfo/src/sys_win32.cpp
index a750b3a7..430b87e4 100644
--- a/libraries/systeminfo/src/sys_win32.cpp
+++ b/libraries/systeminfo/src/sys_win32.cpp
@@ -5,12 +5,16 @@
Sys::KernelInfo Sys::getKernelInfo()
{
Sys::KernelInfo out;
+ out.kernelType = KernelType::Windows;
out.kernelName = "Windows";
OSVERSIONINFOW osvi;
ZeroMemory(&osvi, sizeof(OSVERSIONINFOW));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW);
GetVersionExW(&osvi);
out.kernelVersion = QString("%1.%2").arg(osvi.dwMajorVersion).arg(osvi.dwMinorVersion);
+ out.kernelMajor = osvi.dwMajorVersion;
+ out.kernelMinor = osvi.dwMinorVersion;
+ out.kernelPatch = osvi.dwBuildNumber;
return out;
}
diff --git a/notsecrets/CMakeLists.txt b/notsecrets/CMakeLists.txt
new file mode 100644
index 00000000..f27aeb70
--- /dev/null
+++ b/notsecrets/CMakeLists.txt
@@ -0,0 +1,4 @@
+add_library(secrets STATIC Secrets.cpp Secrets.h)
+target_link_libraries(secrets Qt5::Core)
+target_compile_definitions(secrets PUBLIC -DEMBED_SECRETS)
+target_include_directories(secrets PUBLIC .)
diff --git a/notsecrets/Secrets.cpp b/notsecrets/Secrets.cpp
new file mode 100644
index 00000000..88995635
--- /dev/null
+++ b/notsecrets/Secrets.cpp
@@ -0,0 +1,42 @@
+#include "Secrets.h"
+
+#include <array>
+#include <cstdio>
+
+namespace {
+
+/*
+ * This is the MSA client ID. It is confidential and should not be reused.
+ * You can obtain one for yourself by using azure app registration:
+ * https://docs.microsoft.com/en-us/azure/active-directory/develop/quickstart-register-app
+ *
+ * The app registration should:
+ * - Be only for personal accounts.
+ * - Not have any redirect URI.
+ * - Not have any platform.
+ * - Have no credentials.
+ * - No certificates.
+ * - No client secrets.
+ * - Enable 'Live SDK support' for access to XBox APIs.
+ * - Enable 'public client flows' for OAuth2 device flow.
+ *
+ * By putting one in here, you accept the terms and conditions for using the MS Identity Plaform and assume all responsibilities associated with it.
+ * See: https://docs.microsoft.com/en-us/legal/microsoft-identity-platform/terms-of-use
+ *
+ * Above all else, do not impersonate other applications! This includes the Mojang Launcher and MultiMC - your builds are *NOT* MultiMC.
+ *
+ * If you intend to base your own launcher on this code, take care and customize this to obfuscate the client ID, so it cannot be trivially found by casual attackers.
+ */
+
+QString MSAClientID = "";
+}
+
+namespace Secrets {
+bool hasMSAClientID() {
+ return !MSAClientID.isEmpty();
+}
+
+QString getMSAClientID(uint8_t separator) {
+ return MSAClientID;
+}
+}
diff --git a/notsecrets/Secrets.h b/notsecrets/Secrets.h
new file mode 100644
index 00000000..6872b68e
--- /dev/null
+++ b/notsecrets/Secrets.h
@@ -0,0 +1,8 @@
+#pragma once
+#include <QString>
+#include <cstdint>
+
+namespace Secrets {
+bool hasMSAClientID();
+QString getMSAClientID(uint8_t separator);
+}