dashboard: openvpn clients: missing endpoint and minor cleanup

This commit is contained in:
Stephan de Wit 2024-07-11 14:10:02 +02:00
parent 22fa1e33d4
commit af6180d631
2 changed files with 3 additions and 2 deletions

View File

@ -289,6 +289,7 @@
<filename>OpenVPNClients.js</filename>
<endpoints>
<endpoint>/api/openvpn/service/search_sessions</endpoint>
<endpoint>/api/openvpn/service/kill_session</endpoint>
</endpoints>
<translations>
<title>OpenVPN Client Connections</title>

View File

@ -53,11 +53,11 @@ export default class OpenVPNClients extends BaseTableWidget {
async _killClient(id, commonName) {
let split = id.split('_');
let params = {server_id: split[0], session_id: split[1]};
await this.ajaxCall('/api/openvpn/service/kill_session/', JSON.stringify(params), 'POST').then(async (data) => {
await this.ajaxCall('/api/openvpn/service/kill_session', JSON.stringify(params), 'POST').then(async (data) => {
if (data && data.status === 'not_found') {
// kill by common name
params.session_id = commonName;
await this.ajaxCall('/api/openvpn/service/kill_session/', JSON.stringify(params), 'POST');
await this.ajaxCall('/api/openvpn/service/kill_session', JSON.stringify(params), 'POST');
}
});
}