Merge pull request #203 from php-flasher/laravel-excluded-paths

chore: add Laravel excluded paths option
This commit is contained in:
Younes ENNAJI
2024-10-20 15:08:15 +01:00
committed by GitHub
4 changed files with 13 additions and 4 deletions
+5 -1
View File
@@ -1,6 +1,10 @@
# CHANGELOG for 2.x
## [Unreleased](https://github.com/php-flasher/php-flasher/compare/v2.1.0...2.x)
## [Unreleased](https://github.com/php-flasher/php-flasher/compare/v2.1.1...2.x)
## [v2.1.1](https://github.com/php-flasher/php-flasher/compare/v2.1.0...v2.1.1) - 2024-10-20
* feature [Laravel] Add `excluded_paths` option. See [PR #203](https://github.com/php-flasher/php-flasher/pull/203) by [yoeunes](https://github.com/yoeunes)
## [v2.1.0](https://github.com/php-flasher/php-flasher/compare/v2.0.4...v2.1.0) - 2024-10-19
+1 -1
View File
@@ -1967,7 +1967,7 @@
},
"node_modules/@clack/prompts/node_modules/is-unicode-supported": {
"version": "1.3.0",
"dev": true,
"extraneous": true,
"inBundle": true,
"license": "MIT",
"engines": {
+4 -1
View File
@@ -227,10 +227,13 @@ final class FlasherServiceProvider extends PluginServiceProvider
}
$this->app->singleton(FlasherMiddleware::class, static function (Application $app) {
$config = $app->make('config');
$flasher = $app->make('flasher');
$cspHandler = $app->make('flasher.csp_handler');
$excludedPaths = $config->get('flasher.excluded_paths', []) ?: [];
return new FlasherMiddleware(new ResponseExtension($flasher, $cspHandler));
return new FlasherMiddleware(new ResponseExtension($flasher, $cspHandler, $excludedPaths));
});
$this->pushMiddlewareToGroup(FlasherMiddleware::class);
+3 -1
View File
@@ -13,6 +13,7 @@ namespace Illuminate\Contracts\Config;
* scripts: string[],
* styles: string[],
* options: array<string, mixed>,
* excluded_paths?: list<non-empty-string>,
* filter: array<string, mixed>,
* flash_bag: array<string, string[]>,
* presets: array<string, PresetType>,
@@ -44,7 +45,8 @@ interface Repository
* ($key is 'flasher.presets' ? array<string, PresetType> :
* ($key is 'flasher.plugins' ? array<string, PluginType> :
* ($key is 'flasher.flash_bag' ? array<string, string[]> :
* mixed)))))))
* ($key is 'flasher.excluded_paths' ? list<non-empty-string> :
* mixed))))))))
*/
public function get(string|array $key, mixed $default = null): mixed;
}