From 89f7b72e0ef0255cfbeb8e843865dcfa5c53225f Mon Sep 17 00:00:00 2001 From: Maxence Lange Date: Mon, 10 Nov 2025 17:28:42 -0100 Subject: [PATCH] allow test during :check Signed-off-by: Maxence Lange --- lib/Command/CirclesCheck.php | 1 + lib/Controller/EventWrapperController.php | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/lib/Command/CirclesCheck.php b/lib/Command/CirclesCheck.php index a32fe0220..137d815c8 100644 --- a/lib/Command/CirclesCheck.php +++ b/lib/Command/CirclesCheck.php @@ -260,6 +260,7 @@ private function testLoopback(InputInterface $input, OutputInterface $output): b return false; } + $this->appConfig->setValueInt(Application::APP_ID, 'test_dummy_token', time() + 10); if (!$this->testRequest( $output, 'POST', 'circles.EventWrapper.asyncBroadcast', ['token' => 'test-dummy-token'] diff --git a/lib/Controller/EventWrapperController.php b/lib/Controller/EventWrapperController.php index 3a9b1642b..bb97e9f71 100644 --- a/lib/Controller/EventWrapperController.php +++ b/lib/Controller/EventWrapperController.php @@ -22,6 +22,7 @@ use OCP\AppFramework\Controller; use OCP\AppFramework\Http; use OCP\AppFramework\Http\DataResponse; +use OCP\IAppConfig; use OCP\IRequest; /** @@ -64,6 +65,7 @@ class EventWrapperController extends Controller { public function __construct( string $appName, IRequest $request, + private readonly IAppConfig $appConfig, EventWrapperService $eventWrapperService, FederatedEventService $federatedEventService, RemoteUpstreamService $remoteUpstreamService, @@ -101,6 +103,10 @@ public function asyncBroadcast(string $token): DataResponse { return new DataResponse([], Http::STATUS_OK); } + if ($token === 'test-dummy-token' && $this->appConfig->getValueInt(Application::APP_ID, 'test_dummy_token') < time()) { + return new DataResponse([], Http::STATUS_UNAUTHORIZED); + } + // closing socket, keep current process running. $this->async();