1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

fix(crash): Handle nightly tag name in update check

We didn't use to have a nightly tag, so git describe would include the
verison of the last release even for nightly or dev builds. Now that the
nightly tag exists, which is required for github release craeation, it
breaks out git describe parsing, and there's no way for us to tell if a
user is behind the next release or not.

Instead just don't check update status if the user isn't on a release
tagged version.
This commit is contained in:
Anthony Bilinski 2022-02-18 11:39:34 -08:00
parent 1031b315b9
commit ddebf6ee7a
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C
2 changed files with 9 additions and 7 deletions

View File

@ -102,6 +102,7 @@ bool isCurrentVersionStable()
UpdateCheck::UpdateCheck(const Settings& settings)
: settings(settings)
{
qInfo() << "qTox is running version:" << GIT_DESCRIBE;
updateTimer.start(1000 * 60 * 60 * 24 /* 1 day */);
connect(&updateTimer, &QTimer::timeout, this, &UpdateCheck::checkForUpdate);
connect(&manager, &QNetworkAccessManager::finished, this, &UpdateCheck::handleResponse);
@ -113,6 +114,13 @@ void UpdateCheck::checkForUpdate()
// still run the timer to check periodically incase setting changes
return;
}
if (isCurrentVersionStable() == false) {
qWarning() << "Currently running an untested/unstable version of qTox";
emit versionIsUnstable();
return;
}
manager.setProxy(settings.getProxy());
QNetworkRequest request{versionUrl};
manager.get(request);
@ -120,13 +128,6 @@ void UpdateCheck::checkForUpdate()
void UpdateCheck::handleResponse(QNetworkReply* reply)
{
qInfo() << "qTox is running version:" << GIT_DESCRIBE;
if (isCurrentVersionStable() == false) {
qWarning() << "Currently running an untested/unstable version of qTox";
emit versionIsUnstable();
}
assert(reply != nullptr);
if (reply == nullptr) {
qWarning() << "Update check returned null reply, ignoring";

View File

@ -197,6 +197,7 @@ void AboutForm::reloadTheme()
void AboutForm::onUnstableVersion()
{
bodyUI->updateStack->hide();
bodyUI->unstableVersion->setVisible(true);
}