refactor: do not stop sever on new client fingerprint, track the last print we checked and if we are chekcing it do not show a new box
This commit is contained in:
parent
1003de21b5
commit
4f2ef7174a
2 changed files with 18 additions and 11 deletions
|
|
@ -790,19 +790,26 @@ void MainWindow::checkFingerprint(const QString &line)
|
||||||
deskflow::string::fromHex(match.captured(1).toStdString())
|
deskflow::string::fromHex(match.captured(1).toStdString())
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const auto sha256Text = match.captured(2);
|
||||||
|
|
||||||
const deskflow::FingerprintData sha256 = {
|
const deskflow::FingerprintData sha256 = {
|
||||||
deskflow::fingerprintTypeToString(deskflow::FingerprintType::SHA256),
|
deskflow::fingerprintTypeToString(deskflow::FingerprintType::SHA256),
|
||||||
deskflow::string::fromHex(match.captured(2).toStdString())
|
deskflow::string::fromHex(sha256Text.toStdString())
|
||||||
};
|
};
|
||||||
|
|
||||||
// Only Save the sha256
|
if (m_checkedPeers.contains(sha256Text)) {
|
||||||
deskflow::FingerprintDatabase db;
|
qDebug("ignoring fingerprint, already handled");
|
||||||
db.read(trustedFingerprintDb().toStdString());
|
|
||||||
if (db.isTrusted(sha256)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
m_checkedPeers.append(sha256Text);
|
||||||
|
|
||||||
m_coreProcess.stop();
|
deskflow::FingerprintDatabase db;
|
||||||
|
db.read(trustedFingerprintDb().toStdString());
|
||||||
|
|
||||||
|
if (db.isTrusted(sha256)) {
|
||||||
|
qDebug("fingerprint is trusted");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const bool isClient = m_coreProcess.mode() == CoreMode::Client;
|
const bool isClient = m_coreProcess.mode() == CoreMode::Client;
|
||||||
auto dialogMode = isClient ? FingerprintDialogMode::Client : FingerprintDialogMode::Server;
|
auto dialogMode = isClient ? FingerprintDialogMode::Client : FingerprintDialogMode::Server;
|
||||||
|
|
@ -813,7 +820,7 @@ void MainWindow::checkFingerprint(const QString &line)
|
||||||
if (fingerprintDialog.exec() == QDialog::Accepted) {
|
if (fingerprintDialog.exec() == QDialog::Accepted) {
|
||||||
db.addTrusted(sha256);
|
db.addTrusted(sha256);
|
||||||
db.write(trustedFingerprintDb().toStdString());
|
db.write(trustedFingerprintDb().toStdString());
|
||||||
m_coreProcess.start();
|
m_checkedPeers.removeAll(sha256Text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -188,12 +188,14 @@ private:
|
||||||
// Returns true if successful
|
// Returns true if successful
|
||||||
bool regenerateLocalFingerprints();
|
bool regenerateLocalFingerprints();
|
||||||
|
|
||||||
|
inline static const auto m_guiSocketName = QStringLiteral("deskflow-gui");
|
||||||
|
inline static const auto m_nameRegEx = QRegularExpression(QStringLiteral("^[\\w\\-_\\.]{0,255}$"));
|
||||||
|
|
||||||
VersionChecker m_versionChecker;
|
VersionChecker m_versionChecker;
|
||||||
bool m_secureSocket = false;
|
bool m_secureSocket = false;
|
||||||
deskflow::gui::config::ServerConfigDialogState m_serverConfigDialogState;
|
deskflow::gui::config::ServerConfigDialogState m_serverConfigDialogState;
|
||||||
bool m_saveOnExit = true;
|
bool m_saveOnExit = true;
|
||||||
deskflow::gui::core::WaylandWarnings m_waylandWarnings;
|
deskflow::gui::core::WaylandWarnings m_waylandWarnings;
|
||||||
|
|
||||||
deskflow::gui::ConfigScopes &m_configScopes;
|
deskflow::gui::ConfigScopes &m_configScopes;
|
||||||
AppConfig &m_appConfig;
|
AppConfig &m_appConfig;
|
||||||
ServerConfig m_serverConfig;
|
ServerConfig m_serverConfig;
|
||||||
|
|
@ -202,11 +204,9 @@ private:
|
||||||
deskflow::gui::ClientConnection m_clientConnection;
|
deskflow::gui::ClientConnection m_clientConnection;
|
||||||
deskflow::gui::TlsUtility m_tlsUtility;
|
deskflow::gui::TlsUtility m_tlsUtility;
|
||||||
QSize m_expandedSize = QSize();
|
QSize m_expandedSize = QSize();
|
||||||
|
QStringList m_checkedPeers;
|
||||||
QSystemTrayIcon *m_trayIcon = nullptr;
|
QSystemTrayIcon *m_trayIcon = nullptr;
|
||||||
QLocalServer *m_guiDupeChecker = nullptr;
|
QLocalServer *m_guiDupeChecker = nullptr;
|
||||||
inline static const auto m_guiSocketName = QStringLiteral("deskflow-gui");
|
|
||||||
inline static const auto m_nameRegEx = QRegularExpression(QStringLiteral("^[\\w\\-_\\.]{0,255}$"));
|
|
||||||
|
|
||||||
QLabel *m_lblSecurityStatus = nullptr;
|
QLabel *m_lblSecurityStatus = nullptr;
|
||||||
QLabel *m_lblStatus = nullptr;
|
QLabel *m_lblStatus = nullptr;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue