feat: add AWG2 protocol support and enhance API documentation for protocol management

This commit is contained in:
infosave2007
2026-04-04 13:59:37 +03:00
parent da72a5b3ed
commit da5cdc6ae8
6 changed files with 81 additions and 15 deletions
+8
View File
@@ -2549,6 +2549,14 @@ Router::post('/api/servers/{id}/protocols/install', function ($params) {
}
$result = InstallProtocolManager::activate($server, $protocol, []);
// Keep API behavior consistent with UI flow: once protocol activation succeeds,
// clear transient error state and mark server as active for client creation.
if (is_array($result) && !empty($result['success'])) {
$pdo = DB::conn();
$stmtUpdate = $pdo->prepare('UPDATE vpn_servers SET status = ?, error_message = NULL WHERE id = ?');
$stmtUpdate->execute(['active', $serverId]);
}
echo json_encode($result, JSON_UNESCAPED_SLASHES | JSON_INVALID_UTF8_SUBSTITUTE);
} catch (Exception $e) {
http_response_code(500);