mirror of
				https://github.com/pelican-dev/panel.git
				synced 2025-10-31 12:36:53 +01:00 
			
		
		
		
	fix phpstan in Node and EditProfile
This commit is contained in:
		
							parent
							
								
									eb99f53d87
								
							
						
					
					
						commit
						f43fb985a2
					
				| @ -101,15 +101,18 @@ class EditProfile extends \Filament\Pages\Auth\EditProfile | |||||||
|                                     ->icon('tabler-shield-lock') |                                     ->icon('tabler-shield-lock') | ||||||
|                                     ->schema(function () { |                                     ->schema(function () { | ||||||
| 
 | 
 | ||||||
|                                         if ($this->getUser()->use_totp) { |                                         /** @var User */ | ||||||
|  |                                         $user = auth()->user(); | ||||||
|  | 
 | ||||||
|  |                                         if (auth()->user()->use_totp) { | ||||||
|                                             return [ |                                             return [ | ||||||
|                                                 Placeholder::make('2fa-already-enabled') |                                                 Placeholder::make('2fa-already-enabled') | ||||||
|                                                     ->label('Two Factor Authentication is currently enabled!'), |                                                     ->label('Two Factor Authentication is currently enabled!'), | ||||||
|                                                 Textarea::make('backup-tokens') |                                                 Textarea::make('backup-tokens') | ||||||
|                                                     ->hidden(fn () => !cache()->get("users.{$this->getUser()->id}.2fa.tokens")) |                                                     ->hidden(fn () => !cache()->get("users.{$user->id}.2fa.tokens")) | ||||||
|                                                     ->rows(10) |                                                     ->rows(10) | ||||||
|                                                     ->readOnly() |                                                     ->readOnly() | ||||||
|                                                     ->formatStateUsing(fn () => cache()->get("users.{$this->getUser()->id}.2fa.tokens")) |                                                     ->formatStateUsing(fn () => cache()->get("users.{$user->id}.2fa.tokens")) | ||||||
|                                                     ->helperText('These will not be shown again!') |                                                     ->helperText('These will not be shown again!') | ||||||
|                                                     ->label('Backup Tokens:'), |                                                     ->label('Backup Tokens:'), | ||||||
|                                                 TextInput::make('2fa-disable-code') |                                                 TextInput::make('2fa-disable-code') | ||||||
| @ -117,15 +120,17 @@ class EditProfile extends \Filament\Pages\Auth\EditProfile | |||||||
|                                                     ->helperText('Enter your current 2FA code to disable Two Factor Authentication'), |                                                     ->helperText('Enter your current 2FA code to disable Two Factor Authentication'), | ||||||
|                                             ]; |                                             ]; | ||||||
|                                         } |                                         } | ||||||
|  |                                         /** @var TwoFactorSetupService */ | ||||||
|                                         $setupService = app(TwoFactorSetupService::class); |                                         $setupService = app(TwoFactorSetupService::class); | ||||||
| 
 | 
 | ||||||
|                                         ['image_url_data' => $url, 'secret' => $secret] = cache()->remember( |                                         ['image_url_data' => $url, 'secret' => $secret] = cache()->remember( | ||||||
|                                             "users.{$this->getUser()->id}.2fa.state", |                                             "users.{$user->id}.2fa.state", | ||||||
|                                             now()->addMinutes(5), fn () => $setupService->handle($this->getUser()) |                                             now()->addMinutes(5), fn () => $setupService->handle(auth()->user()) | ||||||
|                                         ); |                                         ); | ||||||
| 
 | 
 | ||||||
|                                         $options = new QROptions([ |                                         $options = new QROptions([ | ||||||
|                                             'svgLogo' => public_path('pelican.svg'), |                                             'svgLogo' => public_path('pelican.svg'), | ||||||
|  |                                             'svgLogoScale' => 0.05, | ||||||
|                                             'addLogoSpace' => true, |                                             'addLogoSpace' => true, | ||||||
|                                             'logoSpaceWidth' => 13, |                                             'logoSpaceWidth' => 13, | ||||||
|                                             'logoSpaceHeight' => 13, |                                             'logoSpaceHeight' => 13, | ||||||
| @ -133,22 +138,24 @@ class EditProfile extends \Filament\Pages\Auth\EditProfile | |||||||
| 
 | 
 | ||||||
|                                         // https://github.com/chillerlan/php-qrcode/blob/main/examples/svgWithLogo.php
 |                                         // https://github.com/chillerlan/php-qrcode/blob/main/examples/svgWithLogo.php
 | ||||||
| 
 | 
 | ||||||
|                                         // SVG logo options (see extended class)
 |  | ||||||
|                                         $options->svgLogo = public_path('pelican.svg'); // logo from: https://github.com/simple-icons/simple-icons
 |  | ||||||
|                                         $options->svgLogoScale = 0.05; |  | ||||||
|                                         // $options->svgLogoCssClass     = 'dark';
 |  | ||||||
| 
 |  | ||||||
|                                         // QROptions
 |                                         // QROptions
 | ||||||
|  |                                         // @phpstan-ignore property.protected
 | ||||||
|                                         $options->version = Version::AUTO; |                                         $options->version = Version::AUTO; | ||||||
|                                         // $options->outputInterface     = QRSvgWithLogo::class;
 |                                         // $options->outputInterface     = QRSvgWithLogo::class;
 | ||||||
|  |                                         // @phpstan-ignore property.protected
 | ||||||
|                                         $options->outputBase64 = false; |                                         $options->outputBase64 = false; | ||||||
|  |                                         // @phpstan-ignore property.protected
 | ||||||
|                                         $options->eccLevel = EccLevel::H; // ECC level H is necessary when using logos
 |                                         $options->eccLevel = EccLevel::H; // ECC level H is necessary when using logos
 | ||||||
|  |                                         // @phpstan-ignore property.protected
 | ||||||
|                                         $options->addQuietzone = true; |                                         $options->addQuietzone = true; | ||||||
|                                         // $options->drawLightModules    = true;
 |                                         // $options->drawLightModules    = true;
 | ||||||
|  |                                         // @phpstan-ignore property.protected
 | ||||||
|                                         $options->connectPaths = true; |                                         $options->connectPaths = true; | ||||||
|  |                                         // @phpstan-ignore property.protected
 | ||||||
|                                         $options->drawCircularModules = true; |                                         $options->drawCircularModules = true; | ||||||
|                                         // $options->circleRadius        = 0.45;
 |                                         // $options->circleRadius        = 0.45;
 | ||||||
| 
 | 
 | ||||||
|  |                                         // @phpstan-ignore property.protected
 | ||||||
|                                         $options->svgDefs = '<linearGradient id="gradient" x1="100%" y2="100%"> |                                         $options->svgDefs = '<linearGradient id="gradient" x1="100%" y2="100%"> | ||||||
|                                             <stop stop-color="#7dd4fc" offset="0"/> |                                             <stop stop-color="#7dd4fc" offset="0"/> | ||||||
|                                             <stop stop-color="#38bdf8" offset="0.5"/> |                                             <stop stop-color="#38bdf8" offset="0.5"/> | ||||||
| @ -196,8 +203,8 @@ class EditProfile extends \Filament\Pages\Auth\EditProfile | |||||||
|                                             ])->headerActions([ |                                             ])->headerActions([ | ||||||
|                                                 Action::make('Create') |                                                 Action::make('Create') | ||||||
|                                                     ->successRedirectUrl(route('filament.admin.auth.profile', ['tab' => '-api-keys-tab'])) |                                                     ->successRedirectUrl(route('filament.admin.auth.profile', ['tab' => '-api-keys-tab'])) | ||||||
|                                                     ->action(function (Get $get, Action $action) { |                                                     ->action(function (Get $get, Action $action, $user) { | ||||||
|                                                         $token = auth()->user()->createToken( |                                                         $token = $user->createToken( | ||||||
|                                                             $get('description'), |                                                             $get('description'), | ||||||
|                                                             $get('allowed_ips'), |                                                             $get('allowed_ips'), | ||||||
|                                                         ); |                                                         ); | ||||||
| @ -258,7 +265,7 @@ class EditProfile extends \Filament\Pages\Auth\EditProfile | |||||||
|                             ]), |                             ]), | ||||||
|                     ]) |                     ]) | ||||||
|                     ->operation('edit') |                     ->operation('edit') | ||||||
|                     ->model($this->getUser()) |                     ->model(auth()->user()) | ||||||
|                     ->statePath('data') |                     ->statePath('data') | ||||||
|                     ->inlineLabel(!static::isSimple()), |                     ->inlineLabel(!static::isSimple()), | ||||||
|             ), |             ), | ||||||
|  | |||||||
| @ -34,6 +34,7 @@ use Illuminate\Database\Eloquent\Relations\HasManyThrough; | |||||||
|  * @property int $daemon_listen |  * @property int $daemon_listen | ||||||
|  * @property int $daemon_sftp |  * @property int $daemon_sftp | ||||||
|  * @property string $daemon_base |  * @property string $daemon_base | ||||||
|  |  * @property array $tags | ||||||
|  * @property \Carbon\Carbon $created_at |  * @property \Carbon\Carbon $created_at | ||||||
|  * @property \Carbon\Carbon $updated_at |  * @property \Carbon\Carbon $updated_at | ||||||
|  * @property \App\Models\Mount[]|\Illuminate\Database\Eloquent\Collection $mounts |  * @property \App\Models\Mount[]|\Illuminate\Database\Eloquent\Collection $mounts | ||||||
| @ -131,6 +132,10 @@ class Node extends Model | |||||||
|         ]; |         ]; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     public int $servers_sum_memory; | ||||||
|  |     public int $servers_sum_disk; | ||||||
|  |     public int $servers_sum_cpu; | ||||||
|  | 
 | ||||||
|     public function getRouteKeyName(): string |     public function getRouteKeyName(): string | ||||||
|     { |     { | ||||||
|         return 'id'; |         return 'id'; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Boy132
						Boy132