From d30d38dacb541bb116608c71eba6a4c104378f05 Mon Sep 17 00:00:00 2001 From: Chen Asraf Date: Fri, 7 Nov 2025 01:45:47 +0200 Subject: [PATCH] fix: catch-all route --- appinfo/routes.php | 3 ++- lib/Controller/PageController.php | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/appinfo/routes.php b/appinfo/routes.php index 3ca59b7..a917efb 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -10,6 +10,7 @@ declare(strict_types=1); return [ 'routes' => [ // SPA catch-all routes - serve the main template for all sub-paths - ['name' => 'page#index', 'url' => '/{path}', 'verb' => 'GET', 'requirements' => ['path' => '.*']], + ['name' => 'page#index', 'url' => '/', 'verb' => 'GET'], + ['name' => 'page#catchAll', 'url' => '/{path}', 'verb' => 'GET', 'requirements' => ['path' => '.*']], ], ]; diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index 93e2dfd..f16bf09 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -35,9 +35,22 @@ class PageController extends Controller { #[NoAdminRequired] #[NoCSRFRequired] public function index(): TemplateResponse { - $this->logger->info('NextcloudAppTemplate main page loaded'); + $this->logger->info('Forum main page loaded'); return new TemplateResponse(Application::APP_ID, 'app', [ 'script' => 'app', ]); } + + /** + * Main app page - catch all route + * + * @return TemplateResponse + * + * 200: OK + */ + #[NoAdminRequired] + #[NoCSRFRequired] + public function catchAll(string $path = ''): TemplateResponse { + return $this->index(); + } }