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
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]);
});