diff --git a/app/src/checkupdatesdialog.cpp b/app/src/checkupdatesdialog.cpp index 201f1ba15..99460884f 100644 --- a/app/src/checkupdatesdialog.cpp +++ b/app/src/checkupdatesdialog.cpp @@ -1,4 +1,4 @@ -#include "checkupdatesdialog.h" +#include "checkupdatesdialog.h" #include #include #include @@ -78,7 +78,7 @@ void CheckUpdatesDialog::startChecking() void CheckUpdatesDialog::regularBuildCheck() { mNetworkManager = new QNetworkAccessManager(this); - QUrl url("http://github.com/pencil2d/pencil/releases.atom"); + QUrl url("https://github.com/pencil2d/pencil/releases.atom"); QNetworkRequest req; req.setUrl(url); @@ -108,6 +108,24 @@ void CheckUpdatesDialog::networkErrorHappened() mDownloadButton->setEnabled(false); } +void CheckUpdatesDialog::networkResponseIsEmpty() +{ + mTitleLabel->setText(tr("An error occurred while checking for updates", "error msg of check-for-update")); + mDetailLabel->setText(tr("Network response is empty", "error msg of check-for-update")); + mProgressBar->setRange(0, 1); + mProgressBar->setValue(1); + mDownloadButton->setEnabled(false); +} + +void CheckUpdatesDialog::invalidReleaseXml() +{ + mTitleLabel->setText(tr("An error occurred while checking for updates", "error msg of check-for-update")); + mDetailLabel->setText(tr("Couldn't retrieve the version information", "error msg of check-for-update")); + mProgressBar->setRange(0, 1); + mProgressBar->setValue(1); + mDownloadButton->setEnabled(false); +} + void CheckUpdatesDialog::networkRequestFinished(QNetworkReply* reply) { reply->deleteLater(); @@ -122,9 +140,18 @@ void CheckUpdatesDialog::networkRequestFinished(QNetworkReply* reply) } auto releasesAtom = QString::fromUtf8(reply->readAll()).trimmed(); - //qDebug() << releasesAtom; + if (releasesAtom.isEmpty()) + { + networkResponseIsEmpty(); + return; + } QString latestVersionString = getVersionNumberFromXml(releasesAtom); + if (latestVersionString == "0.0.1") + { + invalidReleaseXml(); + return; + } bool isNewVersionAvailable = compareVersion(APP_VERSION, latestVersionString); if (isNewVersionAvailable) @@ -153,7 +180,7 @@ bool CheckUpdatesDialog::compareVersion(QString currentVersion, QString latestVe QString CheckUpdatesDialog::getVersionNumberFromXml(QString xml) { - // XML source: http://github.com/pencil2d/pencil/releases.atom + // XML source: https://github.com/pencil2d/pencil/releases.atom QXmlStreamReader xmlReader(xml); diff --git a/app/src/checkupdatesdialog.h b/app/src/checkupdatesdialog.h index 5380dc4be..f89e05b5d 100644 --- a/app/src/checkupdatesdialog.h +++ b/app/src/checkupdatesdialog.h @@ -1,4 +1,4 @@ -#ifndef CHECKUPDATESDIALOG_H +#ifndef CHECKUPDATESDIALOG_H #define CHECKUPDATESDIALOG_H #include @@ -24,6 +24,8 @@ class CheckUpdatesDialog : public QDialog void regularBuildCheck(); void nightlyBuildCheck(); void networkErrorHappened(); + void networkResponseIsEmpty(); + void invalidReleaseXml(); void networkRequestFinished(QNetworkReply* reply); bool compareVersion(QString currentVersion, QString latestVersion); diff --git a/util/after-build.ps1 b/util/after-build.ps1 index 586e031c2..f46ac10b0 100644 --- a/util/after-build.ps1 +++ b/util/after-build.ps1 @@ -14,6 +14,18 @@ $arch = switch ($platform) { default {"Unknown"; break} } +$libcrypto = switch ($platform) { + "x86" {"C:\OpenSSL-v111-Win32\bin\libcrypto-1_1.dll"; break} + "amd64" {"C:\OpenSSL-v111-Win64\bin\libcrypto-1_1-x64.dll"; break} + default {""; break} +} + +$libssl = switch ($platform) { + "x86" {"C:\OpenSSL-v111-Win32\bin\libssl-1_1.dll"; break} + "amd64" {"C:\OpenSSL-v111-Win64\bin\libssl-1_1-x64.dll"; break} + default {""; break} +} + [string]$ffmpegFileName = "ffmpeg-4.1.1-$arch-static" [string]$ffmpegUrl = "https://ffmpeg.zeranoe.com/builds/$arch/static/$ffmpegFileName.zip" @@ -43,15 +55,19 @@ Remove-Item -Path "./$ffmpegFileName" -Recurse Remove-Item -Path "./Pencil2D" -Recurse -ErrorAction SilentlyContinue Copy-Item -Path "./bin" -Destination "./Pencil2D" -Recurse +Remove-Item -Path "./Pencil2D/*.pdb" +Remove-Item -Path "./Pencil2D/*.ilk" echo ">>> Deploying Qt libraries" & "windeployqt" @("Pencil2D/pencil2d.exe") +echo ">>> Copy OpenSSL DLLs" +Copy-Item $libcrypto -Destination "./Pencil2D" +Copy-Item $libssl -Destination "./Pencil2D" + echo ">>> Zipping bin folder" -Remove-Item -Path "./Pencil2D/*.pdb" -Remove-Item -Path "./Pencil2D/*.ilk" Compress-Archive -Path "./Pencil2D" -DestinationPath "./Pencil2D.zip" $today = Get-Date -Format "yyyy-MM-dd"