mirror of
				https://github.com/pelican-dev/panel.git
				synced 2025-10-31 06:16:51 +01:00 
			
		
		
		
	Update installer
This commit is contained in:
		
							parent
							
								
									6f15537d77
								
							
						
					
					
						commit
						83ba05d7fb
					
				| @ -7,6 +7,7 @@ use App\Filament\Pages\Installer\Steps\DatabaseStep; | ||||
| use App\Filament\Pages\Installer\Steps\EnvironmentStep; | ||||
| use App\Filament\Pages\Installer\Steps\RedisStep; | ||||
| use App\Filament\Pages\Installer\Steps\RequirementsStep; | ||||
| use App\Models\User; | ||||
| use App\Services\Users\UserCreationService; | ||||
| use App\Traits\CheckMigrationsTrait; | ||||
| use App\Traits\EnvironmentWriterTrait; | ||||
| @ -44,11 +45,22 @@ class PanelInstaller extends SimplePage implements HasForms | ||||
|         return MaxWidth::SevenExtraLarge; | ||||
|     } | ||||
| 
 | ||||
|     public static function show(): bool | ||||
|     { | ||||
|         if (User::count() <= 0) { | ||||
|             return true; | ||||
|         } | ||||
| 
 | ||||
|         if (config('panel.client_features.installer.enabled')) { | ||||
|             return true; | ||||
|         } | ||||
| 
 | ||||
|         return false; | ||||
|     } | ||||
| 
 | ||||
|     public function mount() | ||||
|     { | ||||
|         if (is_installed()) { | ||||
|             abort(404); | ||||
|         } | ||||
|         abort_unless(self::show(), 404); | ||||
| 
 | ||||
|         $this->form->fill(); | ||||
|     } | ||||
| @ -123,7 +135,7 @@ class PanelInstaller extends SimplePage implements HasForms | ||||
|             app(UserCreationService::class)->handle($userData); | ||||
| 
 | ||||
|             // Install setup complete
 | ||||
|             $this->writeToEnvironment(['APP_INSTALLED' => 'true']); | ||||
|             $this->writeToEnvironment(['APP_INSTALLER' => 'false']); | ||||
| 
 | ||||
|             $this->rememberData(); | ||||
| 
 | ||||
|  | ||||
| @ -2,6 +2,7 @@ | ||||
| 
 | ||||
| namespace App\Http\Controllers\Auth; | ||||
| 
 | ||||
| use App\Filament\Pages\Installer\PanelInstaller; | ||||
| use Carbon\CarbonImmutable; | ||||
| use Illuminate\Support\Str; | ||||
| use Illuminate\Http\Request; | ||||
| @ -17,8 +18,12 @@ class LoginController extends AbstractLoginController | ||||
|      * base authentication view component. React will take over at this point and | ||||
|      * turn the login area into an SPA. | ||||
|      */ | ||||
|     public function index(): View | ||||
|     public function index() | ||||
|     { | ||||
|         if (PanelInstaller::show()) { | ||||
|             return redirect('/installer'); | ||||
|         } | ||||
| 
 | ||||
|         return view('templates/auth.core'); | ||||
|     } | ||||
| 
 | ||||
|  | ||||
| @ -17,34 +17,3 @@ if (!function_exists('is_ip')) { | ||||
|         return $address !== null && filter_var($address, FILTER_VALIDATE_IP) !== false; | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| if (!function_exists('object_get_strict')) { | ||||
|     /** | ||||
|      * Get an object using dot notation. An object key with a value of null is still considered valid | ||||
|      * and will not trigger the response of a default value (unlike object_get). | ||||
|      */ | ||||
|     function object_get_strict(object $object, ?string $key, mixed $default = null): mixed | ||||
|     { | ||||
|         if (is_null($key) || trim($key) == '') { | ||||
|             return $object; | ||||
|         } | ||||
| 
 | ||||
|         foreach (explode('.', $key) as $segment) { | ||||
|             if (!is_object($object) || !property_exists($object, $segment)) { | ||||
|                 return value($default); | ||||
|             } | ||||
| 
 | ||||
|             $object = $object->{$segment}; | ||||
|         } | ||||
| 
 | ||||
|         return $object; | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| if (!function_exists('is_installed')) { | ||||
|     function is_installed(): bool | ||||
|     { | ||||
|         // This defaults to true so existing panels count as "installed"
 | ||||
|         return env('APP_INSTALLED', true); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -74,7 +74,7 @@ return [ | ||||
|     | Client Features | ||||
|     |-------------------------------------------------------------------------- | ||||
|     | | ||||
|     | Allow clients to create their own databases. | ||||
|     | Allow clients to turn features on or off | ||||
|     */ | ||||
| 
 | ||||
|     'client_features' => [ | ||||
| @ -93,6 +93,10 @@ return [ | ||||
|             'range_start' => env('PANEL_CLIENT_ALLOCATIONS_RANGE_START'), | ||||
|             'range_end' => env('PANEL_CLIENT_ALLOCATIONS_RANGE_END'), | ||||
|         ], | ||||
| 
 | ||||
|         'installer' => [ | ||||
|             'enabled' => env('APP_INSTALLER', true), | ||||
|         ], | ||||
|     ], | ||||
| 
 | ||||
|     /* | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Lance Pioch
						Lance Pioch