add safe mode

This commit is contained in:
Tokumeikoi 2020-02-08 16:38:03 +08:00
parent ffe05a5467
commit 1f471545d4
3 changed files with 3 additions and 3 deletions

View File

@ -24,7 +24,7 @@ class ConfigController extends Controller
'invite_never_expire' => config('v2board.invite_never_expire', 0)
],
'site' => [
'save_mode' => (int)config('v2board.save_mode', 0),
'safe_mode_enable' => (int)config('v2board.safe_mode_enable', 0),
'stop_register' => (int)config('v2board.stop_register', 0),
'email_verify' => (int)config('v2board.email_verify', 0),
'app_name' => config('v2board.app_name', 'V2Board'),

View File

@ -7,7 +7,7 @@ use Illuminate\Foundation\Http\FormRequest;
class ConfigSave extends FormRequest
{
CONST RULES = [
'save_mode' => 'in:0,1',
'safe_mode_enable' => 'in:0,1',
'invite_force' => 'in:0,1',
'invite_commission' => 'integer',
'invite_gen_limit' => 'integer',

View File

@ -14,7 +14,7 @@ use Illuminate\Http\Request;
*/
Route::get('/', function (Request $request) {
if (config('v2board.app_url')) {
if (config('v2board.app_url') && config('v2board.safe_mode_enable', 0)) {
if ($request->server('HTTP_HOST') !== parse_url(config('v2board.app_url'))['host']) {
abort(403);
}