diff --git a/CHANGELOG.md b/CHANGELOG.md index 1339c731..11146ec5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unversioned +- Minor: Disable checking for updates on unsupported platforms (#1874) - Bugfix: Fix bug preventing users from setting the highlight color of the second entry in the "User" highlights tab (#1898) ## 2.2.0 diff --git a/src/common/Version.cpp b/src/common/Version.cpp index 4e4707d2..aa8639dc 100644 --- a/src/common/Version.cpp +++ b/src/common/Version.cpp @@ -32,6 +32,12 @@ Version::Version() } this->fullVersion_ += this->version_; + +#if defined(Q_OS_WIN) || defined(Q_OS_LINUX) || defined(Q_OS_MACOS) + this->isSupportedOS_ = true; +#else + this->isSupportedOS_ = false; +#endif } const Version &Version::instance() @@ -60,4 +66,9 @@ const QString &Version::dateOfBuild() const return this->dateOfBuild_; } +const bool &Version::isSupportedOS() const +{ + return this->isSupportedOS_; +} + } // namespace chatterino diff --git a/src/common/Version.hpp b/src/common/Version.hpp index 257d6021..ab6698ca 100644 --- a/src/common/Version.hpp +++ b/src/common/Version.hpp @@ -11,6 +11,8 @@ # define CHATTERINO_OS "macos" #elif defined(Q_OS_LINUX) # define CHATTERINO_OS "linux" +#elif defined(Q_OS_FREEBSD) +# define CHATTERINO_OS "freebsd" #else # define CHATTERINO_OS "unknown" #endif @@ -26,6 +28,7 @@ public: const QString &commitHash() const; const QString &dateOfBuild() const; const QString &fullVersion() const; + const bool &isSupportedOS() const; private: Version(); @@ -34,6 +37,7 @@ private: QString commitHash_; QString dateOfBuild_; QString fullVersion_; + bool isSupportedOS_; }; }; // namespace chatterino diff --git a/src/singletons/Updates.cpp b/src/singletons/Updates.cpp index 496c508d..9acf8e1c 100644 --- a/src/singletons/Updates.cpp +++ b/src/singletons/Updates.cpp @@ -232,6 +232,14 @@ void Updates::installUpdates() void Updates::checkForUpdates() { + if (!Version::instance().isSupportedOS()) + { + qDebug() + << "Update checking disabled because OS doesn't appear to be one " + "of Windows, GNU/Linux or macOS."; + return; + } + // Disable updates if on nightly and windows. #ifdef Q_OS_WIN if (Modes::instance().isNightly) diff --git a/src/widgets/settingspages/GeneralPage.cpp b/src/widgets/settingspages/GeneralPage.cpp index 9aa7d202..47883c0c 100644 --- a/src/widgets/settingspages/GeneralPage.cpp +++ b/src/widgets/settingspages/GeneralPage.cpp @@ -5,6 +5,7 @@ #include #include "Application.hpp" +#include "common/Version.hpp" #include "singletons/Fonts.hpp" #include "singletons/Paths.hpp" #include "singletons/Theme.hpp" @@ -540,10 +541,20 @@ void GeneralPage::initLayout(SettingsLayout &layout) layout.addCheckbox("Title", s.headerStreamTitle); layout.addTitle("Beta"); - layout.addDescription( - "You can receive updates earlier by ticking the box below. Report " - "issues here."); - layout.addCheckbox("Receive beta updates", s.betaUpdates); + if (Version::instance().isSupportedOS()) + { + layout.addDescription( + "You can receive updates earlier by ticking the box below. Report " + "issues here."); + layout.addCheckbox("Receive beta updates", s.betaUpdates); + } + else + { + layout.addDescription( + "Your operating system is not officially supplied with builds. For " + "updates, please rebuild chatterino from sources. Report " + "issues here."); + } #ifdef Q_OS_WIN layout.addTitle("Browser Integration");