mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-08-08 14:32:39 -04:00
Fix password generator responses (#7404)
* Respond directly to the current client instead of broadcasting * Append requestID to generate-password response
This commit is contained in:
parent
6791024995
commit
7284a8062a
10 changed files with 500 additions and 316 deletions
|
@ -88,18 +88,29 @@ void BrowserHost::readProxyMessage()
|
|||
return;
|
||||
}
|
||||
|
||||
emit clientMessageReceived(json.object());
|
||||
emit clientMessageReceived(socket, json.object());
|
||||
}
|
||||
|
||||
void BrowserHost::sendClientMessage(const QJsonObject& json)
|
||||
void BrowserHost::broadcastClientMessage(const QJsonObject& json)
|
||||
{
|
||||
QString reply(QJsonDocument(json).toJson(QJsonDocument::Compact));
|
||||
for (const auto socket : m_socketList) {
|
||||
if (socket && socket->isValid() && socket->state() == QLocalSocket::ConnectedState) {
|
||||
QByteArray arr = reply.toUtf8();
|
||||
socket->write(arr.constData(), arr.length());
|
||||
socket->flush();
|
||||
}
|
||||
sendClientData(socket, reply);
|
||||
}
|
||||
}
|
||||
|
||||
void BrowserHost::sendClientMessage(QLocalSocket* socket, const QJsonObject& json)
|
||||
{
|
||||
QString reply(QJsonDocument(json).toJson(QJsonDocument::Compact));
|
||||
sendClientData(socket, reply);
|
||||
}
|
||||
|
||||
void BrowserHost::sendClientData(QLocalSocket* socket, const QString& data)
|
||||
{
|
||||
if (socket && socket->isValid() && socket->state() == QLocalSocket::ConnectedState) {
|
||||
QByteArray arr = data.toUtf8();
|
||||
socket->write(arr.constData(), arr.length());
|
||||
socket->flush();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue