Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
asbiin committed Feb 24, 2024
1 parent 0495f64 commit 1f24f0e
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/postCreate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions app/Providers/RouteServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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());
});
Expand Down
2 changes: 2 additions & 0 deletions config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@

'asset_url' => env('ASSET_URL'),

'force_url' => (bool) env('APP_FORCE_URL', false),

/*
|--------------------------------------------------------------------------
| Application Timezone
Expand Down
1 change: 1 addition & 0 deletions resources/css/app.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@import 'charts.css';
@tailwind base;
@tailwind components;
@tailwind utilities;
Expand Down
2 changes: 1 addition & 1 deletion resources/js/app.js
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion resources/views/layouts/app.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>⛺</text></svg>">

<!-- Scripts -->
@vite(['resources/css/app.css', 'resources/js/app.js'])
@vite('resources/js/app.js')
</head>

<body class="font-sans antialiased text-slate-900 dark:text-gray-100">
Expand Down
2 changes: 1 addition & 1 deletion resources/views/layouts/guest.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<title>{{ config('app.name', 'Laravel') }}</title>

<!-- Scripts -->
@vite(['resources/css/app.css', 'resources/js/app.js'])
@vite('resources/js/app.js')

{{ $jsonLdSchema ?? '' }}

Expand Down
2 changes: 1 addition & 1 deletion resources/views/layouts/login.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<title>{{ config('app.name', 'Laravel') }}</title>

<!-- Scripts -->
@vite(['resources/css/app.css', 'resources/js/app.js'])
@vite('resources/js/app.js')

{{ $jsonLdSchema ?? '' }}

Expand Down
5 changes: 4 additions & 1 deletion vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down

0 comments on commit 1f24f0e

Please sign in to comment.