feat: Added readme API new endpoints

This commit is contained in:
infosave2007
2026-01-29 08:56:28 +03:00
parent 0e144f2d01
commit 2f38cd58a3
2 changed files with 20 additions and 2 deletions
+10 -2
View File
@@ -253,16 +253,24 @@ DELETE /api/servers/{id}/delete - Delete server by ID
GET /api/servers/{id}/clients - List clients on server
```
### Protocols
```
GET /api/protocols/active - List all available protocols (with IDs)
GET /api/servers/{id}/protocols - List installed protocols on server
POST /api/servers/{id}/protocols/install - Install protocol
```
### Clients
```
GET /api/clients - List all clients
GET /api/clients/{id}/details - Get client details with stats, config and QR code
GET /api/clients/{id}/qr - Get client QR code
POST /api/clients/create - Create new client (returns config and QR code)
Parameters: server_id, name, expires_in_days (optional)
Parameters: server_id, name, protocol_id (optional, default: installed), expires_in_days (optional)
POST /api/clients/{id}/revoke - Revoke client access
POST /api/clients/{id}/restore - Restore client access
DELETE /api/clients/{id}/delete - Delete client by ID
DELETE /api/clients/{id}/delete - Delete client by ID (removes from DB and server)
POST /api/clients/{id}/set-expiration - Set client expiration date
POST /api/clients/{id}/set-expiration - Set client expiration date
Parameters: expires_at (Y-m-d H:i:s or null)
POST /api/clients/{id}/extend - Extend client expiration
+10
View File
@@ -1706,6 +1706,16 @@ Router::get('/api/servers', function () {
return;
$servers = VpnServer::listByUser($user['id']);
// Enrich with installed protocols
$pdo = DB::conn();
foreach ($servers as &$server) {
$stmt = $pdo->prepare('SELECT p.id, p.slug, p.name FROM server_protocols sp JOIN protocols p ON p.id = sp.protocol_id WHERE sp.server_id = ?');
$stmt->execute([$server['id']]);
$server['protocols'] = $stmt->fetchAll(PDO::FETCH_ASSOC);
}
unset($server);
echo json_encode(['servers' => $servers]);
});