mirror of
				https://github.com/pelican-dev/panel.git
				synced 2025-10-31 22:46:53 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			41 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			41 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| namespace App\Http\Controllers\Admin\Nodes;
 | |
| 
 | |
| use Illuminate\Support\Str;
 | |
| use Illuminate\Http\Request;
 | |
| use App\Models\Node;
 | |
| use Illuminate\Http\JsonResponse;
 | |
| use App\Http\Controllers\Controller;
 | |
| use App\Repositories\Daemon\DaemonConfigurationRepository;
 | |
| 
 | |
| class SystemInformationController extends Controller
 | |
| {
 | |
|     /**
 | |
|      * SystemInformationController constructor.
 | |
|      */
 | |
|     public function __construct(private DaemonConfigurationRepository $repository)
 | |
|     {
 | |
|     }
 | |
| 
 | |
|     /**
 | |
|      * Returns system information from the Daemon.
 | |
|      *
 | |
|      * @throws \App\Exceptions\Http\Connection\DaemonConnectionException
 | |
|      */
 | |
|     public function __invoke(Request $request, Node $node): JsonResponse
 | |
|     {
 | |
|         $data = $this->repository->setNode($node)->getSystemInformation();
 | |
| 
 | |
|         return new JsonResponse([
 | |
|             'version' => $data['version'] ?? '',
 | |
|             'system' => [
 | |
|                 'type' => Str::title($data['os'] ?? 'Unknown'),
 | |
|                 'arch' => $data['architecture'] ?? '--',
 | |
|                 'release' => $data['kernel_version'] ?? '--',
 | |
|                 'cpus' => $data['cpu_count'] ?? 0,
 | |
|             ],
 | |
|         ]);
 | |
|     }
 | |
| }
 | 
