update: force https

This commit is contained in:
tokumeikoi 2022-05-09 23:46:33 +08:00
parent ed749f85ae
commit 9d9c977ff1
5 changed files with 18 additions and 10 deletions

View File

@ -56,8 +56,7 @@ class ConfigController extends Controller
public function setTelegramWebhook(Request $request)
{
$hookUrl = '/api/v1/guest/telegram/webhook?access_token=' . md5(config('v2board.telegram_bot_token', $request->input('telegram_bot_token')));
$hookUrl - str_replace('http://', 'https://', $hookUrl);
$hookUrl = url('/api/v1/guest/telegram/webhook?access_token=' . md5(config('v2board.telegram_bot_token', $request->input('telegram_bot_token'))));
$telegramService = new TelegramService($request->input('telegram_bot_token'));
$telegramService->getMe();
$telegramService->setWebhook($hookUrl);
@ -86,6 +85,7 @@ class ConfigController extends Controller
'commission_distribution_l3' => config('v2board.commission_distribution_l3')
],
'site' => [
'force_https' => (int)config('v2board.force_https', 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),
@ -118,9 +118,11 @@ class ConfigController extends Controller
],
'frontend' => [
'frontend_theme' => config('v2board.frontend_theme', 'v2board'),
'frontend_admin_path' => config('v2board.frontend_admin_path', 'admin'),
'frontend_customer_service_method' => config('v2board.frontend_customer_service_method', 0),
'frontend_customer_service_id' => config('v2board.frontend_customer_service_id'),
'frontend_theme_sidebar' => config('v2board.frontend_theme_sidebar', 'light'),
'frontend_theme_header' => config('v2board.frontend_theme_header', 'dark'),
'frontend_theme_color' => config('v2board.frontend_theme_color', 'default'),
'frontend_background_url' => config('v2board.frontend_background_url'),
'frontend_admin_path' => config('v2board.frontend_admin_path', 'admin')
],
'server' => [
'server_token' => config('v2board.server_token'),

View File

@ -8,7 +8,6 @@ class ConfigSave extends FormRequest
{
const RULES = [
// invite & commission
'safe_mode_enable' => 'in:0,1',
'invite_force' => 'in:0,1',
'invite_commission' => 'integer',
'invite_gen_limit' => 'integer',
@ -23,6 +22,8 @@ class ConfigSave extends FormRequest
'commission_distribution_l2' => 'nullable|numeric',
'commission_distribution_l3' => 'nullable|numeric',
// site
'force_https' => 'in:0,1',
'safe_mode_enable' => 'in:0,1',
'stop_register' => 'in:0,1',
'email_verify' => 'in:0,1',
'app_name' => '',
@ -88,9 +89,11 @@ class ConfigSave extends FormRequest
'epay_key' => '',
// frontend
'frontend_theme' => '',
'frontend_theme_sidebar' => 'in:dark,light',
'frontend_theme_header' => 'in:dark,light',
'frontend_theme_color' => 'in:default,darkblue,black,green',
'frontend_background_url' => 'nullable|url',
'frontend_admin_path' => '',
'frontend_customer_service_method' => '',
'frontend_customer_service_id' => '',
// email
'email_template' => '',
'email_host' => '',

View File

@ -24,6 +24,9 @@ class RouteServiceProvider extends ServiceProvider
public function boot()
{
//
if (config('v2board.force_https')) {
resolve(\Illuminate\Routing\UrlGenerator::class)->forceScheme('https');
}
parent::boot();
}

View File

@ -237,5 +237,5 @@ return [
| The only modification by laravel config
|
*/
'version' => '1.5.6.1652027644048'
'version' => '1.5.6.1652111181640'
];

File diff suppressed because one or more lines are too long