Update deprecated JSON response creation and unnecessary middleware
This commit is contained in:
parent
f5ad9b9e11
commit
530558b0f8
11 changed files with 9 additions and 91 deletions
|
@ -74,7 +74,7 @@ class NodeAutoDeployController extends Controller
|
|||
], ['r_nodes' => 1]);
|
||||
}
|
||||
|
||||
return JsonResponse::create([
|
||||
return new JsonResponse([
|
||||
'node' => $node->id,
|
||||
'token' => $key->identifier . $this->encrypter->decrypt($key->token),
|
||||
]);
|
||||
|
|
|
@ -35,7 +35,7 @@ class SystemInformationController extends Controller
|
|||
{
|
||||
$data = $this->repository->setNode($node)->getSystemInformation();
|
||||
|
||||
return JsonResponse::create([
|
||||
return new JsonResponse([
|
||||
'version' => $data['version'] ?? '',
|
||||
'system' => [
|
||||
'type' => Str::title($data['os'] ?? 'Unknown'),
|
||||
|
|
|
@ -18,6 +18,6 @@ class NodeConfigurationController extends ApplicationApiController
|
|||
*/
|
||||
public function __invoke(GetNodeRequest $request, Node $node)
|
||||
{
|
||||
return JsonResponse::create($node->getConfiguration());
|
||||
return new JsonResponse($node->getConfiguration());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ class DatabaseController extends ApplicationApiController
|
|||
{
|
||||
$this->databasePasswordService->handle($database);
|
||||
|
||||
return JsonResponse::create([], JsonResponse::HTTP_NO_CONTENT);
|
||||
return new JsonResponse([], JsonResponse::HTTP_NO_CONTENT);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -102,6 +102,6 @@ class ApiKeyController extends ClientApiController
|
|||
throw new NotFoundHttpException();
|
||||
}
|
||||
|
||||
return JsonResponse::create([], JsonResponse::HTTP_NO_CONTENT);
|
||||
return new JsonResponse([], JsonResponse::HTTP_NO_CONTENT);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ class ServerInstallController extends Controller
|
|||
$server = $this->repository->getByUuid($uuid);
|
||||
$egg = $server->egg;
|
||||
|
||||
return JsonResponse::create([
|
||||
return new JsonResponse([
|
||||
'container_image' => $egg->copy_script_container,
|
||||
'entrypoint' => $egg->copy_script_entry,
|
||||
'script' => $egg->copy_script_install,
|
||||
|
|
|
@ -31,7 +31,7 @@ class LocaleController extends Controller
|
|||
{
|
||||
$data = $this->translator->getLoader()->load($locale, str_replace('.', '/', $namespace));
|
||||
|
||||
return JsonResponse::create($data, 200, [
|
||||
return new JsonResponse($data, 200, [
|
||||
'E-Tag' => md5(json_encode($data)),
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
namespace Pterodactyl\Http;
|
||||
|
||||
use Illuminate\Http\Middleware\TrustProxies;
|
||||
use Pterodactyl\Models\ApiKey;
|
||||
use Illuminate\Auth\Middleware\Authorize;
|
||||
use Illuminate\Auth\Middleware\Authenticate;
|
||||
use Pterodactyl\Http\Middleware\TrimStrings;
|
||||
use Pterodactyl\Http\Middleware\TrustProxies;
|
||||
use Illuminate\Session\Middleware\StartSession;
|
||||
use Pterodactyl\Http\Middleware\EncryptCookies;
|
||||
use Pterodactyl\Http\Middleware\Api\IsValidJson;
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Http\Middleware;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Fideloper\Proxy\TrustProxies as Middleware;
|
||||
|
||||
class TrustProxies extends Middleware
|
||||
{
|
||||
/**
|
||||
* The trusted proxies for this application.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $proxies;
|
||||
|
||||
/**
|
||||
* The headers that should be used to detect proxies.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $headers = Request::HEADER_X_FORWARDED_ALL;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue