From ca1e5ebb8a8c22a0f827975e603c368925f2ae8a Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Tue, 8 Oct 2024 15:54:59 +0100 Subject: [PATCH] fixes for clockwork web UI --- CHANGELOG.md | 7 +++++++ system/src/Grav/Common/Debugger.php | 10 +++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 86abbd45c9..251334ccd0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# v1.7.47 +## mm/dd/2024 + +1. [](#improved) + * Fixed an issue with Clockwork Debugger to allow web UI + * Updated vendor libs to latest versions + # v1.7.46 ## 05/15/2024 diff --git a/system/src/Grav/Common/Debugger.php b/system/src/Grav/Common/Debugger.php index 49e26b26e3..d6fb5fbe4a 100644 --- a/system/src/Grav/Common/Debugger.php +++ b/system/src/Grav/Common/Debugger.php @@ -279,11 +279,7 @@ public function logRequest(ServerRequestInterface $request, ResponseInterface $r ->withHeader('X-Clockwork-Id', $clockworkRequest->id) ->withHeader('X-Clockwork-Version', $clockwork::VERSION); - $grav = Grav::instance(); - $basePath = $this->grav['base_url_relative'] . $grav['pages']->base(); - if ($basePath) { - $response = $response->withHeader('X-Clockwork-Path', $basePath . '/__clockwork/'); - } + $response = $response->withHeader('X-Clockwork-Path', Utils::url('/__clockwork/')); return $response->withHeader('Server-Timing', ServerTiming::fromRequest($clockworkRequest)->value()); } @@ -307,7 +303,7 @@ public function debuggerRequest(RequestInterface $request): Response } $id = $matches['id'] ?? null; - $direction = $matches['direction'] ?? null; + $direction = $matches['direction'] ?? 'latest'; $count = $matches['count'] ?? null; $storage = $clockwork->getStorage(); @@ -316,7 +312,7 @@ public function debuggerRequest(RequestInterface $request): Response $data = $storage->previous($id, $count); } elseif ($direction === 'next') { $data = $storage->next($id, $count); - } elseif ($id === 'latest') { + } elseif ($direction === 'latest' || $id === 'latest') { $data = $storage->latest(); } else { $data = $storage->find($id);