diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index e7a7e0b5d..673409ba6 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -17,6 +17,10 @@ class Controller extends BaseController { use AuthorizesRequests, ValidatesRequests; + public function license() + { + return view('license'); + } public function dashboard() { $projects = Project::ownedByCurrentTeam()->get(); diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index f25f52c39..7beaad19e 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -21,6 +21,7 @@ class Kernel extends HttpKernel \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, \App\Http\Middleware\TrimStrings::class, \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class, + // \App\Http\Middleware\LicenseValid::class, ]; /** diff --git a/app/Http/Livewire/License.php b/app/Http/Livewire/License.php new file mode 100644 index 000000000..14c147a87 --- /dev/null +++ b/app/Http/Livewire/License.php @@ -0,0 +1,26 @@ +validate([ + 'license' => 'required' + ]); + // Pretend we're checking the license + // if ($this->license === '123') { + // ray('license is valid'); + // Cache::put('license_key', '123'); + // return redirect()->to('/'); + // } else { + // ray('license is invalid'); + // } + } +} diff --git a/app/Http/Middleware/LicenseValid.php b/app/Http/Middleware/LicenseValid.php new file mode 100644 index 000000000..099092ff9 --- /dev/null +++ b/app/Http/Middleware/LicenseValid.php @@ -0,0 +1,30 @@ +path()); + if ($request->path() !== 'license' && $request->path() !== 'livewire/message/license') { + return redirect('license'); + } + } + } + return $next($request); + } +} diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 9fa586116..b8c70b770 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -2,21 +2,16 @@ namespace App\Providers; +use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\Http; use Illuminate\Support\ServiceProvider; class AppServiceProvider extends ServiceProvider { - /** - * Register any application services. - */ public function register(): void { } - /** - * Bootstrap any application services. - */ public function boot(): void { Http::macro('github', function (string $api_url, string|null $github_access_token = null) { diff --git a/resources/views/components/layout-simple.blade.php b/resources/views/components/layout-simple.blade.php index 6fe145a74..604768ccd 100644 --- a/resources/views/components/layout-simple.blade.php +++ b/resources/views/components/layout-simple.blade.php @@ -19,9 +19,11 @@ display: none !important; } + @livewireStyles
+ @livewireScripts