refactor: Messages::showNewClientPrompt check if server auth is needed when the message is shown not in the signal

This commit is contained in:
sithlord48 2026-04-04 14:29:49 -04:00 committed by Nick Bolton
parent 047451696a
commit d8e9ac27f5
6 changed files with 9 additions and 10 deletions

View file

@ -1187,10 +1187,10 @@ void MainWindow::showClientError(deskflow::client::ErrorType error, const QStrin
m_clientErrorVisible = false;
}
void MainWindow::handleNewClientPromptRequest(const QString &clientName, bool usePeerAuth)
void MainWindow::handleNewClientPromptRequest(const QString &clientName)
{
showAndActivate();
bool result = deskflow::gui::messages::showNewClientPrompt(this, clientName, usePeerAuth);
bool result = deskflow::gui::messages::showNewClientPrompt(this, clientName);
m_serverConnection.handleNewClientResult(clientName, result);
}

View file

@ -140,7 +140,7 @@ private:
void daemonIpcClientConnectionFailed();
void toggleCanRunCore(bool enableButtons);
void remoteHostChanged(const QString &newRemoteHost);
void handleNewClientPromptRequest(const QString &clientName, bool usePeerAuth);
void handleNewClientPromptRequest(const QString &clientName);
void updateIpLabel(const QStringList &addresses);
void updateTimeoutDelay(int newDelay);

View file

@ -184,9 +184,10 @@ void showFirstConnectedMessage(QWidget *parent)
QMessageBox::information(parent, title, message);
}
bool showNewClientPrompt(QWidget *parent, const QString &clientName, bool serverRequiresPeerAuth)
bool showNewClientPrompt(QWidget *parent, const QString &clientName)
{
if (serverRequiresPeerAuth) {
if (Settings::value(Settings::Security::TlsEnabled).toBool() &&
Settings::value(Settings::Security::CheckPeers).toBool()) {
// When peer auth is enabled you will be prompted to allow the connection before seeing this dialog.
// This is why we do not show a dialog with an option to ignore the new client
QMessageBox::information(

View file

@ -25,7 +25,7 @@ void showFirstConnectedMessage(QWidget *parent);
void showCloseReminder(QWidget *parent);
bool showNewClientPrompt(QWidget *parent, const QString &clientName, bool serverRequiresPeerAuth = false);
bool showNewClientPrompt(QWidget *parent, const QString &clientName);
bool showClearSettings(QWidget *parent);

View file

@ -82,9 +82,7 @@ void ServerConnection::handleNewClient(const QString &clientName)
}
m_messageShowing = true;
const bool tlsEnabled = Settings::value(Settings::Security::TlsEnabled).toBool();
const bool requireCerts = Settings::value(Settings::Security::CheckPeers).toBool();
Q_EMIT requestNewClientPrompt(clientName, tlsEnabled && requireCerts);
Q_EMIT requestNewClientPrompt(clientName);
}
void ServerConnection::handleNewClientResult(const QString &clientName, bool acceptClient)

View file

@ -31,7 +31,7 @@ public:
void handleNewClientResult(const QString &clientName, bool acceptClient);
Q_SIGNALS:
void requestNewClientPrompt(const QString &clientName, bool peerAuthRequired);
void requestNewClientPrompt(const QString &clientName);
void configureClient(const QString &clientName);
void clientsChanged(const QStringList &clients);