From 19078b03dde8eb65884304425faba60aec3b0df5 Mon Sep 17 00:00:00 2001 From: infosave2007 Date: Wed, 25 Feb 2026 06:57:04 +0300 Subject: [PATCH] fix:max logs MySql --- my.cnf | 2 ++ public/index.php | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/my.cnf b/my.cnf index 92a0323..0685cab 100644 --- a/my.cnf +++ b/my.cnf @@ -10,3 +10,5 @@ collation-server = utf8mb4_unicode_ci init_connect = 'SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci' init_connect = 'SET collation_connection = utf8mb4_unicode_ci' skip-character-set-client-handshake +binlog_expire_logs_seconds = 259200 +max_binlog_size = 100M diff --git a/public/index.php b/public/index.php index 02e193a..4926f5a 100644 --- a/public/index.php +++ b/public/index.php @@ -267,7 +267,7 @@ Router::get('/dashboard', function () { // Get real-time online clients count from Xray API $onlineData = ServerMonitoring::countOnlineClients(); - + // Also count clients with recent handshake (within 5 minutes) for WireGuard/AWG $pdo = DB::conn(); $stmt = $pdo->query(" @@ -276,8 +276,8 @@ Router::get('/dashboard', function () { AND last_handshake > DATE_SUB(NOW(), INTERVAL 5 MINUTE) AND status = 'active' "); - $recentHandshakeCount = (int)$stmt->fetchColumn(); - + $recentHandshakeCount = (int) $stmt->fetchColumn(); + // Combine both counts (XRay online + recent handshake), avoiding duplicates $totalOnline = max($onlineData['total'], $recentHandshakeCount); @@ -2709,7 +2709,7 @@ Router::post('/api/servers/{id}/protocols/selftest', function ($params) { $err = (string) ($derived['error'] ?? 'derive_failed'); // If we can't derive locally (e.g., libsodium missing), fall back to wg inside container. if ($err === 'libsodium_not_available') { - $shComputePub = "set -e; priv=" . escapeshellarg($cfgPrivate) . "; printf '%s' \"$priv\" | wg pubkey"; + $shComputePub = "set -e; priv=" . escapeshellarg($cfgPrivate) . "; printf '%s' \"\$priv\" | wg pubkey"; $cmdComputePub = "docker exec -i " . escapeshellarg($containerName) . " sh -c " . escapeshellarg($shComputePub); $computedClientPub = trim($server->executeCommand($cmdComputePub, true)); } else { @@ -2949,7 +2949,7 @@ Router::post('/api/servers/{id}/protocols/diagnose-handshake', function ($params } else { $clientPubError = (string) ($derived['error'] ?? 'derive_failed'); // Fallback: compute using wg inside container (best-effort) - $shComputePub = "set -e; priv=" . escapeshellarg($cfgPrivate) . "; printf '%s' \"$priv\" | wg pubkey"; + $shComputePub = "set -e; priv=" . escapeshellarg($cfgPrivate) . "; printf '%s' \"\$priv\" | wg pubkey"; $cmdComputePub = "docker exec -i " . escapeshellarg($containerName) . " sh -c " . escapeshellarg($shComputePub); $computed = trim((string) $server->executeCommand($cmdComputePub, true)); // Basic validation: wg outputs a 44-char base64 key