From e12f923affb4c8b28968e4b9177061e8601823a7 Mon Sep 17 00:00:00 2001 From: infosave2007 Date: Fri, 13 Feb 2026 20:13:57 +0300 Subject: [PATCH] feat: Add protocol_id to VPN clients insertion logic --- inc/InstallProtocolManager.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/inc/InstallProtocolManager.php b/inc/InstallProtocolManager.php index b1f5f8d..b1fec08 100644 --- a/inc/InstallProtocolManager.php +++ b/inc/InstallProtocolManager.php @@ -467,6 +467,7 @@ class InstallProtocolManager } } $restored = 0; + $pid = self::resolveProtocolId($protocol); if (trim($wgConfig) !== '') { $pattern = '/\[Peer\][^\[]*?PublicKey\s*=\s*(.+?)\s*[\r\n]+[\s\S]*?AllowedIPs\s*=\s*(.+?)(?:\r?\n|$)/'; if (preg_match_all($pattern, $wgConfig, $matches, PREG_SET_ORDER)) { @@ -491,7 +492,7 @@ class InstallProtocolManager continue; } $name = $nameByPub[$pub] ?? ('import-' . str_replace('.', '_', $clientIp)); - $ins = $pdo->prepare('INSERT INTO vpn_clients (server_id, user_id, name, client_ip, public_key, private_key, preshared_key, config, status, created_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, NOW())'); + $ins = $pdo->prepare('INSERT INTO vpn_clients (server_id, user_id, name, client_ip, public_key, private_key, preshared_key, config, protocol_id, status, created_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NOW())'); $ins->execute([ $server->getId(), $serverData['user_id'] ?? null, @@ -501,6 +502,7 @@ class InstallProtocolManager '', $details['preshared_key'] ?? null, '', + $pid ?: null, 'active' // Import as active since they already work on the server ]); $restored++;