Avoid greeting new users with "insufficient configuration" error

This commit is contained in:
Martchus 2022-10-02 19:45:22 +02:00
parent b0d1197cb7
commit 722e9f6e7d
2 changed files with 10 additions and 2 deletions

View File

@ -24,15 +24,21 @@ bool InternalError::isRelevant(const SyncthingConnection &connection, SyncthingE
}
// skip further considerations if connection is remote
if (!connection.isLocal()) {
if (!connection.syncthingUrl().isEmpty() && !connection.isLocal()) {
return true;
}
// ignore configuration errors on first launch (to avoid greeting people with an error message)
const auto &settings = Settings::values();
if ((settings.firstLaunch || settings.fakeFirstLaunch)
&& (category == SyncthingErrorCategory::OverallConnection && networkError == QNetworkReply::NoError)) {
return false;
}
// consider process/launcher or systemd unit status
const auto remoteHostClosed(networkError == QNetworkReply::RemoteHostClosedError || networkError == QNetworkReply::ProxyConnectionClosedError);
// ignore "remote host closed" error if we've just stopped Syncthing ourselves
const auto *launcher(SyncthingLauncher::mainInstance());
const auto &settings = Settings::values();
if (settings.launcher.considerForReconnect && remoteHostClosed && launcher && launcher->isManuallyStopped()) {
return false;
}

View File

@ -78,6 +78,8 @@ Wizard::Wizard(QWidget *parent, Qt::WindowFlags flags)
Wizard::~Wizard()
{
auto &settings = Settings::values();
settings.firstLaunch = settings.fakeFirstLaunch = false;
if (this == s_instance) {
s_instance = nullptr;
}