}
/**
- * Display a listing of the settings.
+ * Handle requests to the settings index path
*/
- public function index(string $category)
+ public function index()
+ {
+ return redirect('/settings/features');
+ }
+
+ /**
+ * Display the settings for the given category.
+ */
+ public function category(string $category)
{
$this->ensureCategoryExists($category);
$this->checkPermission('settings-manage');
@inject('headContent', 'BookStack\Theming\CustomHtmlHeadContentProvider')
-@if(setting('app-custom-head') && \Route::currentRouteName() !== 'settings')
+@if(setting('app-custom-head') && !request()->routeIs('settings.category'))
<!-- Start: custom user content -->
{!! $headContent->forWeb() !!}
<!-- End: custom user content -->
Route::delete('/settings/webhooks/{id}', [WebhookController::class, 'destroy']);
// Settings
- Route::redirect('/settings', '/settings/features')->name('settings');
- Route::get('/settings/{category}', [SettingController::class, 'index']);
+ Route::get('/settings', [SettingController::class, 'index'])->name('settings');
+ Route::get('/settings/{category}', [SettingController::class, 'category'])->name('settings.category');
Route::post('/settings/{category}', [SettingController::class, 'update']);
});
public function test_configured_content_does_not_show_on_settings_page()
{
$this->setSettings(['app-custom-head' => '<script>console.log("cat");</script>']);
- $resp = $this->asAdmin()->get('/settings');
+ $resp = $this->asAdmin()->get('/settings/features');
$resp->assertDontSee('console.log("cat")', false);
}
{
$resp = $this->asAdmin()->get('/settings');
- $resp->assertRedirect('/settings/features');
+ $resp->assertStatus(302);
+
+ // Manually check path to ensure it's generated as the full path
+ $location = $resp->headers->get('location');
+ $this->assertEquals(url('/settings/features'), $location);
}
public function test_settings_category_links_work_as_expected()