Medium priority fixes: CORS from env, shared HasRadioSettings trait, lazy RconService, validated() fixes, LogoGenerator hardening, DB indexes, user profile consistency, radio rank N+1 fix

This commit is contained in:
root
2026-06-04 20:05:36 +02:00
parent 4b6872e5e0
commit b2bb1811d0
11 changed files with 140 additions and 56 deletions
+18 -5
View File
@@ -27,12 +27,14 @@ class RconService
'ip' => setting('rcon_ip'),
'port' => (int) setting('rcon_port'),
];
$this->initialize();
}
private function initialize(): void
public function connect(): bool
{
if ($this->isConnected) {
return true;
}
$this->socket = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if ($this->socket === false) {
@@ -40,7 +42,7 @@ class RconService
Log::error("RCON initialization failed: {$error}");
$this->closeConnection();
return;
return false;
}
if (! @socket_connect($this->socket, $this->config['ip'], $this->config['port'])) {
@@ -48,10 +50,17 @@ class RconService
Log::error("RCON connection failed: {$error}");
$this->closeConnection();
return;
return false;
}
$this->isConnected = true;
return true;
}
private function initialize(): void
{
$this->connect();
}
private function closeConnection(): void
@@ -66,6 +75,10 @@ class RconService
public function isConnected(): bool
{
if (! $this->isConnected) {
$this->connect();
}
return $this->isConnected;
}