added saving the list of clients for wireguard
- added error handling when getting/saving a list of clients
This commit is contained in:
parent
8c137ecc52
commit
a7030cdcb9
5 changed files with 87 additions and 53 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue