From eb19547b454b4dfdefe716f1e21a24ff9c5ddce3 Mon Sep 17 00:00:00 2001 From: sithlord48 Date: Tue, 11 Feb 2025 10:17:55 -0500 Subject: [PATCH] refactor: mainwindow force regen of local prints if tls is enabled with a sha256 key --- src/apps/deskflow-gui/MainWindow.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/apps/deskflow-gui/MainWindow.cpp b/src/apps/deskflow-gui/MainWindow.cpp index c2d7b9838..fef20d190 100644 --- a/src/apps/deskflow-gui/MainWindow.cpp +++ b/src/apps/deskflow-gui/MainWindow.cpp @@ -154,6 +154,21 @@ MainWindow::MainWindow(ConfigScopes &configScopes, AppConfig &appConfig) qDebug().noquote() << "active settings path:" << m_configScopes.activeFilePath(); updateSize(); + + // Force generation of SHA256 for the localhost + if (m_appConfig.tlsEnabled()) { + auto localPath = QStringLiteral("%1/%2").arg(getTlsPath(), kFingerprintLocalFilename).toStdString(); + if (!QFile::exists(QString::fromStdString(localPath))) { + regenerateLocalFingerprints(); + return; + } + + deskflow::FingerprintDatabase db; + db.read(localPath); + if (db.fingerprints().size() != 2) { + regenerateLocalFingerprints(); + } + } } MainWindow::~MainWindow()