From b9026298a4c6e0ad214bd06396e935d4ad1ae45f Mon Sep 17 00:00:00 2001
From: Dominik Hebeler <dominik@suma-ev.de>
Date: Tue, 6 Oct 2020 11:27:43 +0200
Subject: [PATCH] chrome plugin page gets redirected over result page

---
 app/Http/Controllers/MetaGerSearch.php       | 3 +++
 app/Http/Controllers/StartpageController.php | 2 +-
 resources/views/index.blade.php              | 5 +++++
 resources/views/parts/searchbar.blade.php    | 2 +-
 4 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/app/Http/Controllers/MetaGerSearch.php b/app/Http/Controllers/MetaGerSearch.php
index cbb47ad12..107246539 100644
--- a/app/Http/Controllers/MetaGerSearch.php
+++ b/app/Http/Controllers/MetaGerSearch.php
@@ -15,6 +15,9 @@ class MetaGerSearch extends Controller
 
     public function search(Request $request, MetaGer $metager, $timing = false)
     {
+        if ($request->filled("chrome-plugin")) {
+            return redirect(LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), "/plugin"));
+        }
         $timings = null;
         if ($timing) {
             $timings = ['starttime' => microtime(true)];
diff --git a/app/Http/Controllers/StartpageController.php b/app/Http/Controllers/StartpageController.php
index 55364eb84..d38be544d 100644
--- a/app/Http/Controllers/StartpageController.php
+++ b/app/Http/Controllers/StartpageController.php
@@ -45,7 +45,7 @@ class StartpageController extends Controller
         return view('index')
             ->with('title', trans('titles.index'))
             ->with('homeIcon')
-            ->with('browser', (new Agent())->browser())
+            ->with('agent', new Agent())
             ->with('navbarFocus', 'suche')
             ->with('focus', $request->input('focus', 'web'))
             ->with('time', $request->input('param_time', '1500'))
diff --git a/resources/views/index.blade.php b/resources/views/index.blade.php
index fe90db69e..26968e8eb 100644
--- a/resources/views/index.blade.php
+++ b/resources/views/index.blade.php
@@ -13,7 +13,12 @@
   <input type="hidden" name="key" value="{{ Request::input('key','') }}" form="searchForm">
   @endif
 	<div id="plugin-btn-div">
+		@if($agent->isMobile() && $agent->browser() === "Chrome")
+		<input type="hidden" name="eingabe" value="chrome" />
+		<button type="submit" id="plugin-btn" form="searchForm" title="{{ trans('index.plugin-title') }}" name="chrome-plugin" value="true"><i class="fa fa-plug" aria-hidden="true"></i> {{ trans('index.plugin') }}</a>
+		@else
 		<a id="plugin-btn" href="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), "/plugin") }}" title="{{ trans('index.plugin-title') }}"><i class="fa fa-plug" aria-hidden="true"></i> {{ trans('index.plugin') }}</a>
+		@endif
 	</div>
 		<div id="about-us">
 			<div class="m-row">
diff --git a/resources/views/parts/searchbar.blade.php b/resources/views/parts/searchbar.blade.php
index af89e43e9..a04e14c38 100644
--- a/resources/views/parts/searchbar.blade.php
+++ b/resources/views/parts/searchbar.blade.php
@@ -8,7 +8,7 @@
 					</a>
 				</div>
 				<div class="search-input">
-					<input type="search" name="eingabe" value="@if(isset($eingabe)){{$eingabe}}@endif" required=""  @if(\Request::is('/') && !\Request::filled('mgapp')) autofocus @endif autocomplete="off" class="form-control" placeholder="{{ trans('index.placeholder') }}" tabindex="0">
+					<input type="search" name="eingabe" value="@if(isset($eingabe)){{$eingabe}}@endif" @if(\Request::is('/') && !\Request::filled('mgapp')) autofocus @endif autocomplete="off" class="form-control" placeholder="{{ trans('index.placeholder') }}" tabindex="0">
 					<button id="search-delete-btn" name="delete-search-input" type="button" tabindex="-1">
 						&#xd7;
 					</button>
-- 
GitLab