Commit 23ef0eaf by 杨树贤

新增403

parent 6f317ae4
......@@ -30,6 +30,11 @@ class CheckIp
return $next($request);
}
Log::warning(json_encode($record));
// 直接 403 禁止访问的国家(俄罗斯、伊朗)
if (in_array($record['country']['iso_code'], config('field.forbidden_ip_iso_code'))) {
abort(403);
}
// 重定向到 /info 页面的国家
if (in_array($record['country']['iso_code'], config('field.disable_ip_iso_code'))) {
view()->share('is_disable_ip', 1);
return redirect()->to('/info');
......
......@@ -21,13 +21,17 @@ return [
'Passives' => 'https://img.ichunt.com/images/cms/202009/15/2e95ec65caf11787fa13ac60f90bf2f2.png',
'Modules & Devices & Products' => 'https://img.ichunt.com/images/cms/202009/15/37b1c3bb9823c5303cc22962695d2e58.jpg',
],
// 直接返回 403 禁止访问的国家
'forbidden_ip_iso_code' => [
'RU', // 俄罗斯
'IR', // 伊朗
],
// 重定向到 /info 页面的国家
'disable_ip_iso_code' => [
'US',
'CA',
'GB',
'AU',
'RU',
'IR',
'UA',
'SY',
]
......
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 sign in to comment