mirror of
https://github.com/zoe-may/TDoG-Skin.git
synced 2025-01-19 06:57:24 +08:00
26 lines
602 B
PHP
Executable File
26 lines
602 B
PHP
Executable File
<?php
|
|
|
|
namespace App\Http\Middleware;
|
|
|
|
use App\Exceptions\PrettyPageException;
|
|
use Closure;
|
|
use Illuminate\Support\Arr;
|
|
use Illuminate\Support\Str;
|
|
|
|
class EnforceEverGreen
|
|
{
|
|
public function handle($request, Closure $next)
|
|
{
|
|
$userAgent = $request->userAgent();
|
|
|
|
preg_match('/Chrome\/(\d+)/', $userAgent, $matches);
|
|
$isOldChrome = Arr::has($matches, 1) && $matches[1] < 55;
|
|
|
|
if ($isOldChrome || Str::contains($userAgent, ['Trident', 'MSIE'])) {
|
|
throw new PrettyPageException(trans('errors.http.ie'));
|
|
}
|
|
|
|
return $next($request);
|
|
}
|
|
}
|