Skip to content

Commit 12fbe05

Browse files
committed
Download new version over HTTPS
1 parent 4d66afd commit 12fbe05

File tree

4 files changed

+28
-4
lines changed

4 files changed

+28
-4
lines changed

installer/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ Put these files in `data` directory before running `setup.iss` or `package.bat`:
1111
* Qt5Network.dll
1212
* Qt5Widgets.dll
1313
* Qt5Xml.dll
14+
* libeay32.dll
15+
* ssleay32.dll
1416
* imageformats/qgif.dll
1517
* imageformats/qjpeg.dll
1618
* platforms/qwindows.dll

src/constants.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
#define APP_HOMEPAGE "https://www.strangeplanet.fr/work/umwp-autochanger"
2222
#define APP_DOCUMENTATION_URL "https://www.strangeplanet.fr/work/umwp-autochanger/#help"
23-
#define APP_VERSION_URL "http://www.strangeplanet.fr/work/umwp-autochanger/last-version.txt"
23+
#define APP_VERSION_URL "https://www.strangeplanet.fr/work/umwp-autochanger/last-version.txt"
2424
#define APP_ISSUES_URL "https://github.com/mistic100/UMWP-Autochanger/issues"
2525

2626
#define APP_INSTALLER_SIZE 12000000

src/gui/newversiondialog.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,14 @@ void NewVersionDialog::on_updateButton_clicked()
6060
QLOG_DEBUG() << "Download" << m_version.link;
6161

6262
QNetworkAccessManager* manager = new QNetworkAccessManager();
63-
m_reply = manager->get(QNetworkRequest(QUrl(m_version.link)));
63+
64+
QNetworkRequest request(QUrl(m_version.link));
65+
if (m_version.link.startsWith("https"))
66+
{
67+
request.setSslConfiguration(QSslConfiguration::defaultConfiguration());
68+
}
69+
70+
m_reply = manager->get(request);
6471

6572
connect(m_reply, SIGNAL(readyRead()), this, SLOT(onDataReady()));
6673
connect(m_reply, SIGNAL(finished()), this, SLOT(onDownloadFinished()));
@@ -114,7 +121,7 @@ void NewVersionDialog::onDownloadFinished()
114121

115122
if (m_reply->error() != QNetworkReply::NoError)
116123
{
117-
QLOG_ERROR() << "Network error";
124+
QLOG_ERROR() << m_reply->errorString();
118125

119126
m_file.remove();
120127
errorMessage();

src/versionchecker.h

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,14 @@ public slots:
2323
{
2424
QNetworkAccessManager* manager = new QNetworkAccessManager();
2525
connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(downloadFinished(QNetworkReply*)));
26-
manager->get(QNetworkRequest(QUrl(APP_VERSION_URL)));
26+
27+
QNetworkRequest request(QUrl(APP_VERSION_URL));
28+
if (QString(APP_VERSION_URL).startsWith("https"))
29+
{
30+
request.setSslConfiguration(QSslConfiguration::defaultConfiguration());
31+
}
32+
33+
manager->get(request);
2734
}
2835

2936
private slots:
@@ -35,13 +42,21 @@ private slots:
3542
version.code = _reply->readLine().trimmed();
3643
version.link = _reply->readLine().trimmed();
3744
version.hash = _reply->readLine().trimmed();
45+
if (QString(APP_VERSION_URL).startsWith("https"))
46+
{
47+
version.link = version.link.replace("http://", "https://");
48+
}
3849

3950
if (version.code.compare(APP_VERSION) > 0)
4051
{
4152
QLOG_DEBUG() << "New version detected: " << version.code;
4253
emit newVersionAvailable(version);
4354
}
4455
}
56+
else
57+
{
58+
QLOG_ERROR() << _reply->errorString();
59+
}
4560

4661
_reply->manager()->deleteLater();
4762
_reply->deleteLater();

0 commit comments

Comments
 (0)