From 1f24f0e47701301fe37276e3a3c83acd3ccf37d1 Mon Sep 17 00:00:00 2001 From: Alexis Saettler Date: Sat, 24 Feb 2024 21:18:01 +0000 Subject: [PATCH] fix --- .devcontainer/postCreate.sh | 2 +- app/Providers/RouteServiceProvider.php | 8 ++++++++ config/app.php | 2 ++ resources/css/app.css | 1 + resources/js/app.js | 2 +- resources/views/layouts/app.blade.php | 2 +- resources/views/layouts/guest.blade.php | 2 +- resources/views/layouts/login.blade.php | 2 +- vite.config.js | 5 ++++- 9 files changed, 20 insertions(+), 6 deletions(-) diff --git a/.devcontainer/postCreate.sh b/.devcontainer/postCreate.sh index 4486184..bb5f462 100755 --- a/.devcontainer/postCreate.sh +++ b/.devcontainer/postCreate.sh @@ -31,7 +31,7 @@ set_apache() { } set_database() { - cp $ROOT/.env.example $ROOT/.env && echo "APP_TRUSTED_PROXIES=*" >> $ROOT/.env + cp $ROOT/.env.example $ROOT/.env && echo -e "APP_TRUSTED_PROXIES=*\nAPP_FORCE_URL=true" >> $ROOT/.env setenv "DB_CONNECTION" "sqlite" setenv "DB_DATABASE" "$ROOT/$DATABASE" touch $ROOT/$DATABASE && chgrp www-data $ROOT/$DATABASE && chmod g+w $ROOT/$DATABASE diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index 69ffade..93f038f 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -5,8 +5,11 @@ use Illuminate\Cache\RateLimiting\Limit; use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider; use Illuminate\Http\Request; +use Illuminate\Support\Facades\Config; use Illuminate\Support\Facades\RateLimiter; use Illuminate\Support\Facades\Route; +use Illuminate\Support\Facades\URL; +use Illuminate\Support\Str; class RouteServiceProvider extends ServiceProvider { @@ -24,6 +27,11 @@ class RouteServiceProvider extends ServiceProvider */ public function boot(): void { + if (Config::get('app.force_url')) { + URL::forceRootUrl(Str::of(config('app.url'))->ltrim('/')); + URL::forceScheme('https'); + } + RateLimiter::for('api', function (Request $request) { return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip()); }); diff --git a/config/app.php b/config/app.php index b8d8cb8..2b734cc 100644 --- a/config/app.php +++ b/config/app.php @@ -59,6 +59,8 @@ 'asset_url' => env('ASSET_URL'), + 'force_url' => (bool) env('APP_FORCE_URL', false), + /* |-------------------------------------------------------------------------- | Application Timezone diff --git a/resources/css/app.css b/resources/css/app.css index 547f4f9..7ce3903 100644 --- a/resources/css/app.css +++ b/resources/css/app.css @@ -1,3 +1,4 @@ +@import 'charts.css'; @tailwind base; @tailwind components; @tailwind utilities; diff --git a/resources/js/app.js b/resources/js/app.js index e22d0c2..0c759a7 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -1,9 +1,9 @@ import './bootstrap'; +import '../css/app.css'; import Alpine from 'alpinejs'; import Clipboard from "@ryangjchandler/alpine-clipboard"; import htmx from 'htmx.org'; -import 'charts.css'; window.Alpine = Alpine; window.htmx = htmx; diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index 6da4035..574ed32 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -11,7 +11,7 @@ - @vite(['resources/css/app.css', 'resources/js/app.js']) + @vite('resources/js/app.js') diff --git a/resources/views/layouts/guest.blade.php b/resources/views/layouts/guest.blade.php index dc35bb9..adbece7 100644 --- a/resources/views/layouts/guest.blade.php +++ b/resources/views/layouts/guest.blade.php @@ -10,7 +10,7 @@ {{ config('app.name', 'Laravel') }} - @vite(['resources/css/app.css', 'resources/js/app.js']) + @vite('resources/js/app.js') {{ $jsonLdSchema ?? '' }} diff --git a/resources/views/layouts/login.blade.php b/resources/views/layouts/login.blade.php index cfc37dc..48a0a6d 100644 --- a/resources/views/layouts/login.blade.php +++ b/resources/views/layouts/login.blade.php @@ -9,7 +9,7 @@ {{ config('app.name', 'Laravel') }} - @vite(['resources/css/app.css', 'resources/js/app.js']) + @vite('resources/js/app.js') {{ $jsonLdSchema ?? '' }} diff --git a/vite.config.js b/vite.config.js index efa4615..ed14ada 100644 --- a/vite.config.js +++ b/vite.config.js @@ -10,7 +10,10 @@ export default defineConfig(({ mode }) => { return { plugins: [ laravel({ - input: ['resources/css/app.css', 'resources/js/app.js'], + input: [ + 'resources/css/app.css', + 'resources/js/app.js' + ], refresh: true, }), basicSsl(),