mirror of
https://github.com/bitinflow/expose.git
synced 2026-03-14 14:05:54 +00:00
wip
This commit is contained in:
@@ -80,9 +80,12 @@ class Factory
|
||||
|
||||
protected function addExposeRoutes()
|
||||
{
|
||||
$wsServer = new WsServer(app(ControlMessageController::class));
|
||||
$wsServer->enableKeepAlive($this->loop);
|
||||
|
||||
$this->routes->add('control',
|
||||
new Route('/__expose_control__', [
|
||||
'_controller' => new WsServer(app(ControlMessageController::class))
|
||||
'_controller' => $wsServer
|
||||
], [], [], null, [], []
|
||||
)
|
||||
);
|
||||
|
||||
@@ -27,18 +27,7 @@ class ListSitesController extends PostController
|
||||
public function handle(Request $request, ConnectionInterface $httpConnection)
|
||||
{
|
||||
$httpConnection->send(
|
||||
respond_html($this->getView(['sites' => $this->connectionManager->getConnections()]))
|
||||
respond_html($this->getView('server.sites.index', ['sites' => $this->connectionManager->getConnections()]))
|
||||
);
|
||||
}
|
||||
|
||||
protected function getView(array $data)
|
||||
{
|
||||
$twig = new Environment(
|
||||
new ArrayLoader([
|
||||
'template' => file_get_contents(base_path('resources/views/admin/sites/index.twig')),
|
||||
])
|
||||
);
|
||||
|
||||
return stream_for($twig->render('template', $data));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ class ListUsersController extends PostController
|
||||
{
|
||||
$this->database->query('SELECT * FROM users ORDER by created_at DESC')->then(function (Result $result) use ($httpConnection) {
|
||||
$httpConnection->send(
|
||||
respond_html($this->getView(['users' => $result->rows]))
|
||||
respond_html($this->getView('server.users.index', ['users' => $result->rows]))
|
||||
);
|
||||
|
||||
$httpConnection->close();
|
||||
@@ -39,15 +39,4 @@ class ListUsersController extends PostController
|
||||
$httpConnection->close();
|
||||
});
|
||||
}
|
||||
|
||||
protected function getView(array $data)
|
||||
{
|
||||
$twig = new Environment(
|
||||
new ArrayLoader([
|
||||
'template' => file_get_contents(base_path('resources/views/admin/users/index.twig')),
|
||||
])
|
||||
);
|
||||
|
||||
return stream_for($twig->render('template', $data));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user