summaryrefslogtreecommitdiffstats
path: root/logic
diff options
context:
space:
mode:
Diffstat (limited to 'logic')
-rw-r--r--logic/auth/YggdrasilTask.cpp24
-rw-r--r--logic/auth/YggdrasilTask.h2
-rw-r--r--logic/updater/DownloadUpdateTask.cpp31
-rw-r--r--logic/updater/DownloadUpdateTask.h2
4 files changed, 57 insertions, 2 deletions
diff --git a/logic/auth/YggdrasilTask.cpp b/logic/auth/YggdrasilTask.cpp
index 573dd57a..3ba53bd7 100644
--- a/logic/auth/YggdrasilTask.cpp
+++ b/logic/auth/YggdrasilTask.cpp
@@ -48,6 +48,7 @@ void YggdrasilTask::executeTask()
connect(m_netReply, &QNetworkReply::finished, this, &YggdrasilTask::processReply);
connect(m_netReply, &QNetworkReply::uploadProgress, this, &YggdrasilTask::refreshTimers);
connect(m_netReply, &QNetworkReply::downloadProgress, this, &YggdrasilTask::refreshTimers);
+ connect(m_netReply, &QNetworkReply::sslErrors, this, &YggdrasilTask::sslErrors);
timeout_keeper.setSingleShot(true);
timeout_keeper.start(timeout_max);
counter.setSingleShot(false);
@@ -75,10 +76,33 @@ void YggdrasilTask::abort()
m_netReply->abort();
}
+void YggdrasilTask::sslErrors(QList<QSslError> errors)
+{
+ int i = 1;
+ for(auto error: errors)
+ {
+ QLOG_ERROR() << "LOGIN SSL Error #" << i << " : " << error.errorString();
+ auto cert = error.certificate();
+ QLOG_ERROR() << "Certificate in question:\n" << cert.toText();
+ i++;
+ }
+}
+
void YggdrasilTask::processReply()
{
setStatus(getStateMessage(STATE_PROCESSING_RESPONSE));
+ if (m_netReply->error() == QNetworkReply::SslHandshakeFailedError)
+ {
+ emitFailed(tr("<b>SSL Handshake failed.</b><br/>There might be a few causes for it:<br/>"
+ "<ul>"
+ "<li>You use Windows XP and need to <a href=\"http://www.microsoft.com/en-us/download/details.aspx?id=38918\">update your root certificates</a></li>"
+ "<li>Some device on your network is interfering with SSL traffic. In that case, you have bigger worries than Minecraft not starting.</li>"
+ "<li>Possibly something else. Check the MultiMC log file for details</li>"
+ "</ul>"));
+ return;
+ }
+
// any network errors lead to offline mode right now
if (m_netReply->error() >= QNetworkReply::ConnectionRefusedError &&
m_netReply->error() <= QNetworkReply::UnknownNetworkError)
diff --git a/logic/auth/YggdrasilTask.h b/logic/auth/YggdrasilTask.h
index 1f81a2d0..85f5a1e1 100644
--- a/logic/auth/YggdrasilTask.h
+++ b/logic/auth/YggdrasilTask.h
@@ -20,6 +20,7 @@
#include <QString>
#include <QJsonObject>
#include <QTimer>
+#include <qsslerror.h>
#include "logic/auth/MojangAccount.h"
@@ -99,6 +100,7 @@ slots:
void processReply();
void refreshTimers(qint64, qint64);
void heartbeat();
+ void sslErrors(QList<QSslError>);
public
slots:
diff --git a/logic/updater/DownloadUpdateTask.cpp b/logic/updater/DownloadUpdateTask.cpp
index cffac75f..5f05b0ba 100644
--- a/logic/updater/DownloadUpdateTask.cpp
+++ b/logic/updater/DownloadUpdateTask.cpp
@@ -375,6 +375,9 @@ DownloadUpdateTask::processFileLists(NetJob *job,
// yep. this file actually needs an upgrade. PROCEED.
QLOG_DEBUG() << "Found file" << entry.path << " that needs updating.";
+ // if it's the updater we want to treat it separately
+ bool isUpdater = entry.path.endsWith("updater") || entry.path.endsWith("updater.exe");
+
// Go through the sources list and find one to use.
// TODO: Make a NetAction that takes a source list and tries each of them until one
// works. For now, we'll just use the first http one.
@@ -396,10 +399,19 @@ DownloadUpdateTask::processFileLists(NetJob *job,
auto download = MD5EtagDownload::make(source.url, dlPath);
download->m_expected_md5 = entry.md5;
job->addNetAction(download);
+
+ if (isUpdater)
+ {
+ download->setProperty("finalPath", entry.path);
+ connect(download.get(), &MD5EtagDownload::succeeded, this, &DownloadUpdateTask::directDeployFile);
+ }
}
- // Now add a copy operation to our operations list to install the file.
- ops.append(UpdateOperation::CopyOp(dlPath, entry.path, entry.mode));
+ if (!isUpdater)
+ {
+ // Now add a copy operation to our operations list to install the file.
+ ops.append(UpdateOperation::CopyOp(dlPath, entry.path, entry.mode));
+ }
}
}
}
@@ -510,6 +522,21 @@ void DownloadUpdateTask::fileDownloadProgressChanged(qint64 current, qint64 tota
setProgress((int)(((float)current / (float)total) * 100));
}
+void DownloadUpdateTask::directDeployFile(const int index)
+{
+ Md5EtagDownloadPtr download = std::dynamic_pointer_cast<MD5EtagDownload>(m_filesNetJob->operator[](index));
+ const QString finalPath = download->property("finalPath").toString();
+ QLOG_INFO() << "Replacing" << finalPath << "with" << download->m_output_file.fileName();
+ if (QFile::remove(finalPath))
+ {
+ if (download->m_output_file.copy(finalPath))
+ {
+ return;
+ }
+ }
+ emitFailed("Couldn't copy updater files");
+}
+
QString DownloadUpdateTask::updateFilesDir()
{
return m_updateFilesDir.path();
diff --git a/logic/updater/DownloadUpdateTask.h b/logic/updater/DownloadUpdateTask.h
index 1fc14049..79d73af3 100644
--- a/logic/updater/DownloadUpdateTask.h
+++ b/logic/updater/DownloadUpdateTask.h
@@ -207,5 +207,7 @@ protected slots:
void fileDownloadFinished();
void fileDownloadFailed();
void fileDownloadProgressChanged(qint64 current, qint64 total);
+
+ void directDeployFile(const int index);
};