naprawa logiki i update stylu

This commit is contained in:
2026-03-08 18:49:35 +01:00
parent 533fcaa498
commit 1bed0e7774
3 changed files with 245 additions and 103 deletions
+9 -2
View File
@@ -4,15 +4,22 @@ namespace ComCen\Http;
use Ratchet\ConnectionInterface;
/*
Access-Control-Allow-Origin: *
zezwala na urzycie portu 8080
portalowi chodzącemu na porcie 8000
*/
class Utils
{
static function responeJson(ConnectionInterface $conn, string $head, string $jsonData): void
{
$conn->send("HTTP/1.1 {$head}\r\nContent-Type: application/json\r\n\r\n{$jsonData}");
$conn->send("HTTP/1.1 {$head}\r\nContent-Type: application/json\r\nAccess-Control-Allow-Origin: *\r\n\r\n{$jsonData}");
}
static function respondHtml(ConnectionInterface $conn, string $html): void
{
$conn->send("HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n{$html}");
$conn->send("HTTP/1.1 200 OK\r\nContent-Type: text/html\r\nAccess-Control-Allow-Origin: *\r\n\r\n{$html}");
}
}