From 476c2be5a62579d755157a27de67d217bea23593 Mon Sep 17 00:00:00 2001 From: Maximilian Walter Date: Mon, 9 Sep 2024 22:54:33 +0200 Subject: [PATCH] Add XML for OpenSearch --- app/App/MetaController.php | 10 ++++++++++ resources/views/layouts/base.blade.php | 3 +++ resources/views/misc/opensearch.blade.php | 11 +++++++++++ routes/web.php | 1 + 4 files changed, 25 insertions(+) create mode 100644 resources/views/misc/opensearch.blade.php diff --git a/app/App/MetaController.php b/app/App/MetaController.php index 1515b4f7e..a94334c58 100644 --- a/app/App/MetaController.php +++ b/app/App/MetaController.php @@ -64,4 +64,14 @@ class MetaController extends Controller 'jsLibData' => file_get_contents(base_path('dev/licensing/js-library-licenses.txt')), ]); } + + /** + * Show the view for /opensearch.xml. + */ + public function opensearch() + { + return response() + ->view('misc.opensearch') + ->header('Content-Type', 'application/opensearchdescription+xml'); + } } diff --git a/resources/views/layouts/base.blade.php b/resources/views/layouts/base.blade.php index 4d4d07dc2..ddecb8e76 100644 --- a/resources/views/layouts/base.blade.php +++ b/resources/views/layouts/base.blade.php @@ -32,6 +32,9 @@ + + + @yield('head') diff --git a/resources/views/misc/opensearch.blade.php b/resources/views/misc/opensearch.blade.php new file mode 100644 index 000000000..cfcca8e41 --- /dev/null +++ b/resources/views/misc/opensearch.blade.php @@ -0,0 +1,11 @@ + + {{ setting('app-name') }} + Search {{ setting('app-name') }} + {{ setting('app-icon') ?: url('/icon.png') }} + {{ setting('app-icon-180') ?: url('/icon-180.png') }} + {{ setting('app-icon-128') ?: url('/icon-128.png') }} + {{ setting('app-icon-64') ?: url('/icon-64.png') }} + {{ setting('app-icon-32') ?: url('/icon-32.png') }} + + + diff --git a/routes/web.php b/routes/web.php index 58b8f4e54..81b938f32 100644 --- a/routes/web.php +++ b/routes/web.php @@ -23,6 +23,7 @@ Route::get('/robots.txt', [MetaController::class, 'robots']); Route::get('/favicon.ico', [MetaController::class, 'favicon']); Route::get('/manifest.json', [MetaController::class, 'pwaManifest']); Route::get('/licenses', [MetaController::class, 'licenses']); +Route::get('/opensearch.xml', [MetaController::class, 'opensearch']); // Authenticated routes... Route::middleware('auth')->group(function () {