|
|
@@ -29,7 +29,7 @@ class isForbidden
|
|
|
if (config('app.env') === 'production' && sysConfig('website_url') && ! str_contains(sysConfig('website_url'), $request->getHost())) {
|
|
|
Log::warning('识别到通过订阅链接访问,强制跳转至百度('.IP::getClientIp().') '.$request->fullUrl());
|
|
|
|
|
|
- return redirect('https://www.baidu.com');
|
|
|
+ return redirect(sysConfig('redirect_url', 'https://www.baidu.com').'?url='.$request->url());
|
|
|
}
|
|
|
|
|
|
if (sysConfig('forbid_mode')) {
|
|
|
@@ -39,7 +39,7 @@ class isForbidden
|
|
|
if ($ipLocation !== false) {
|
|
|
// 拒绝无IP请求
|
|
|
if (empty($ipLocation) || empty(array_filter($ipLocation))) {
|
|
|
- Log::warning("无法识别到IP,拒绝访问:$ip");
|
|
|
+ Log::warning(trans('errors.forbidden.access').": $ip");
|
|
|
|
|
|
return Response::view('auth.error', ['message' => trans('errors.forbidden.access')], 403);
|
|
|
}
|
|
|
@@ -49,27 +49,27 @@ class isForbidden
|
|
|
switch (sysConfig('forbid_mode')) {
|
|
|
case 'ban_mainland':
|
|
|
if (in_array($ipLocation['country'], ['China', '中国', 'CN']) && ! in_array($ipLocation['region'], ['Taiwan', 'Hong Kong', 'Macao', '香港', '澳门', '台湾', '台湾省'])) {
|
|
|
- Log::warning("识别到大陆IP,拒绝访问:$ip");
|
|
|
+ Log::warning(trans('errors.forbidden.china').": $ip");
|
|
|
|
|
|
return Response::view('auth.error', ['message' => trans('errors.forbidden.china')], 403);
|
|
|
}
|
|
|
break;
|
|
|
case 'ban_china':
|
|
|
if (in_array($ipLocation['country'], ['China', '中国', 'Taiwan', 'Hong Kong', 'Macao', '香港', '台湾', '澳门'])) {
|
|
|
- Log::warning("识别到中国IP,拒绝访问:$ip");
|
|
|
+ Log::warning(trans('errors.forbidden.china').": $ip");
|
|
|
|
|
|
return Response::view('auth.error', ['message' => trans('errors.forbidden.china')], 403);
|
|
|
}
|
|
|
break;
|
|
|
case 'ban_oversea':
|
|
|
if (! in_array($ipLocation['country'], ['China', '中国', 'Taiwan', 'Hong Kong', 'Macao', '香港', '台湾', '澳门'])) {
|
|
|
- Log::warning("识别到海外IP,拒绝访问:$ip - ".$ipLocation['country']);
|
|
|
+ Log::warning(trans('errors.forbidden.oversea').": $ip - ".$ipLocation['country']);
|
|
|
|
|
|
return Response::view('auth.error', ['message' => trans('errors.forbidden.oversea')], 403);
|
|
|
}
|
|
|
break;
|
|
|
default:
|
|
|
- Log::emergency('未知禁止访问模式!请在系统设置中修改【禁止访问模式】!');
|
|
|
+ Log::emergency(trans('errors.forbidden.unknown'));
|
|
|
break;
|
|
|
}
|
|
|
}
|