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:
committed by
Jonathan White
parent
6791024995
commit
7284a8062a
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user