diff --git a/docs/docs/8.x/configuration/app.md b/docs/docs/8.x/configuration/app.md index 041b0f3e..02d1c77a 100644 --- a/docs/docs/8.x/configuration/app.md +++ b/docs/docs/8.x/configuration/app.md @@ -6,22 +6,34 @@ The `config/boilerplate/app.php` file allows to define the general parameters of ```php "http://..../admin" - 'prefix' => 'admin', + 'prefix' => 'admin', // Backend domain if different as current domain. Ex: "admin.mydomain.tld" - 'domain' => '', + 'domain' => '', // Redirect to this route after login - 'redirectTo' => 'boilerplate.dashboard', + 'redirectTo' => 'boilerplate.dashboard', // Activating daily logs and showing log viewer - 'logs' => true, - + 'logs' => true, + // When set to true, allows admins to view the site as a user of their choice 'allowImpersonate' => false, + + // If true, the session will be kept alive and the user must log out + 'keepalive' => true, + + // Allows to generate text with ChatGPT in TinyMCE + 'openai' => [ + 'key' => env('OPENAI_API_KEY'), + 'model' => 'gpt-3.5-turbo', + 'organization' => env('OPENAI_API_ORGANIZATION'), + ], ]; + ``` --- @@ -76,4 +88,18 @@ Log viewer is only visible by administrators by default. When `allowImpersonate` is set to true, admins are allowed to view the site as the user of their choice by using a switch in the navbar. -> You can't switch to an admin user \ No newline at end of file +> You can't switch to an admin user + +--- + +## keepalive + +Allows enabling or disabling session keep alive. If the value is set to `true`, the session will be maintained until the user logs out. + +Conversely, if the value is set to `false`, the user will be logged out when the session expires. + +--- + +## openai + +Allows setting variables for using ChatGPT in TinyMCE \ No newline at end of file diff --git a/src/config/app.php b/src/config/app.php index 29e17fb4..f77ff70d 100755 --- a/src/config/app.php +++ b/src/config/app.php @@ -16,6 +16,9 @@ // When set to true, allows admins to view the site as a user of their choice 'allowImpersonate' => false, + // If true, the session will be kept alive and the user must log out + 'keepalive' => true, + // Allows to generate text with ChatGPT in TinyMCE 'openai' => [ 'key' => env('OPENAI_API_KEY'), diff --git a/src/resources/views/gpt/layout.blade.php b/src/resources/views/gpt/layout.blade.php index 75295d01..e45b9180 100644 --- a/src/resources/views/gpt/layout.blade.php +++ b/src/resources/views/gpt/layout.blade.php @@ -20,12 +20,14 @@ @component('boilerplate::minify') @endcomponent @stack('plugin-js') diff --git a/src/resources/views/layout/index.blade.php b/src/resources/views/layout/index.blade.php index 90f6dddf..35a46d94 100755 --- a/src/resources/views/layout/index.blade.php +++ b/src/resources/views/layout/index.blade.php @@ -26,12 +26,14 @@ var bpRoutes={ settings:"{{ route('boilerplate.user.settings',null,false) }}" }; +@if(config('boilerplate.app.keepalive', false)) var session={ keepalive:"{{ route('boilerplate.keepalive', null, false) }}", expire:{{ time() + config('session.lifetime') * 60 }}, lifetime:{{ config('session.lifetime') * 60 }}, id:"{{ session()->getId() }}" }; +@endif @endcomponent @stack('plugin-js') diff --git a/src/routes/boilerplate.php b/src/routes/boilerplate.php index 2ebd9c77..59ec18b3 100755 --- a/src/routes/boilerplate.php +++ b/src/routes/boilerplate.php @@ -89,7 +89,9 @@ Route::get('/demo', [DemoController::class, 'index'])->name('demo'); // Session keep-alive - Route::post('keep-alive', [UsersController::class, 'keepAlive'])->name('keepalive'); + if (config('boilerplate.app.keepalive', false)) { + Route::post('keep-alive', [UsersController::class, 'keepAlive'])->name('keepalive'); + } // Datatables Route::post('datatables/{slug}', [DatatablesController::class, 'make'])->name('datatables'); diff --git a/tests/config.php b/tests/config.php index dfb5dd98..22f5adfb 100644 --- a/tests/config.php +++ b/tests/config.php @@ -8,6 +8,7 @@ 'app.url' => 'http://localhost', 'app.fallback_locale' => 'en', 'boilerplate.app.locale' => 'en', + 'boilerplate.app.keepalive' => 'true', 'boilerplate.locale.switch' => true, 'boilerplate.locale.allowed' => ['fr'], 'boilerplate.app.allowImpersonate' => true,