From fa853ca494ef5bbba8a05c8b44f2a61e2bb1f0f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=94=E5=A7=AC=E6=A1=91?= Date: Mon, 26 Jul 2021 23:26:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=86=8D=E6=AC=A1=E6=9B=B4=E6=94=B9=E7=BD=91?= =?UTF-8?q?=E7=AB=99=E8=B7=B3=E8=BD=AC=E7=99=BE=E5=BA=A6=E9=80=BB=E8=BE=91?= =?UTF-8?q?=20&=20=E4=BF=AE=E6=94=B9=E9=BB=98=E8=AE=A4=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E5=87=8F=E5=B0=91demo=E7=AB=99=E7=9A=84?= =?UTF-8?q?=E8=A2=AB=E7=8E=A9=E5=9D=8F=E7=8E=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.example | 6 +++--- app/Http/Controllers/Admin/UserController.php | 2 +- app/Http/Middleware/isForbidden.php | 2 +- database/seeds/PresetSeeder.php | 1 + routes/web.php | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.env.example b/.env.example index e2571180..6645e2c8 100644 --- a/.env.example +++ b/.env.example @@ -1,8 +1,8 @@ APP_NAME=ProxyPanel -APP_ENV=production +APP_ENV=local APP_KEY= -APP_DEBUG=false -APP_DEMO=false +APP_DEBUG= +APP_DEMO= APP_URL=http://localhost APP_TIMEZONE=Asia/Shanghai APP_LOCALE=zh-CN diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php index 9df38d25..18b82fab 100644 --- a/app/Http/Controllers/Admin/UserController.php +++ b/app/Http/Controllers/Admin/UserController.php @@ -188,7 +188,7 @@ class UserController extends Controller // 非演示环境才可以修改管理员密码 $password = $request->input('password'); - if (! empty($password) && ! (env('APP_DEMO') && $user->id === 1)) { + if (! empty($password) && ! (config('app.demo') && $user->id === 1)) { $data['password'] = $password; } diff --git a/app/Http/Middleware/isForbidden.php b/app/Http/Middleware/isForbidden.php index 75a99907..0b37ed14 100644 --- a/app/Http/Middleware/isForbidden.php +++ b/app/Http/Middleware/isForbidden.php @@ -29,7 +29,7 @@ class isForbidden } // 拒绝通过订阅链接域名访问网站,防止网站被探测 - if (strpos(sysConfig('subscribe_domain'), $request->getHost()) !== false && strpos(sysConfig('website_url'), $request->getHost()) === false) { + if (config('app.env') === 'production' && sysConfig('website_url') && ! str_contains(sysConfig('website_url'), $request->getHost())) { Log::info('识别到通过订阅链接访问,强制跳转至百度('.IP::getClientIp().')'); return redirect('https://www.baidu.com'); diff --git a/database/seeds/PresetSeeder.php b/database/seeds/PresetSeeder.php index 7f926fb4..0767fdd3 100644 --- a/database/seeds/PresetSeeder.php +++ b/database/seeds/PresetSeeder.php @@ -507,6 +507,7 @@ class PresetSeeder extends Seeder // 生成初始管理账号 $user = Helpers::addUser('test@test.com', '123456', 100 * GB, sysConfig('default_days'), null, '管理员'); + $user->update(['status' => 1]); $user->assignRole('Super Admin'); } } diff --git a/routes/web.php b/routes/web.php index 8e4e6b80..9f3a97c3 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,6 +1,6 @@ get('s/{code}', 'User\SubscribeController@getSubscribeByCode')->name('sub'); // 节点订阅地址