mirror of
https://github.com/bitinflow/expose.git
synced 2026-03-13 21:45:55 +00:00
35 lines
819 B
PHP
35 lines
819 B
PHP
<?php
|
|
|
|
namespace App\HttpServer\Controllers;
|
|
|
|
use App\Client\Client;
|
|
use GuzzleHttp\Psr7\Response;
|
|
use function GuzzleHttp\Psr7\str;
|
|
use Psr\Http\Message\RequestInterface;
|
|
use Ratchet\ConnectionInterface;
|
|
|
|
class DashboardController extends Controller
|
|
{
|
|
public function onOpen(ConnectionInterface $connection, RequestInterface $request = null)
|
|
{
|
|
$connection->send(
|
|
str(new Response(
|
|
200,
|
|
['Content-Type' => 'text/html'],
|
|
$this->getView()
|
|
))
|
|
);
|
|
|
|
$connection->close();
|
|
}
|
|
|
|
protected function getView(): string
|
|
{
|
|
$view = file_get_contents(base_path('resources/views/index.html'));
|
|
|
|
$view = str_replace('%subdomains%', implode(' ', Client::$subdomains), $view);
|
|
|
|
return $view;
|
|
}
|
|
}
|