summaryrefslogtreecommitdiffstats
path: root/logic/MinecraftProcess.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2013-12-01 02:00:42 +0100
committerPetr Mrázek <peterix@gmail.com>2013-12-01 02:00:42 +0100
commitf27a6c39ea796f946893ced1d9f80441ad9aa18c (patch)
treefed31b28bc7752f4fea85aefddfeff62701e13b7 /logic/MinecraftProcess.cpp
parent2eaf33816b0c4f6fd61ea2b086fa1c4f9fcba4c5 (diff)
downloadMultiMC-f27a6c39ea796f946893ced1d9f80441ad9aa18c.tar
MultiMC-f27a6c39ea796f946893ced1d9f80441ad9aa18c.tar.gz
MultiMC-f27a6c39ea796f946893ced1d9f80441ad9aa18c.tar.lz
MultiMC-f27a6c39ea796f946893ced1d9f80441ad9aa18c.tar.xz
MultiMC-f27a6c39ea796f946893ced1d9f80441ad9aa18c.zip
Fix login and startup logging issues
Auth uses the refresh endpoint instead of validate. This means less password entering. Console will now only autoscroll when already scrolled all the way down. Better conformance with the Yggdrasil auth protocol (not complete yet, but Mojang launcher isn't complete either). Fix bug that prevented saving the account data (uninitialized variable). Accounts can now trigger account list saving, this is used for the refresh endpoint.
Diffstat (limited to 'logic/MinecraftProcess.cpp')
-rw-r--r--logic/MinecraftProcess.cpp30
1 files changed, 24 insertions, 6 deletions
diff --git a/logic/MinecraftProcess.cpp b/logic/MinecraftProcess.cpp
index e4a26054..aedd4027 100644
--- a/logic/MinecraftProcess.cpp
+++ b/logic/MinecraftProcess.cpp
@@ -71,6 +71,26 @@ void MinecraftProcess::setWorkdir(QString path)
m_prepostlaunchprocess.setWorkingDirectory(mcDir.absolutePath());
}
+QString MinecraftProcess::censorPrivateInfo(QString in)
+{
+ if(!m_account)
+ return in;
+ else
+ {
+ QString sessionId = m_account->sessionId();
+ QString accessToken = m_account->accessToken();
+ QString clientToken = m_account->clientToken();
+ QString profileId = m_account->currentProfile()->id();
+ QString profileName = m_account->currentProfile()->name();
+ in.replace(sessionId, "<SESSION ID>");
+ in.replace(accessToken, "<ACCESS TOKEN>");
+ in.replace(clientToken, "<CLIENT TOKEN>");
+ in.replace(clientToken, "<PROFILE ID>");
+ in.replace(clientToken, "<PROFILE NAME>");
+ return in;
+ }
+}
+
// console window
void MinecraftProcess::on_stdErr()
{
@@ -83,8 +103,7 @@ void MinecraftProcess::on_stdErr()
for (int i = 0; i < lines.size() - 1; i++)
{
QString &line = lines[i];
- emit log(line /*.replace(username, "<Username>").replace(sessionID, "<Session ID>")*/,
- getLevel(line, MessageLevel::Error));
+ emit log(censorPrivateInfo(line), getLevel(line, MessageLevel::Error));
}
if (!complete)
m_err_leftover = lines.last();
@@ -101,8 +120,7 @@ void MinecraftProcess::on_stdOut()
for (int i = 0; i < lines.size() - 1; i++)
{
QString &line = lines[i];
- emit log(line.replace(username, "<Username>").replace(sessionID, "<Session ID>"),
- getLevel(line, MessageLevel::Message));
+ emit log(censorPrivateInfo(line), getLevel(line, MessageLevel::Message));
}
if (!complete)
m_out_leftover = lines.last();
@@ -173,8 +191,8 @@ void MinecraftProcess::launch()
emit log(QString("Minecraft folder is: '%1'").arg(workingDirectory()));
QString JavaPath = m_instance->settings().get("JavaPath").toString();
emit log(QString("Java path: '%1'").arg(JavaPath));
- emit log(QString("Arguments: '%1'").arg(
- m_args.join("' '").replace(username, "<Username>").replace(sessionID, "<Session ID>")));
+ QString allArgs = m_args.join("' '");
+ emit log(QString("Arguments: '%1'").arg(censorPrivateInfo(allArgs)));
start(JavaPath, m_args);
if (!waitForStarted())
{