From 87e78f22a13242af95155c6b37ef145f71d14e1a Mon Sep 17 00:00:00 2001 From: nmeri17 Date: Mon, 3 Jul 2023 14:17:24 +0100 Subject: [PATCH] Connect htmlParser to a default blade adapter Add settings to the rr.yaml enabling it server static assets --- .gitignore | 3 ++- .../_module_name/Config/CustomBladeAdapter.php | 16 ++++++++++++++++ .../Markup/components/AppLayouts.php | 8 +++++++- .../_module_name/Markup/layouts/app.blade.php | 4 ++-- .../Markup/partials/random-page.blade.php | 3 +++ .../Meta/CustomInterfaceCollection.php | 8 +++++--- dev-rr.yaml | 6 ++++++ 7 files changed, 41 insertions(+), 7 deletions(-) create mode 100644 ModuleTemplate/AllModules/_module_name/Config/CustomBladeAdapter.php create mode 100644 ModuleTemplate/AllModules/_module_name/Markup/partials/random-page.blade.php diff --git a/.gitignore b/.gitignore index f261b7b..a8e190a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /vendor .vscode -.idea \ No newline at end of file +.idea +rr-queues.db \ No newline at end of file diff --git a/ModuleTemplate/AllModules/_module_name/Config/CustomBladeAdapter.php b/ModuleTemplate/AllModules/_module_name/Config/CustomBladeAdapter.php new file mode 100644 index 0000000..d9c6c01 --- /dev/null +++ b/ModuleTemplate/AllModules/_module_name/Config/CustomBladeAdapter.php @@ -0,0 +1,16 @@ +bladeCompiler->component("layout", AppLayouts::class); + } +} \ No newline at end of file diff --git a/ModuleTemplate/AllModules/_module_name/Markup/components/AppLayouts.php b/ModuleTemplate/AllModules/_module_name/Markup/components/AppLayouts.php index fc567c3..74b3080 100644 --- a/ModuleTemplate/AllModules/_module_name/Markup/components/AppLayouts.php +++ b/ModuleTemplate/AllModules/_module_name/Markup/components/AppLayouts.php @@ -6,12 +6,18 @@ class AppLayouts extends Component { - public function __construct($pageTitle, $scripts) + public function __construct( + + public string $pageTitle = "Suphle", public string $scripts = "" + ) { // } + /** + * @return \Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View + */ public function render() { diff --git a/ModuleTemplate/AllModules/_module_name/Markup/layouts/app.blade.php b/ModuleTemplate/AllModules/_module_name/Markup/layouts/app.blade.php index e4c0dd8..4af68a7 100644 --- a/ModuleTemplate/AllModules/_module_name/Markup/layouts/app.blade.php +++ b/ModuleTemplate/AllModules/_module_name/Markup/layouts/app.blade.php @@ -3,9 +3,9 @@ - {{ $pageTitle ?? "Suphle"}} + {{$pageTitle}} - @yield("scripts") + {{$scripts}} {{ $slot }} diff --git a/ModuleTemplate/AllModules/_module_name/Markup/partials/random-page.blade.php b/ModuleTemplate/AllModules/_module_name/Markup/partials/random-page.blade.php new file mode 100644 index 0000000..0040663 --- /dev/null +++ b/ModuleTemplate/AllModules/_module_name/Markup/partials/random-page.blade.php @@ -0,0 +1,3 @@ + +
+
\ No newline at end of file diff --git a/ModuleTemplate/AllModules/_module_name/Meta/CustomInterfaceCollection.php b/ModuleTemplate/AllModules/_module_name/Meta/CustomInterfaceCollection.php index 2b5832f..2224103 100644 --- a/ModuleTemplate/AllModules/_module_name/Meta/CustomInterfaceCollection.php +++ b/ModuleTemplate/AllModules/_module_name/Meta/CustomInterfaceCollection.php @@ -4,9 +4,9 @@ use Suphle\Hydration\Structures\BaseInterfaceCollection; -use Suphle\Contracts\{Config\Router, Auth\UserContract}; +use Suphle\Contracts\{Config\Router, Auth\UserContract, Presentation\HtmlParser}; -use AllModules\_module_name\Config\RouterMock; +use AllModules\_module_name\Config\{RouterMock, CustomBladeAdapter}; use AppModels\User as EloquentUser; // hard-coded cuz different processes control module cloning and component ejection @@ -30,7 +30,9 @@ public function simpleBinds(): array _module_name::class => ModuleApi::class, - UserContract::class => EloquentUser::class + UserContract::class => EloquentUser::class, + + HtmlParser::class => CustomBladeAdapter::class ]); } } diff --git a/dev-rr.yaml b/dev-rr.yaml index 76819be..e1e30a1 100644 --- a/dev-rr.yaml +++ b/dev-rr.yaml @@ -16,6 +16,12 @@ http: address: localhost:8080 pool: num_workers: 4 + middleware: ["headers", "static", "gzip"] + uploads: + forbid: [".php", ".exe", ".bat"] + static: + dir: "public" + forbid: [".php", ".htaccess"] # Boltdb jobs driver #