From da4308bb0f692056ffc14ddb0b5881b0291b894e Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Wed, 30 Mar 2022 19:15:24 +0100 Subject: [PATCH 1/3] Fixed settings redirect issue and custom head display - Fixed issue where redirect for `/settings` view would not be ran through base url generator so would not create a correct path in some cases. Now routed through controller with normal redirect. - Fixed custom head content being active on settings pages due to route name changes, for when viewing settings, in last release. Fixes #3356 and #3355 --- app/Http/Controllers/SettingController.php | 12 ++++++++++-- resources/views/common/custom-head.blade.php | 2 +- routes/web.php | 4 ++-- tests/Settings/CustomHeadContentTest.php | 2 +- tests/Settings/SettingsTest.php | 6 +++++- 5 files changed, 19 insertions(+), 7 deletions(-) diff --git a/app/Http/Controllers/SettingController.php b/app/Http/Controllers/SettingController.php index 598058ef4..2e46bbe40 100644 --- a/app/Http/Controllers/SettingController.php +++ b/app/Http/Controllers/SettingController.php @@ -19,9 +19,17 @@ class SettingController extends Controller } /** - * 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'); diff --git a/resources/views/common/custom-head.blade.php b/resources/views/common/custom-head.blade.php index 7f2e93cdc..a13215cf8 100644 --- a/resources/views/common/custom-head.blade.php +++ b/resources/views/common/custom-head.blade.php @@ -1,6 +1,6 @@ @inject('headContent', 'BookStack\Theming\CustomHtmlHeadContentProvider') -@if(setting('app-custom-head') && \Route::currentRouteName() !== 'settings') +@if(setting('app-custom-head') && !request()->routeIs('settings.category')) {!! $headContent->forWeb() !!} diff --git a/routes/web.php b/routes/web.php index 223d97c66..37f59b970 100644 --- a/routes/web.php +++ b/routes/web.php @@ -265,8 +265,8 @@ Route::middleware('auth')->group(function () { 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']); }); diff --git a/tests/Settings/CustomHeadContentTest.php b/tests/Settings/CustomHeadContentTest.php index eeeab3f45..b2e21b91c 100644 --- a/tests/Settings/CustomHeadContentTest.php +++ b/tests/Settings/CustomHeadContentTest.php @@ -26,7 +26,7 @@ class CustomHeadContentTest extends TestCase public function test_configured_content_does_not_show_on_settings_page() { $this->setSettings(['app-custom-head' => '']); - $resp = $this->asAdmin()->get('/settings'); + $resp = $this->asAdmin()->get('/settings/features'); $resp->assertDontSee('console.log("cat")', false); } diff --git a/tests/Settings/SettingsTest.php b/tests/Settings/SettingsTest.php index bef354dac..48840fc0b 100644 --- a/tests/Settings/SettingsTest.php +++ b/tests/Settings/SettingsTest.php @@ -10,7 +10,11 @@ class SettingsTest extends TestCase { $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() From 1a90b98b8ff804945a6fb0f733147cc23ad03aeb Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Wed, 30 Mar 2022 19:22:47 +0100 Subject: [PATCH 2/3] Updated composer dependancies --- composer.lock | 148 ++++++++++++++++++++++++++------------------------ 1 file changed, 77 insertions(+), 71 deletions(-) diff --git a/composer.lock b/composer.lock index 4e5e3adab..5e8a84ffe 100644 --- a/composer.lock +++ b/composer.lock @@ -58,16 +58,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.215.2", + "version": "3.217.0", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "8ddbc5242ec59a22b2c4704867e028343c6d8ade" + "reference": "a8cca383b13fe6cde479a4745b4d3dfe893fdc69" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/8ddbc5242ec59a22b2c4704867e028343c6d8ade", - "reference": "8ddbc5242ec59a22b2c4704867e028343c6d8ade", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/a8cca383b13fe6cde479a4745b4d3dfe893fdc69", + "reference": "a8cca383b13fe6cde479a4745b4d3dfe893fdc69", "shasum": "" }, "require": { @@ -143,9 +143,9 @@ "support": { "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "issues": "https://github.com/aws/aws-sdk-php/issues", - "source": "https://github.com/aws/aws-sdk-php/tree/3.215.2" + "source": "https://github.com/aws/aws-sdk-php/tree/3.217.0" }, - "time": "2022-03-22T19:02:23+00:00" + "time": "2022-03-30T18:18:30+00:00" }, { "name": "bacon/bacon-qr-code", @@ -563,16 +563,16 @@ }, { "name": "doctrine/dbal", - "version": "3.3.3", + "version": "3.3.4", "source": { "type": "git", "url": "https://github.com/doctrine/dbal.git", - "reference": "82331b861727c15b1f457ef05a8729e508e7ead5" + "reference": "83f779beaea1893c0bece093ab2104c6d15a7f26" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/82331b861727c15b1f457ef05a8729e508e7ead5", - "reference": "82331b861727c15b1f457ef05a8729e508e7ead5", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/83f779beaea1893c0bece093ab2104c6d15a7f26", + "reference": "83f779beaea1893c0bece093ab2104c6d15a7f26", "shasum": "" }, "require": { @@ -654,7 +654,7 @@ ], "support": { "issues": "https://github.com/doctrine/dbal/issues", - "source": "https://github.com/doctrine/dbal/tree/3.3.3" + "source": "https://github.com/doctrine/dbal/tree/3.3.4" }, "funding": [ { @@ -670,7 +670,7 @@ "type": "tidelift" } ], - "time": "2022-03-09T15:39:50+00:00" + "time": "2022-03-20T18:37:29+00:00" }, { "name": "doctrine/deprecations", @@ -978,16 +978,16 @@ }, { "name": "dompdf/dompdf", - "version": "v1.2.0", + "version": "v1.2.1", "source": { "type": "git", "url": "https://github.com/dompdf/dompdf.git", - "reference": "60b704331479a69e9bcdb3496da2315b5c4f94fd" + "reference": "c6dfd9bb8b0040609f04754f729d4cb3016e0575" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/dompdf/dompdf/zipball/60b704331479a69e9bcdb3496da2315b5c4f94fd", - "reference": "60b704331479a69e9bcdb3496da2315b5c4f94fd", + "url": "https://api.github.com/repos/dompdf/dompdf/zipball/c6dfd9bb8b0040609f04754f729d4cb3016e0575", + "reference": "c6dfd9bb8b0040609f04754f729d4cb3016e0575", "shasum": "" }, "require": { @@ -1039,9 +1039,9 @@ "homepage": "https://github.com/dompdf/dompdf", "support": { "issues": "https://github.com/dompdf/dompdf/issues", - "source": "https://github.com/dompdf/dompdf/tree/v1.2.0" + "source": "https://github.com/dompdf/dompdf/tree/v1.2.1" }, - "time": "2022-02-07T13:02:10+00:00" + "time": "2022-03-24T12:57:42+00:00" }, { "name": "dragonmantank/cron-expression", @@ -1788,16 +1788,16 @@ }, { "name": "laravel/framework", - "version": "v8.83.5", + "version": "v8.83.6", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "33b1b981266e3a19fbc826b60c4a6847e311ac95" + "reference": "dffcec0cb686eafaa3b8f33db11da2cd9d69af1c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/33b1b981266e3a19fbc826b60c4a6847e311ac95", - "reference": "33b1b981266e3a19fbc826b60c4a6847e311ac95", + "url": "https://api.github.com/repos/laravel/framework/zipball/dffcec0cb686eafaa3b8f33db11da2cd9d69af1c", + "reference": "dffcec0cb686eafaa3b8f33db11da2cd9d69af1c", "shasum": "" }, "require": { @@ -1957,7 +1957,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2022-03-15T13:37:44+00:00" + "time": "2022-03-29T14:41:02+00:00" }, { "name": "laravel/serializable-closure", @@ -2089,16 +2089,16 @@ }, { "name": "laravel/tinker", - "version": "v2.7.1", + "version": "v2.7.2", "source": { "type": "git", "url": "https://github.com/laravel/tinker.git", - "reference": "1e2d500585a4e546346fadd3adc6f9c1a97e15f4" + "reference": "dff39b661e827dae6e092412f976658df82dbac5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/tinker/zipball/1e2d500585a4e546346fadd3adc6f9c1a97e15f4", - "reference": "1e2d500585a4e546346fadd3adc6f9c1a97e15f4", + "url": "https://api.github.com/repos/laravel/tinker/zipball/dff39b661e827dae6e092412f976658df82dbac5", + "reference": "dff39b661e827dae6e092412f976658df82dbac5", "shasum": "" }, "require": { @@ -2151,9 +2151,9 @@ ], "support": { "issues": "https://github.com/laravel/tinker/issues", - "source": "https://github.com/laravel/tinker/tree/v2.7.1" + "source": "https://github.com/laravel/tinker/tree/v2.7.2" }, - "time": "2022-03-15T15:25:01+00:00" + "time": "2022-03-23T12:38:24+00:00" }, { "name": "laravel/ui", @@ -7500,39 +7500,45 @@ }, { "name": "composer/composer", - "version": "2.2.9", + "version": "2.3.1", "source": { "type": "git", "url": "https://github.com/composer/composer.git", - "reference": "07eccf080ad63d55d95a7c9133506db7d9029264" + "reference": "d6c572e5f5d6d1a27bb7a1fbd1c74f777a26d436" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/composer/zipball/07eccf080ad63d55d95a7c9133506db7d9029264", - "reference": "07eccf080ad63d55d95a7c9133506db7d9029264", + "url": "https://api.github.com/repos/composer/composer/zipball/d6c572e5f5d6d1a27bb7a1fbd1c74f777a26d436", + "reference": "d6c572e5f5d6d1a27bb7a1fbd1c74f777a26d436", "shasum": "" }, "require": { "composer/ca-bundle": "^1.0", "composer/metadata-minifier": "^1.0", - "composer/pcre": "^1.0", + "composer/pcre": "^2 || ^3", "composer/semver": "^3.0", "composer/spdx-licenses": "^1.2", - "composer/xdebug-handler": "^2.0 || ^3.0", + "composer/xdebug-handler": "^2.0.2 || ^3.0.3", "justinrainbow/json-schema": "^5.2.11", - "php": "^5.3.2 || ^7.0 || ^8.0", - "psr/log": "^1.0 || ^2.0", - "react/promise": "^1.2 || ^2.7", + "php": "^7.2.5 || ^8.0", + "psr/log": "^1.0 || ^2.0 || ^3.0", + "react/promise": "^2.8", "seld/jsonlint": "^1.4", - "seld/phar-utils": "^1.0", - "symfony/console": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0", - "symfony/filesystem": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0 || ^6.0", - "symfony/finder": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0 || ^6.0", - "symfony/process": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0 || ^6.0" + "seld/phar-utils": "^1.2", + "symfony/console": "^5.4.1 || ^6.0", + "symfony/filesystem": "^5.4 || ^6.0", + "symfony/finder": "^5.4 || ^6.0", + "symfony/polyfill-php73": "^1.24", + "symfony/polyfill-php80": "^1.24", + "symfony/process": "^5.4 || ^6.0" }, "require-dev": { - "phpspec/prophecy": "^1.10", - "symfony/phpunit-bridge": "^4.2 || ^5.0 || ^6.0" + "phpstan/phpstan": "^1.4.1", + "phpstan/phpstan-deprecation-rules": "^1", + "phpstan/phpstan-phpunit": "^1.0", + "phpstan/phpstan-strict-rules": "^1", + "phpstan/phpstan-symfony": "^1.1", + "symfony/phpunit-bridge": "^6.0" }, "suggest": { "ext-openssl": "Enabling the openssl extension allows you to access https URLs for repositories and packages", @@ -7545,7 +7551,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.2-dev" + "dev-main": "2.3-dev" } }, "autoload": { @@ -7579,7 +7585,7 @@ "support": { "irc": "ircs://irc.libera.chat:6697/composer", "issues": "https://github.com/composer/composer/issues", - "source": "https://github.com/composer/composer/tree/2.2.9" + "source": "https://github.com/composer/composer/tree/2.3.1" }, "funding": [ { @@ -7595,7 +7601,7 @@ "type": "tidelift" } ], - "time": "2022-03-15T21:13:37+00:00" + "time": "2022-03-30T13:41:28+00:00" }, { "name": "composer/metadata-minifier", @@ -7668,30 +7674,30 @@ }, { "name": "composer/pcre", - "version": "1.0.1", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/composer/pcre.git", - "reference": "67a32d7d6f9f560b726ab25a061b38ff3a80c560" + "reference": "e300eb6c535192decd27a85bc72a9290f0d6b3bd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/pcre/zipball/67a32d7d6f9f560b726ab25a061b38ff3a80c560", - "reference": "67a32d7d6f9f560b726ab25a061b38ff3a80c560", + "url": "https://api.github.com/repos/composer/pcre/zipball/e300eb6c535192decd27a85bc72a9290f0d6b3bd", + "reference": "e300eb6c535192decd27a85bc72a9290f0d6b3bd", "shasum": "" }, "require": { - "php": "^5.3.2 || ^7.0 || ^8.0" + "php": "^7.4 || ^8.0" }, "require-dev": { "phpstan/phpstan": "^1.3", "phpstan/phpstan-strict-rules": "^1.1", - "symfony/phpunit-bridge": "^4.2 || ^5" + "symfony/phpunit-bridge": "^5" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "1.x-dev" + "dev-main": "3.x-dev" } }, "autoload": { @@ -7719,7 +7725,7 @@ ], "support": { "issues": "https://github.com/composer/pcre/issues", - "source": "https://github.com/composer/pcre/tree/1.0.1" + "source": "https://github.com/composer/pcre/tree/3.0.0" }, "funding": [ { @@ -7735,7 +7741,7 @@ "type": "tidelift" } ], - "time": "2022-01-21T20:24:37+00:00" + "time": "2022-02-25T20:21:48+00:00" }, { "name": "composer/semver", @@ -8882,16 +8888,16 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "1.6.0", + "version": "1.6.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706" + "reference": "77a32518733312af16a44300404e945338981de3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/93ebd0014cab80c4ea9f5e297ea48672f1b87706", - "reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/77a32518733312af16a44300404e945338981de3", + "reference": "77a32518733312af16a44300404e945338981de3", "shasum": "" }, "require": { @@ -8926,9 +8932,9 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.0" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.1" }, - "time": "2022-01-04T19:58:01+00:00" + "time": "2022-03-15T21:29:03+00:00" }, { "name": "phpspec/prophecy", @@ -8999,20 +9005,20 @@ }, { "name": "phpstan/phpstan", - "version": "1.4.10", + "version": "1.5.2", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "898c479c39caa727bedf4311dd294a8f4e250e72" + "reference": "f32e95f571c9587b4e14be05253ae56fedd00b2c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/898c479c39caa727bedf4311dd294a8f4e250e72", - "reference": "898c479c39caa727bedf4311dd294a8f4e250e72", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/f32e95f571c9587b4e14be05253ae56fedd00b2c", + "reference": "f32e95f571c9587b4e14be05253ae56fedd00b2c", "shasum": "" }, "require": { - "php": "^7.1|^8.0" + "php": "^7.2|^8.0" }, "conflict": { "phpstan/phpstan-shim": "*" @@ -9034,7 +9040,7 @@ "description": "PHPStan - PHP Static Analysis Tool", "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.4.10" + "source": "https://github.com/phpstan/phpstan/tree/1.5.2" }, "funding": [ { @@ -9054,7 +9060,7 @@ "type": "tidelift" } ], - "time": "2022-03-14T10:25:45+00:00" + "time": "2022-03-29T07:34:36+00:00" }, { "name": "phpunit/php-code-coverage", @@ -10837,5 +10843,5 @@ "platform-overrides": { "php": "7.4.0" }, - "plugin-api-version": "2.2.0" + "plugin-api-version": "2.3.0" } From affae2e3c422282f0fdf5e2c5f924182067a9fee Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Wed, 30 Mar 2022 19:29:13 +0100 Subject: [PATCH 3/3] New Crowdin updates (#3354) --- resources/lang/pt/editor.php | 30 +++++++++++++++--------------- resources/lang/pt/settings.php | 4 ++-- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/resources/lang/pt/editor.php b/resources/lang/pt/editor.php index f210e2ec9..81c33b201 100644 --- a/resources/lang/pt/editor.php +++ b/resources/lang/pt/editor.php @@ -24,7 +24,7 @@ return [ 'width' => 'Largura', 'height' => 'Altura', 'More' => 'Mais', - 'select' => 'Select...', + 'select' => 'Selecionar...', // Toolbar 'formats' => 'Formatos', @@ -53,10 +53,10 @@ return [ 'align_left' => 'Alinhar à esquerda', 'align_center' => 'Alinhar ao centro', 'align_right' => 'Alinhar à direita', - 'align_justify' => 'Justify', + 'align_justify' => 'Justificar', 'list_bullet' => 'Lista com marcadores', 'list_numbered' => 'Lista numerada', - 'list_task' => 'Task list', + 'list_task' => 'Lista de tarefas', 'indent_increase' => 'Aumentar recuo', 'indent_decrease' => 'Diminuir recuo', 'table' => 'Tabela', @@ -93,10 +93,10 @@ return [ 'cell_properties_title' => 'Propriedades da Célula', 'cell_type' => 'Tipo de célula', 'cell_type_cell' => 'Célula', - 'cell_scope' => 'Scope', + 'cell_scope' => 'Âmbito', 'cell_type_header' => 'Célula do cabeçalho', - 'merge_cells' => 'Merge cells', - 'split_cell' => 'Split cell', + 'merge_cells' => 'Unir células', + 'split_cell' => 'Dividir célula', 'table_row_group' => 'Grupo de linhas', 'table_column_group' => 'Grupo de colunas', 'horizontal_align' => 'Alinhamento horizontal', @@ -124,16 +124,16 @@ return [ 'caption' => 'Legenda', 'show_caption' => 'Mostrar legenda', 'constrain' => 'Restringir proporções', - 'cell_border_solid' => 'Solid', - 'cell_border_dotted' => 'Dotted', - 'cell_border_dashed' => 'Dashed', - 'cell_border_double' => 'Double', + 'cell_border_solid' => 'Sólido', + 'cell_border_dotted' => 'Pontilhado', + 'cell_border_dashed' => 'Tracejado', + 'cell_border_double' => 'Dupla', 'cell_border_groove' => 'Groove', 'cell_border_ridge' => 'Ridge', - 'cell_border_inset' => 'Inset', - 'cell_border_outset' => 'Outset', - 'cell_border_none' => 'None', - 'cell_border_hidden' => 'Hidden', + 'cell_border_inset' => 'Interna', + 'cell_border_outset' => 'Externa', + 'cell_border_none' => 'Nenhuma', + 'cell_border_hidden' => 'Ocultada', // Images, links, details/summary & embed 'source' => 'Fonte', @@ -154,7 +154,7 @@ return [ 'toggle_label' => 'Alternar etiqueta', // About view - 'about' => 'About the editor', + 'about' => 'Sobre o editor', 'about_title' => 'Sobre o Editor WYSIWYG', 'editor_license' => 'Editor da licença de direitos autorais', 'editor_tiny_license' => 'Este editor é criado utilizando :tinyLink que é fornecido sob uma licença LGPL v2.1.', diff --git a/resources/lang/pt/settings.php b/resources/lang/pt/settings.php index a91ecc5da..1f1f8c3bc 100644 --- a/resources/lang/pt/settings.php +++ b/resources/lang/pt/settings.php @@ -10,8 +10,8 @@ return [ 'settings' => 'Configurações', 'settings_save' => 'Guardar Configurações', 'settings_save_success' => 'Configurações guardadas', - 'system_version' => 'System Version', - 'categories' => 'Categories', + 'system_version' => 'Versão do sistema', + 'categories' => 'Categorias', // App Settings 'app_customization' => 'Personalização',