added saving the list of clients for wireguard

- added error handling when getting/saving a list of clients
This commit is contained in:
vladimir.kuznetsov 2023-01-11 20:36:47 +03:00
parent 8c137ecc52
commit a7030cdcb9
5 changed files with 87 additions and 53 deletions

View file

@ -21,11 +21,15 @@ void ClientManagementModel::setContent(const QVector<QVariant> &data)
endResetModel();
}
QJsonObject ClientManagementModel::getContent()
QJsonObject ClientManagementModel::getContent(Proto protocol)
{
QJsonObject clientsTable;
for (const auto &item : m_content) {
clientsTable[item.toJsonObject()["openvpnCertId"].toString()] = item.toJsonObject();
if (protocol == Proto::OpenVpn) {
clientsTable[item.toJsonObject()["openvpnCertId"].toString()] = item.toJsonObject();
} else if (protocol == Proto::WireGuard) {
clientsTable[item.toJsonObject()["wireguardPublicKey"].toString()] = item.toJsonObject();
}
}
return clientsTable;
}