Skip to content

Commit 9c30345

Browse files
authored
Update codebase to L5.4 (pterodactyl#367)
1 parent 0a95d97 commit 9c30345

25 files changed

+589
-579
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ This project follows [Semantic Versioning](http://semver.org) guidelines.
1919
* `[pre.7]` — Sidebar for file manager now is a single link rather than a dropdown.
2020
* Attempting to reset a password for an account that does not exist no longer returns an error, rather it displays a success message. Failed resets trigger a `Pterodactyl\Events\Auth\FailedPasswordReset` event that can be caught if needed to perform other actions.
2121
* Servers are no longer queued for deletion due to the general hassle and extra logic required.
22+
* Updated all panel components to run on Laravel v5.4 rather than 5.3 which is EOL.
2223

2324
## v0.6.0-pre.7 (Courageous Carniadactylus)
2425
### Fixed

app/Console/Commands/UpdateEnvironment.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,19 @@ public function handle()
154154
$variables['SESSION_DRIVER'] = $this->option('session-driver');
155155
}
156156

157+
if (is_null($this->option('queue-driver'))) {
158+
$this->line('If you chose redis as your cache driver backend, you *must* have a redis server configured already.');
159+
$variables['QUEUE_DRIVER'] = $this->choice('Which cache driver backend would you like to use?', [
160+
'database' => 'Database (recommended)',
161+
'redis' => 'Redis',
162+
'sqs' => 'Amazon SQS',
163+
'sync' => 'Sync',
164+
'null' => 'None',
165+
], config('queue.driver', 'database'));
166+
} else {
167+
$variables['QUEUE_DRIVER'] = $this->option('queue-driver');
168+
}
169+
157170
$bar = $this->output->createProgressBar(count($variables));
158171

159172
foreach ($variables as $key => $value) {

app/Exceptions/Handler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,6 @@ protected function unauthenticated($request, AuthenticationException $exception)
7070
return response()->json(['error' => 'Unauthenticated.'], 401);
7171
}
7272

73-
return redirect()->guest('/auth/login');
73+
return redirect()->guest(route('auth.login'));
7474
}
7575
}

app/Http/Controllers/Base/LanguageController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function setLanguage(Request $request, $language)
6363
$user->language = $language;
6464
$user->save();
6565
}
66-
Session::set('applocale', $language);
66+
Session::put('applocale', $language);
6767
}
6868

6969
return redirect()->back();

app/Http/Kernel.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,9 @@ class Kernel extends HttpKernel
1313
*/
1414
protected $middleware = [
1515
\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
16-
\Pterodactyl\Http\Middleware\EncryptCookies::class,
17-
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
18-
\Illuminate\Session\Middleware\StartSession::class,
19-
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
20-
21-
\Pterodactyl\Http\Middleware\LanguageMiddleware::class,
16+
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
17+
\Pterodactyl\Http\Middleware\TrimStrings::class,
18+
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
2219
\Fideloper\Proxy\TrustProxies::class,
2320
];
2421

@@ -35,6 +32,7 @@ class Kernel extends HttpKernel
3532
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
3633
\Pterodactyl\Http\Middleware\VerifyCsrfToken::class,
3734
\Illuminate\Routing\Middleware\SubstituteBindings::class,
35+
\Pterodactyl\Http\Middleware\LanguageMiddleware::class,
3836
],
3937
'api' => [
4038
'throttle:60,1',

app/Http/Middleware/LanguageMiddleware.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function handle($request, Closure $next)
4444
if (Session::has('applocale')) {
4545
App::setLocale(Session::get('applocale'));
4646
} elseif (Auth::check() && isset(Auth::user()->language)) {
47-
Session::set('applocale', Auth::user()->language);
47+
Session::put('applocale', Auth::user()->language);
4848
App::setLocale(Auth::user()->language);
4949
} else {
5050
App::setLocale(Settings::get('default_language', 'en'));

app/Http/Middleware/RedirectIfAuthenticated.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class RedirectIfAuthenticated
1818
public function handle($request, Closure $next, $guard = null)
1919
{
2020
if (Auth::guard($guard)->check()) {
21-
return redirect('/');
21+
return redirect(route('index'));
2222
}
2323

2424
return $next($request);
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace Pterodactyl\Http\Middleware;
4+
5+
use Illuminate\Foundation\Http\Middleware\TrimStrings as BaseTrimmer;
6+
7+
class TrimStrings extends BaseTrimmer
8+
{
9+
/**
10+
* The names of the attributes that should not be trimmed.
11+
*
12+
* @var array
13+
*/
14+
protected $except = [
15+
'password',
16+
'password_confirmation',
17+
];
18+
}

app/Observers/ServerObserver.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,8 @@
2525
namespace Pterodactyl\Observers;
2626

2727
use Cache;
28-
use Carbon;
2928
use Pterodactyl\Events;
3029
use Pterodactyl\Models\Server;
31-
use Pterodactyl\Jobs\DeleteServer;
32-
use Pterodactyl\Jobs\SuspendServer;
3330
use Pterodactyl\Notifications\ServerCreated;
3431
use Illuminate\Foundation\Bus\DispatchesJobs;
3532

app/Providers/AuthServiceProvider.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace Pterodactyl\Providers;
44

5-
use Illuminate\Contracts\Auth\Access\Gate as GateContract;
65
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
76

87
class AuthServiceProvider extends ServiceProvider
@@ -22,8 +21,8 @@ class AuthServiceProvider extends ServiceProvider
2221
* @param \Illuminate\Contracts\Auth\Access\Gate $gate
2322
* @return void
2423
*/
25-
public function boot(GateContract $gate)
24+
public function boot()
2625
{
27-
parent::registerPolicies($gate);
26+
$this->registerPolicies();
2827
}
2928
}

0 commit comments

Comments
 (0)