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]);
|
], ['r_nodes' => 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return JsonResponse::create([
|
return new JsonResponse([
|
||||||
'node' => $node->id,
|
'node' => $node->id,
|
||||||
'token' => $key->identifier . $this->encrypter->decrypt($key->token),
|
'token' => $key->identifier . $this->encrypter->decrypt($key->token),
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -35,7 +35,7 @@ class SystemInformationController extends Controller
|
||||||
{
|
{
|
||||||
$data = $this->repository->setNode($node)->getSystemInformation();
|
$data = $this->repository->setNode($node)->getSystemInformation();
|
||||||
|
|
||||||
return JsonResponse::create([
|
return new JsonResponse([
|
||||||
'version' => $data['version'] ?? '',
|
'version' => $data['version'] ?? '',
|
||||||
'system' => [
|
'system' => [
|
||||||
'type' => Str::title($data['os'] ?? 'Unknown'),
|
'type' => Str::title($data['os'] ?? 'Unknown'),
|
||||||
|
|
|
@ -18,6 +18,6 @@ class NodeConfigurationController extends ApplicationApiController
|
||||||
*/
|
*/
|
||||||
public function __invoke(GetNodeRequest $request, Node $node)
|
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);
|
$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();
|
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);
|
$server = $this->repository->getByUuid($uuid);
|
||||||
$egg = $server->egg;
|
$egg = $server->egg;
|
||||||
|
|
||||||
return JsonResponse::create([
|
return new JsonResponse([
|
||||||
'container_image' => $egg->copy_script_container,
|
'container_image' => $egg->copy_script_container,
|
||||||
'entrypoint' => $egg->copy_script_entry,
|
'entrypoint' => $egg->copy_script_entry,
|
||||||
'script' => $egg->copy_script_install,
|
'script' => $egg->copy_script_install,
|
||||||
|
|
|
@ -31,7 +31,7 @@ class LocaleController extends Controller
|
||||||
{
|
{
|
||||||
$data = $this->translator->getLoader()->load($locale, str_replace('.', '/', $namespace));
|
$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)),
|
'E-Tag' => md5(json_encode($data)),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Http;
|
namespace Pterodactyl\Http;
|
||||||
|
|
||||||
|
use Illuminate\Http\Middleware\TrustProxies;
|
||||||
use Pterodactyl\Models\ApiKey;
|
use Pterodactyl\Models\ApiKey;
|
||||||
use Illuminate\Auth\Middleware\Authorize;
|
use Illuminate\Auth\Middleware\Authorize;
|
||||||
use Illuminate\Auth\Middleware\Authenticate;
|
use Illuminate\Auth\Middleware\Authenticate;
|
||||||
use Pterodactyl\Http\Middleware\TrimStrings;
|
use Pterodactyl\Http\Middleware\TrimStrings;
|
||||||
use Pterodactyl\Http\Middleware\TrustProxies;
|
|
||||||
use Illuminate\Session\Middleware\StartSession;
|
use Illuminate\Session\Middleware\StartSession;
|
||||||
use Pterodactyl\Http\Middleware\EncryptCookies;
|
use Pterodactyl\Http\Middleware\EncryptCookies;
|
||||||
use Pterodactyl\Http\Middleware\Api\IsValidJson;
|
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;
|
|
||||||
}
|
|
|
@ -19,7 +19,6 @@
|
||||||
"ext-zip": "*",
|
"ext-zip": "*",
|
||||||
"aws/aws-sdk-php": "^3.171",
|
"aws/aws-sdk-php": "^3.171",
|
||||||
"doctrine/dbal": "~2.13.9",
|
"doctrine/dbal": "~2.13.9",
|
||||||
"fideloper/proxy": "~4.4.1",
|
|
||||||
"guzzlehttp/guzzle": "~7.4.2",
|
"guzzlehttp/guzzle": "~7.4.2",
|
||||||
"hashids/hashids": "~4.1.0",
|
"hashids/hashids": "~4.1.0",
|
||||||
"laracasts/utilities": "~3.2.1",
|
"laracasts/utilities": "~3.2.1",
|
||||||
|
|
60
composer.lock
generated
60
composer.lock
generated
|
@ -4,7 +4,7 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "d51c727b5c04b52d1d56e2e64e8355b9",
|
"content-hash": "75eb69604c51a9ac2dcdf4da1f6d24cb",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "aws/aws-crt-php",
|
"name": "aws/aws-crt-php",
|
||||||
|
@ -923,64 +923,6 @@
|
||||||
],
|
],
|
||||||
"time": "2020-12-29T14:50:06+00:00"
|
"time": "2020-12-29T14:50:06+00:00"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "fideloper/proxy",
|
|
||||||
"version": "4.4.1",
|
|
||||||
"source": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/fideloper/TrustedProxy.git",
|
|
||||||
"reference": "c073b2bd04d1c90e04dc1b787662b558dd65ade0"
|
|
||||||
},
|
|
||||||
"dist": {
|
|
||||||
"type": "zip",
|
|
||||||
"url": "https://api.github.com/repos/fideloper/TrustedProxy/zipball/c073b2bd04d1c90e04dc1b787662b558dd65ade0",
|
|
||||||
"reference": "c073b2bd04d1c90e04dc1b787662b558dd65ade0",
|
|
||||||
"shasum": ""
|
|
||||||
},
|
|
||||||
"require": {
|
|
||||||
"illuminate/contracts": "^5.0|^6.0|^7.0|^8.0|^9.0",
|
|
||||||
"php": ">=5.4.0"
|
|
||||||
},
|
|
||||||
"require-dev": {
|
|
||||||
"illuminate/http": "^5.0|^6.0|^7.0|^8.0|^9.0",
|
|
||||||
"mockery/mockery": "^1.0",
|
|
||||||
"phpunit/phpunit": "^6.0"
|
|
||||||
},
|
|
||||||
"type": "library",
|
|
||||||
"extra": {
|
|
||||||
"laravel": {
|
|
||||||
"providers": [
|
|
||||||
"Fideloper\\Proxy\\TrustedProxyServiceProvider"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"autoload": {
|
|
||||||
"psr-4": {
|
|
||||||
"Fideloper\\Proxy\\": "src/"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
|
||||||
"license": [
|
|
||||||
"MIT"
|
|
||||||
],
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "Chris Fidao",
|
|
||||||
"email": "fideloper@gmail.com"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "Set trusted proxies for Laravel",
|
|
||||||
"keywords": [
|
|
||||||
"load balancing",
|
|
||||||
"proxy",
|
|
||||||
"trusted proxy"
|
|
||||||
],
|
|
||||||
"support": {
|
|
||||||
"issues": "https://github.com/fideloper/TrustedProxy/issues",
|
|
||||||
"source": "https://github.com/fideloper/TrustedProxy/tree/4.4.1"
|
|
||||||
},
|
|
||||||
"time": "2020-10-22T13:48:01+00:00"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "graham-campbell/result-type",
|
"name": "graham-campbell/result-type",
|
||||||
"version": "v1.0.4",
|
"version": "v1.0.4",
|
||||||
|
|
Loading…
Reference in a new issue