From 0dd8518c319210ebd8a092c05764d132e83d387e Mon Sep 17 00:00:00 2001 From: Marcel Pociot Date: Mon, 4 May 2020 16:42:57 +0200 Subject: [PATCH] wip --- app/Client/Factory.php | 13 +++++++------ app/Logger/RequestLogger.php | 2 +- resources/views/client/dashboard.twig | 6 +++--- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/app/Client/Factory.php b/app/Client/Factory.php index 8ba960a..abd9454 100644 --- a/app/Client/Factory.php +++ b/app/Client/Factory.php @@ -115,12 +115,13 @@ class Factory protected function addRoutes() { $this->router->get('/', DashboardController::class); - $this->router->post('/tunnel', CreateTunnelController::class); - $this->router->get('/logs', LogController::class); - $this->router->post('/logs', PushLogsToDashboardController::class); - $this->router->get('/replay/{log}', ReplayLogController::class); - $this->router->post('/logs/{request_id}/data', AttachDataToLogController::class); - $this->router->get('/logs/clear', ClearLogsController::class); + + $this->router->post('/api/tunnel', CreateTunnelController::class); + $this->router->get('/api/logs', LogController::class); + $this->router->post('/api/logs', PushLogsToDashboardController::class); + $this->router->get('/api/replay/{log}', ReplayLogController::class); + $this->router->post('/api/logs/{request_id}/data', AttachDataToLogController::class); + $this->router->get('/api/logs/clear', ClearLogsController::class); $this->app->route('/socket', new WsServer(new Socket()), ['*']); diff --git a/app/Logger/RequestLogger.php b/app/Logger/RequestLogger.php index d214259..0f8a7d6 100644 --- a/app/Logger/RequestLogger.php +++ b/app/Logger/RequestLogger.php @@ -81,7 +81,7 @@ class RequestLogger $this ->client ->post( - 'http://127.0.0.1:4040/logs', + 'http://127.0.0.1:4040/api/logs', ['Content-Type' => 'application/json'], json_encode($this->getData(), JSON_INVALID_UTF8_IGNORE) ); diff --git a/resources/views/client/dashboard.twig b/resources/views/client/dashboard.twig index 8314963..71ca4e3 100644 --- a/resources/views/client/dashboard.twig +++ b/resources/views/client/dashboard.twig @@ -407,7 +407,7 @@ this.activeTab = tab; }, clearLogs: function() { - fetch('/logs/clear'); + fetch('/api/logs/clear'); this.currentLog = null; }, setLog: function (log) { @@ -421,7 +421,7 @@ this.view = view; }, replay: function (log) { - fetch('/replay/' + log.id); + fetch('/api/replay/' + log.id); }, connect: function () { let conn = new ReconnectingWebSocket(`ws://${window.location.hostname}:${window.location.port}/socket`); @@ -431,7 +431,7 @@ }; }, loadLogs: function (log) { - fetch('/logs') + fetch('/api/logs') .then((response) => { return response.json(); })