22
33namespace Pterodactyl \Http \Controllers \Api \Client \Servers ;
44
5- use Carbon \CarbonImmutable ;
65use Pterodactyl \Models \Server ;
7- use Illuminate \Http \JsonResponse ;
86use Pterodactyl \Services \Servers \StartupCommandService ;
97use Pterodactyl \Services \Servers \VariableValidatorService ;
108use Pterodactyl \Repositories \Eloquent \ServerVariableRepository ;
119use Pterodactyl \Transformers \Api \Client \EggVariableTransformer ;
1210use Pterodactyl \Http \Controllers \Api \Client \ClientApiController ;
13- use Symfony \Component \HttpKernel \Exception \NotFoundHttpException ;
1411use Symfony \Component \HttpKernel \Exception \BadRequestHttpException ;
1512use Pterodactyl \Http \Requests \Api \Client \Servers \Startup \GetStartupRequest ;
1613use Pterodactyl \Http \Requests \Api \Client \Servers \Startup \UpdateStartupVariableRequest ;
@@ -59,7 +56,9 @@ public function index(GetStartupRequest $request, Server $server)
5956 {
6057 $ startup = $ this ->startupCommandService ->handle ($ server , false );
6158
62- return $ this ->fractal ->collection ($ server ->variables )
59+ return $ this ->fractal ->collection (
60+ $ server ->variables ()->where ('user_viewable ' , true )->get ()
61+ )
6362 ->transformWith ($ this ->getTransformer (EggVariableTransformer::class))
6463 ->addMeta ([
6564 'startup_command ' => $ startup ,
@@ -84,7 +83,7 @@ public function update(UpdateStartupVariableRequest $request, Server $server)
8483 /** @var \Pterodactyl\Models\EggVariable $variable */
8584 $ variable = $ server ->variables ()->where ('env_variable ' , $ request ->input ('key ' ))->first ();
8685
87- if (is_null ($ variable ) || !$ variable ->user_viewable ) {
86+ if (is_null ($ variable ) || ! $ variable ->user_viewable ) {
8887 throw new BadRequestHttpException (
8988 "The environment variable you are trying to edit does not exist. "
9089 );
0 commit comments