Update deprecated JSON response creation and unnecessary middleware
This commit is contained in:
		
							parent
							
								
									f5ad9b9e11
								
							
						
					
					
						commit
						530558b0f8
					
				@ -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;
 | 
			
		||||
}
 | 
			
		||||
@ -19,7 +19,6 @@
 | 
			
		||||
        "ext-zip": "*",
 | 
			
		||||
        "aws/aws-sdk-php": "^3.171",
 | 
			
		||||
        "doctrine/dbal": "~2.13.9",
 | 
			
		||||
        "fideloper/proxy": "~4.4.1",
 | 
			
		||||
        "guzzlehttp/guzzle": "~7.4.2",
 | 
			
		||||
        "hashids/hashids": "~4.1.0",
 | 
			
		||||
        "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",
 | 
			
		||||
        "This file is @generated automatically"
 | 
			
		||||
    ],
 | 
			
		||||
    "content-hash": "d51c727b5c04b52d1d56e2e64e8355b9",
 | 
			
		||||
    "content-hash": "75eb69604c51a9ac2dcdf4da1f6d24cb",
 | 
			
		||||
    "packages": [
 | 
			
		||||
        {
 | 
			
		||||
            "name": "aws/aws-crt-php",
 | 
			
		||||
@ -923,64 +923,6 @@
 | 
			
		||||
            ],
 | 
			
		||||
            "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",
 | 
			
		||||
            "version": "v1.0.4",
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user