From 97dd16a87a3b398028c1408d24209ade329c78d2 Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Fri, 10 Jul 2020 14:54:02 -0400 Subject: don't log old nexus username and password they're not supposed to be in the INI anymore, but the migration code looks broken and some users still have them --- src/settings.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/settings.cpp') diff --git a/src/settings.cpp b/src/settings.cpp index 55283486..b1385c05 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -463,7 +463,7 @@ QSettings::Status Settings::sync() const void Settings::dump() const { static const QStringList ignore({ - "username", "password", "nexus_api_key" + "username", "password", "nexus_api_key", "nexus_username", "nexus_password" }); log::debug("settings:"); -- cgit v1.3.1 From e0db7177b49ad73ab5296bc90a359d63a5503cbe Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Fri, 10 Jul 2020 15:04:54 -0400 Subject: added hidden validation_timeouts setting --- src/nxmaccessmanager.cpp | 6 ++++-- src/settings.cpp | 34 ++++++++++++++++++++++++++++++++++ src/settings.h | 2 ++ 3 files changed, 40 insertions(+), 2 deletions(-) (limited to 'src/settings.cpp') diff --git a/src/nxmaccessmanager.cpp b/src/nxmaccessmanager.cpp index 0064f888..2fe676ba 100644 --- a/src/nxmaccessmanager.cpp +++ b/src/nxmaccessmanager.cpp @@ -611,17 +611,19 @@ void NexusKeyValidator::start(const QString& key, Behaviour b) m_key = key; + const auto timeouts = Settings::instance().nexus().validationTimeouts(); + switch (b) { case OneShot: { - createAttempts({10s}); + createAttempts({timeouts[0]}); break; } case Retry: { - createAttempts({10s, 15s, 20s}); + createAttempts(timeouts); break; } } diff --git a/src/settings.cpp b/src/settings.cpp index b1385c05..534e67c8 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -1868,6 +1868,40 @@ void NexusSettings::registerAsNXMHandler(bool force) } } +std::vector NexusSettings::validationTimeouts() const +{ + using namespace std::chrono_literals; + + const auto s = get( + m_Settings, "Settings", "validation_timeouts", ""); + + const auto numbers = s.split(" "); + std::vector v; + + for (auto ns : numbers) + { + ns = ns.trimmed(); + if (ns.isEmpty()) + continue; + + bool ok = false; + const auto n = ns.toInt(&ok); + + if (!ok || n < 0 || n > 100) + { + log::error("bad validation_timeouts number '{}'", ns); + continue; + } + + v.push_back(std::chrono::seconds(n)); + } + + if (v.empty()) + v = {10s, 15s, 20s}; + + return v; +} + SteamSettings::SteamSettings(Settings& parent, QSettings& settings) : m_Parent(parent), m_Settings(settings) diff --git a/src/settings.h b/src/settings.h index 9d788664..636719bb 100644 --- a/src/settings.h +++ b/src/settings.h @@ -521,6 +521,8 @@ public: // void registerAsNXMHandler(bool force); + std::vector validationTimeouts() const; + private: Settings& m_Parent; QSettings& m_Settings; -- cgit v1.3.1