Skip to content
Snippets Groups Projects
Commit 90b72a10 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

Merge branch 'development'

parents bfc33dcc 9499ee77
No related branches found
No related tags found
1 merge request!1985Development
...@@ -8,14 +8,12 @@ use Jenssegers\Agent\Agent; ...@@ -8,14 +8,12 @@ use Jenssegers\Agent\Agent;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\QueryTimer; use App\QueryTimer;
use Cache; use Cache;
use App\MetaGer;
use App\Models\HumanVerification; use App\Models\HumanVerification;
use App\SearchSettings; use App\SearchSettings;
class BrowserVerification class BrowserVerification
{ {
private ?string $verification_key = null;
/** /**
* Handle an incoming request. * Handle an incoming request.
* *
...@@ -29,11 +27,6 @@ class BrowserVerification ...@@ -29,11 +27,6 @@ class BrowserVerification
$this->verification_key = \hash("sha512", $request->ip() . $_SERVER["AGENT"]); $this->verification_key = \hash("sha512", $request->ip() . $_SERVER["AGENT"]);
if (Cache::has($this->verification_key) && Cache::get($this->verification_key) === true) {
\app()->make(QueryTimer::class)->observeEnd(self::class);
return $next($request);
}
$bvEnabled = config("metager.metager.browserverification_enabled"); $bvEnabled = config("metager.metager.browserverification_enabled");
if (empty($bvEnabled) || !$bvEnabled) { if (empty($bvEnabled) || !$bvEnabled) {
\app()->make(QueryTimer::class)->observeEnd(self::class); \app()->make(QueryTimer::class)->observeEnd(self::class);
...@@ -83,8 +76,6 @@ class BrowserVerification ...@@ -83,8 +76,6 @@ class BrowserVerification
$search_settings->jskey = $mgv; $search_settings->jskey = $mgv;
$search_settings->header_printed = false; $search_settings->header_printed = false;
\app()->make(QueryTimer::class)->observeEnd(self::class); \app()->make(QueryTimer::class)->observeEnd(self::class);
// Prevent another Browserverification for this user
Cache::put($this->verification_key, true, now()->addDay());
return $next($request); return $next($request);
} else { } else {
# We are serving that request but after solving a captcha # We are serving that request but after solving a captcha
...@@ -107,8 +98,6 @@ class BrowserVerification ...@@ -107,8 +98,6 @@ class BrowserVerification
$search_settings = \app()->make(SearchSettings::class); $search_settings = \app()->make(SearchSettings::class);
$search_settings->jskey = $key; $search_settings->jskey = $key;
$search_settings->header_printed = true; $search_settings->header_printed = true;
// Prevent another Browserverification for this user
Cache::put($this->verification_key, true, now()->addDay());
\app()->make(QueryTimer::class)->observeEnd(self::class); \app()->make(QueryTimer::class)->observeEnd(self::class);
return $next($request); return $next($request);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment