Skip to content

Commit e855937

Browse files
committed
upgrade laravel to 9, upgrade tailwind to 3, fix sec issues
1 parent 03746ff commit e855937

27 files changed

+26545
-8886
lines changed

app/Exceptions/Handler.php

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
namespace App\Exceptions;
44

5-
use Exception;
65
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
6+
use Throwable;
77

88
class Handler extends ExceptionHandler
99
{
1010
/**
1111
* A list of the exception types that are not reported.
1212
*
13-
* @var array
13+
* @var array<int, class-string<Throwable>>
1414
*/
1515
protected $dontReport = [
1616
//
@@ -19,33 +19,23 @@ class Handler extends ExceptionHandler
1919
/**
2020
* A list of the inputs that are never flashed for validation exceptions.
2121
*
22-
* @var array
22+
* @var array<int, string>
2323
*/
2424
protected $dontFlash = [
25+
'current_password',
2526
'password',
2627
'password_confirmation',
2728
];
2829

2930
/**
30-
* Report or log an exception.
31+
* Register the exception handling callbacks for the application.
3132
*
32-
* @param \Exception $exception
3333
* @return void
3434
*/
35-
public function report(Exception $exception)
35+
public function register()
3636
{
37-
parent::report($exception);
38-
}
39-
40-
/**
41-
* Render an exception into an HTTP response.
42-
*
43-
* @param \Illuminate\Http\Request $request
44-
* @param \Exception $exception
45-
* @return \Illuminate\Http\Response
46-
*/
47-
public function render($request, Exception $exception)
48-
{
49-
return parent::render($request, $exception);
37+
$this->reportable(function (Throwable $e) {
38+
//
39+
});
5040
}
5141
}

app/Http/Controllers/SpotifyController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function dashboard()
6969
],
7070
]);
7171
}
72-
72+
7373
protected function readable($term)
7474
{
7575
switch($term) {
@@ -95,7 +95,7 @@ public function createPlaylist($term)
9595
});
9696
$playlist = $this->api->createPlaylist([
9797
'name' => 'My Top Tracks '.$this->readable($term),
98-
'description' => 'Stats as of '.now()->format("d/m/y").'. Made By NNS\' Spotify Stats website: https://spotify.whatan.app'
98+
'description' => 'Stats as of '.now()->format("d/m/y").'. Made By NNS\' Spotify Stats website: https://spotify.malding.dev'
9999
]);
100100
$this->api->addPlaylistTracks($playlist->id, $songs->toArray());
101101
return redirect()->back();

app/Http/Kernel.php

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,35 +11,36 @@ class Kernel extends HttpKernel
1111
*
1212
* These middleware are run during every request to your application.
1313
*
14-
* @var array
14+
* @var array<int, class-string|string>
1515
*/
1616
protected $middleware = [
17-
\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
17+
// \App\Http\Middleware\TrustHosts::class,
18+
\App\Http\Middleware\TrustProxies::class,
19+
\Illuminate\Http\Middleware\HandleCors::class,
1820
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
1921
\App\Http\Middleware\TrimStrings::class,
2022
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
21-
\App\Http\Middleware\TrustProxies::class,
2223
];
2324

2425
/**
2526
* The application's route middleware groups.
2627
*
27-
* @var array
28+
* @var array<string, array<int, class-string|string>>
2829
*/
2930
protected $middlewareGroups = [
3031
'web' => [
3132
\App\Http\Middleware\EncryptCookies::class,
3233
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
3334
\Illuminate\Session\Middleware\StartSession::class,
34-
// \Illuminate\Session\Middleware\AuthenticateSession::class,
3535
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
3636
\App\Http\Middleware\VerifyCsrfToken::class,
3737
\Illuminate\Routing\Middleware\SubstituteBindings::class,
3838
],
3939

4040
'api' => [
41-
'throttle:60,1',
42-
'bindings',
41+
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
42+
'throttle:api',
43+
\Illuminate\Routing\Middleware\SubstituteBindings::class,
4344
],
4445
];
4546

@@ -48,17 +49,19 @@ class Kernel extends HttpKernel
4849
*
4950
* These middleware may be assigned to groups or used individually.
5051
*
51-
* @var array
52+
* @var array<string, class-string|string>
5253
*/
5354
protected $routeMiddleware = [
54-
'auth' => \Illuminate\Auth\Middleware\Authenticate::class,
55+
'auth' => \App\Http\Middleware\Authenticate::class,
5556
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
56-
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
57+
'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class,
5758
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
5859
'can' => \Illuminate\Auth\Middleware\Authorize::class,
5960
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
61+
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
6062
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
6163
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
64+
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
6265
'token' => \App\Http\Middleware\TokenMiddleware::class,
6366
];
6467
}

app/Http/Middleware/TokenMiddleware.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class TokenMiddleware
1515
*/
1616
public function handle($request, Closure $next)
1717
{
18-
if(\Session::has('token')) {
18+
if(session()->has('token')) {
1919
return $next($request);
2020
}
2121
return redirect('/');

app/Http/Middleware/TrustProxies.php

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

33
namespace App\Http\Middleware;
44

5+
use Illuminate\Http\Middleware\TrustProxies as Middleware;
56
use Illuminate\Http\Request;
6-
use Fideloper\Proxy\TrustProxies as Middleware;
77

88
class TrustProxies extends Middleware
99
{
1010
/**
1111
* The trusted proxies for this application.
1212
*
13-
* @var array
13+
* @var array<int, string>|string|null
1414
*/
1515
protected $proxies;
1616

@@ -19,5 +19,10 @@ class TrustProxies extends Middleware
1919
*
2020
* @var int
2121
*/
22-
protected $headers = Request::HEADER_X_FORWARDED_ALL;
22+
protected $headers =
23+
Request::HEADER_X_FORWARDED_FOR |
24+
Request::HEADER_X_FORWARDED_HOST |
25+
Request::HEADER_X_FORWARDED_PORT |
26+
Request::HEADER_X_FORWARDED_PROTO |
27+
Request::HEADER_X_FORWARDED_AWS_ELB;
2328
}

app/Http/Middleware/VerifyCsrfToken.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class VerifyCsrfToken extends Middleware
99
/**
1010
* The URIs that should be excluded from CSRF verification.
1111
*
12-
* @var array
12+
* @var array<int, string>
1313
*/
1414
protected $except = [
1515
//

composer.json

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,18 @@
55
"license": "MIT",
66
"type": "project",
77
"require": {
8-
"php": "^7.1.3",
9-
"fideloper/proxy": "^4.0",
10-
"jwilsson/spotify-web-api-php": "^2.4",
11-
"laravel/framework": "5.6.*",
12-
"laravel/tinker": "^1.0"
8+
"php": "^8.0",
9+
"jwilsson/spotify-web-api-php": "^5.0",
10+
"laravel/framework": "^9.0",
11+
"laravel/tinker": "^2.0",
12+
"spatie/laravel-ignition": "^1.0"
1313
},
1414
"require-dev": {
15-
"adamwathan/laravel-preset": "dev-master",
1615
"filp/whoops": "^2.0",
1716
"fzaninotto/faker": "^1.4",
1817
"mockery/mockery": "^1.0",
19-
"nunomaduro/collision": "^2.0",
20-
"phpunit/phpunit": "^7.0"
18+
"nunomaduro/collision": "^6.1",
19+
"phpunit/phpunit": "^9.0"
2120
},
2221
"repositories": [{
2322
"type": "vcs",

0 commit comments

Comments
 (0)