Commit 93b9c7f0 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

fixed key not used in opensearch

parent 56abd968
......@@ -3,7 +3,6 @@
namespace App\Http\Controllers;
use App;
use Cookie;
use Illuminate\Http\Request;
use Jenssegers\Agent\Agent;
use LaravelLocalization;
......@@ -80,12 +79,15 @@ class StartpageController extends Controller
public function loadPlugin(Request $request, $locale = "de")
{
$link = action('MetaGerSearch@search', []);
$key = Cookie::get('key');
$link .= "?";
$link .= "eingabe={searchTerms}";
$key = $request->input('key', '');
if (!empty($key)) {
$link .= "&key=" . urlencode($key);
}
$response = Response::make(
view('plugin')
->with('link', $link)
->with('key', $key)
, "200");
$response->header('Content-Type', "application/opensearchdescription+xml");
return $response;
......
......@@ -21,7 +21,11 @@
<link rel="apple-touch-icon" sizes="144x144" href="/img/apple/touch-icon-144.png">
<link rel="apple-touch-icon" sizes="152x152" href="/img/apple/touch-icon-152.png">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple/touch-icon-180.png">
@if(empty(Cookie::get('key')))
<link rel="search" type="application/opensearchdescription+xml" title="{{ trans('staticPages.opensearch') }}" href="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), action('StartpageController@loadPlugin')) }}">
@else
<link rel="search" type="application/opensearchdescription+xml" title="{{ trans('staticPages.opensearch') }}" href="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), action('StartpageController@loadPlugin', ['key' => Cookie::get('key')])) }}">
@endif
<link type="text/css" rel="stylesheet alternate" href="{{ mix('css/themes/metager-dark.css') }}" title="MetaGer Dark"/>
<link type="text/css" rel="stylesheet" href="{{ mix('css/themes/metager.css') }}" title="MetaGer"/>
<link type="text/css" rel="stylesheet" href="{{ mix('css/utility.css') }}" />
......
......@@ -4,6 +4,6 @@
<Description>{{ trans('plugin.description') }}</Description>
<Contact>office@suma-ev.de</Contact>
<Image width="16" height="16" type="image/x-icon">{{ url('/favicon.ico') }}</Image>
<Url type="text/html" template="{{ $link }}?{{ empty($key) ? "" : "key=" . urlencode($key) . "&" }}eingabe={searchTerms}" method="GET" />
<Url type="text/html" template="{{ $link }}" method="GET" />
<InputEncoding>UTF-8</InputEncoding>
</OpenSearchDescription>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment