Feature: console command to change authorized keys

This commit is contained in:
Rubidium
2024-03-17 19:11:55 +01:00
committed by rubidium42
parent b7dfa3eb90
commit 4af089b9be
4 changed files with 112 additions and 0 deletions

View File

@@ -61,6 +61,7 @@ bool NetworkCompanyIsPassworded(CompanyID company_id);
uint NetworkMaxCompaniesAllowed();
bool NetworkMaxCompaniesReached();
void NetworkPrintClients();
std::string_view NetworkGetPublicKeyOfClient(ClientID client_id);
void NetworkHandlePauseChange(PauseMode prev_mode, PauseMode changed_mode);
/*** Commands ran by the server ***/

View File

@@ -2243,6 +2243,18 @@ void NetworkPrintClients()
}
}
/**
* Get the public key of the client with the given id.
* @param client_id The id of the client.
* @return View of the public key, which is empty when the client does not exist.
*/
std::string_view NetworkGetPublicKeyOfClient(ClientID client_id)
{
auto socket = NetworkClientSocket::GetByClientID(client_id);
return socket == nullptr ? "" : socket->GetPeerPublicKey();
}
/**
* Perform all the server specific administration of a new company.
* @param c The newly created company; can't be nullptr.

View File

@@ -121,6 +121,7 @@ public:
}
const std::string &GetClientIP();
std::string_view GetPeerPublicKey() const { return this->peer_public_key; }
static ServerNetworkGameSocketHandler *GetByClientID(ClientID client_id);
};