v2board/app/Http/Controllers/V1/Guest/CommController.php

39 lines
1.3 KiB
PHP
Raw Normal View History

2021-05-06 23:15:30 +08:00
<?php
2023-06-12 02:32:49 +08:00
namespace App\Http\Controllers\V1\Guest;
2021-05-06 23:15:30 +08:00
use App\Http\Controllers\Controller;
2023-06-12 02:32:49 +08:00
use App\Utils\Dict;
2022-02-20 01:41:52 +08:00
use Illuminate\Support\Facades\Http;
2021-05-06 23:15:30 +08:00
class CommController extends Controller
{
public function config()
{
return response([
'data' => [
2021-07-19 17:44:40 +08:00
'tos_url' => config('v2board.tos_url'),
'is_email_verify' => (int)config('v2board.email_verify', 0) ? 1 : 0,
'is_invite_force' => (int)config('v2board.invite_force', 0) ? 1 : 0,
'email_whitelist_suffix' => (int)config('v2board.email_whitelist_enable', 0)
? $this->getEmailSuffix()
: 0,
'is_recaptcha' => (int)config('v2board.recaptcha_enable', 0) ? 1 : 0,
2021-07-22 21:32:42 +08:00
'recaptcha_site_key' => config('v2board.recaptcha_site_key'),
2021-07-19 17:44:40 +08:00
'app_description' => config('v2board.app_description'),
2022-05-15 01:46:35 +08:00
'app_url' => config('v2board.app_url'),
'logo' => config('v2board.logo'),
2021-05-06 23:15:30 +08:00
]
]);
}
2021-07-19 17:44:40 +08:00
private function getEmailSuffix()
{
$suffix = config('v2board.email_whitelist_suffix', Dict::EMAIL_WHITELIST_SUFFIX_DEFAULT);
if (!is_array($suffix)) {
return preg_split('/,/', $suffix);
}
return $suffix;
}
2021-05-06 23:15:30 +08:00
}