Laravel 5.5

This commit is contained in:
Adam Lavin 2017-11-28 07:00:11 +00:00
parent 0cc03b509b
commit 30f3ba952a
21 changed files with 693 additions and 322 deletions

2
.gitignore vendored
View file

@ -10,3 +10,5 @@ Homestead.yaml
_ide_helper.php _ide_helper.php
.idea .idea
resources/views/emails/html resources/views/emails/html
+npm-debug.log
+yarn-error.log

View file

@ -31,23 +31,7 @@ class Kernel extends ConsoleKernel
* @var array * @var array
*/ */
protected $commands = [ protected $commands = [
\Poniverse\Ponyfm\Console\Commands\MigrateOldData::class, //
\Poniverse\Ponyfm\Console\Commands\RefreshCache::class,
\Poniverse\Ponyfm\Console\Commands\ClassifyMLPMA::class,
\Poniverse\Ponyfm\Console\Commands\RebuildTags::class,
\Poniverse\Ponyfm\Console\Commands\RebuildArtists::class,
\Poniverse\Ponyfm\Console\Commands\BootstrapLocalEnvironment::class,
\Poniverse\Ponyfm\Console\Commands\PoniverseApiSetup::class,
\Poniverse\Ponyfm\Console\Commands\ClearTrackCache::class,
\Poniverse\Ponyfm\Console\Commands\RebuildTrackCache::class,
\Poniverse\Ponyfm\Console\Commands\RebuildTrack::class,
\Poniverse\Ponyfm\Console\Commands\RebuildFilesizes::class,
\Poniverse\Ponyfm\Console\Commands\RebuildSearchIndex::class,
\Poniverse\Ponyfm\Console\Commands\MergeAccounts::class,
\Poniverse\Ponyfm\Console\Commands\SyncPoniverseAccounts::class,
\Poniverse\Ponyfm\Console\Commands\FixMLPMAImages::class,
\Poniverse\Ponyfm\Console\Commands\VersionFiles::class,
\Poniverse\Ponyfm\Console\Commands\ImportEQBeats::class,
]; ];
/** /**
@ -58,7 +42,10 @@ class Kernel extends ConsoleKernel
*/ */
protected function schedule(Schedule $schedule) protected function schedule(Schedule $schedule)
{ {
// $schedule->command('inspire')
// ->hourly();
} }
/** /**
* Register the Closure based commands for the application. * Register the Closure based commands for the application.
* *
@ -66,6 +53,8 @@ class Kernel extends ConsoleKernel
*/ */
protected function commands() protected function commands()
{ {
$this->load(__DIR__.'/Commands');
require base_path('routes/console.php'); require base_path('routes/console.php');
} }
} }

View file

@ -22,7 +22,7 @@ namespace Poniverse\Ponyfm\Exceptions;
use Exception; use Exception;
use Illuminate\Auth\AuthenticationException; use Illuminate\Auth\AuthenticationException;
use GrahamCampbell\Exceptions\NewExceptionHandler as ExceptionHandler; use GrahamCampbell\Exceptions\ExceptionHandler;
class Handler extends ExceptionHandler class Handler extends ExceptionHandler
{ {
@ -32,12 +32,20 @@ class Handler extends ExceptionHandler
* @var array * @var array
*/ */
protected $dontReport = [ protected $dontReport = [
\Illuminate\Auth\AuthenticationException::class, //
\Illuminate\Auth\Access\AuthorizationException::class,
\Illuminate\Validation\ValidationException::class,
\Symfony\Component\HttpKernel\Exception\HttpException::class,
]; ];
/**
* A list of the inputs that are never flashed for validation exceptions.
*
* @var array
*/
protected $dontFlash = [
'password',
'password_confirmation',
];
/** /**
* Report or log an exception. * Report or log an exception.
* *
@ -62,19 +70,4 @@ class Handler extends ExceptionHandler
{ {
return parent::render($request, $e); return parent::render($request, $e);
} }
/**
* Convert an authentication exception into an unauthenticated response.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Auth\AuthenticationException $e
* @return \Illuminate\Http\Response
*/
protected function unauthenticated($request, AuthenticationException $e)
{
if ($request->expectsJson()) {
return response()->json(['error' => 'Unauthenticated.'], 401);
} else {
return redirect()->guest(route('login'));
}
}
} }

View file

@ -80,7 +80,7 @@ class TracksController extends Controller
public function getOembed(Request $request) public function getOembed(Request $request)
{ {
if (!$request->has('url')) { if (!$request->filled('url')) {
App::abort(404); App::abort(404);
} }

View file

@ -57,6 +57,7 @@ class Kernel extends HttpKernel
'can' => \Poniverse\Ponyfm\Http\Middleware\Authorize::class, 'can' => \Poniverse\Ponyfm\Http\Middleware\Authorize::class,
'json-exceptions' => \Poniverse\Ponyfm\Http\Middleware\JsonExceptions::class, 'json-exceptions' => \Poniverse\Ponyfm\Http\Middleware\JsonExceptions::class,
'guest' => \Poniverse\Ponyfm\Http\Middleware\RedirectIfAuthenticated::class, 'guest' => \Poniverse\Ponyfm\Http\Middleware\RedirectIfAuthenticated::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'cors' => \Barryvdh\Cors\HandleCors::class,
]; ];
} }

View file

@ -20,9 +20,9 @@
namespace Poniverse\Ponyfm\Http\Middleware; namespace Poniverse\Ponyfm\Http\Middleware;
use Illuminate\Cookie\Middleware\EncryptCookies as BaseEncrypter; use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
class EncryptCookies extends BaseEncrypter class EncryptCookies extends Middleware
{ {
/** /**
* The names of the cookies that should not be encrypted. * The names of the cookies that should not be encrypted.

View file

@ -20,9 +20,9 @@
namespace Poniverse\Ponyfm\Http\Middleware; namespace Poniverse\Ponyfm\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as BaseVerifier; use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
class VerifyCsrfToken extends BaseVerifier class VerifyCsrfToken extends Middleware
{ {
/** /**
* The URIs that should be excluded from CSRF verification. * The URIs that should be excluded from CSRF verification.

View file

@ -1,6 +1,8 @@
#!/usr/bin/env php #!/usr/bin/env php
<?php <?php
define('LARAVEL_START', microtime(true));
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Register The Auto Loader | Register The Auto Loader
@ -13,7 +15,7 @@
| |
*/ */
require __DIR__.'/bootstrap/autoload.php'; require __DIR__.'/vendor/autoload.php';
$app = require_once __DIR__.'/bootstrap/app.php'; $app = require_once __DIR__.'/bootstrap/app.php';

View file

@ -1,17 +0,0 @@
<?php
define('LARAVEL_START', microtime(true));
/*
|--------------------------------------------------------------------------
| Register The Composer Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader
| for our application. We just need to utilize it! We'll require it
| into the script here so that we do not have to worry about the
| loading of any our classes "manually". Feels great to relax.
|
*/
require __DIR__.'/../vendor/autoload.php';

View file

@ -11,7 +11,7 @@
"type": "project", "type": "project",
"require": { "require": {
"php": ">=7.0.1", "php": ">=7.0.1",
"laravel/framework": "5.4.*", "laravel/framework": "5.5.*",
"codescale/ffmpeg-php": "2.7.0", "codescale/ffmpeg-php": "2.7.0",
"intouch/laravel-newrelic": "*", "intouch/laravel-newrelic": "*",
"barryvdh/laravel-ide-helper": "^2.1", "barryvdh/laravel-ide-helper": "^2.1",
@ -23,22 +23,22 @@
"barryvdh/laravel-debugbar": "~2.4", "barryvdh/laravel-debugbar": "~2.4",
"predis/predis": "^1.0", "predis/predis": "^1.0",
"ksubileau/color-thief-php": "^1.3", "ksubileau/color-thief-php": "^1.3",
"graham-campbell/exceptions": "^9.1", "graham-campbell/exceptions": "^10.0",
"minishlink/web-push": "^1.0", "minishlink/web-push": "^1.0",
"alsofronie/eloquent-uuid": "^1.0", "alsofronie/eloquent-uuid": "^1.0",
"poniverse/api": "dev-rewrite", "poniverse/api": "dev-patch-1",
"barryvdh/laravel-cors": "^0.8.2", "barryvdh/laravel-cors": "^0.10",
"laravel/tinker": "^1.0" "laravel/tinker": "^1.0"
}, },
"require-dev": { "require-dev": {
"fzaninotto/faker": "~1.4", "fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*", "mockery/mockery": "~1.0",
"phpunit/phpunit": "~5.0", "phpunit/phpunit": "~6.0",
"phpspec/phpspec": "~2.1", "phpspec/phpspec": "~2.1",
"filp/whoops": "^2.1", "filp/whoops": "^2.1",
"symfony/dom-crawler": "~3.1", "symfony/dom-crawler": "~3.1",
"symfony/css-selector": "~3.1", "symfony/css-selector": "~3.1",
"laravel/browser-kit-testing": "1.*", "laravel/browser-kit-testing": "2.*",
"nategood/httpful": "^0.2.20" "nategood/httpful": "^0.2.20"
}, },
"autoload": { "autoload": {
@ -58,23 +58,33 @@
} }
}, },
"scripts": { "scripts": {
"post-install-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postInstall",
"php artisan optimize"
],
"post-update-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postUpdate",
"php artisan ide-helper:generate",
"php artisan optimize"
],
"post-root-package-install": [ "post-root-package-install": [
"php -r \"copy('.env.example', '.env');\"" "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
], ],
"post-create-project-cmd": [ "post-create-project-cmd": [
"php artisan key:generate" "@php artisan key:generate"
],
"post-update-cmd": [
"php artisan ide-helper:generate"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover"
] ]
}, },
"config": { "config": {
"preferred-install": "dist" "preferred-install": "dist"
},
"extra": {
"laravel": {
"dont-discover": [
]
} }
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/Lavoaster/poniverse-php"
}
]
} }

800
composer.lock generated

File diff suppressed because it is too large Load diff

View file

@ -165,13 +165,9 @@ return [
Poniverse\Ponyfm\Providers\AuthServiceProvider::class, Poniverse\Ponyfm\Providers\AuthServiceProvider::class,
Poniverse\Ponyfm\Providers\NotificationServiceProvider::class, Poniverse\Ponyfm\Providers\NotificationServiceProvider::class,
Laravel\Tinker\TinkerServiceProvider::class,
Intouch\LaravelNewrelic\NewrelicServiceProvider::class, Intouch\LaravelNewrelic\NewrelicServiceProvider::class,
Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class,
Cviebrock\LaravelElasticsearch\ServiceProvider::class, Cviebrock\LaravelElasticsearch\ServiceProvider::class,
GrahamCampbell\Exceptions\ExceptionsServiceProvider::class,
Poniverse\Lib\PoniverseServiceProvider::class, Poniverse\Lib\PoniverseServiceProvider::class,
Barryvdh\Cors\ServiceProvider::class,
], ],
/* /*

View file

@ -86,6 +86,9 @@ return [
| |
*/ */
'prefix' => 'ponyfm_', 'prefix' => env(
'CACHE_PREFIX',
'ponyfm_'
),
]; ];

View file

@ -13,7 +13,7 @@ return [
| |
*/ */
'default' => 'local', 'default' => env('FILESYSTEM_DRIVER', 'local'),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -26,7 +26,7 @@ return [
| |
*/ */
'cloud' => 's3', 'cloud' => env('FILESYSTEM_CLOUD', 's3'),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -62,9 +62,9 @@ return [
's3' => [ 's3' => [
'driver' => 's3', 'driver' => 's3',
'key' => env('AWS_KEY'), 'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET'), 'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_REGION'), 'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'), 'bucket' => env('AWS_BUCKET'),
], ],

View file

@ -29,7 +29,7 @@ return [
| |
*/ */
'lifetime' => 120, 'lifetime' => env('SESSION_LIFETIME', 120),
'expire_on_close' => false, 'expire_on_close' => false,
@ -109,7 +109,10 @@ return [
| |
*/ */
'cookie' => 'IfYouAreReadingThisWeWantToWorkWithYou_PleaseDropAnEmailTo_HelloAtPoniverseDotNet', 'cookie' => env(
'SESSION_COOKIE',
'IfYouAreReadingThisWeWantToWorkWithYou_PleaseDropAnEmailTo_HelloAtPoniverseDotNet'
),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -163,4 +166,19 @@ return [
'http_only' => true, 'http_only' => true,
/*
|--------------------------------------------------------------------------
| Same-Site Cookies
|--------------------------------------------------------------------------
|
| This option determines how your cookies behave when cross-site requests
| take place, and can be used to mitigate CSRF attacks. By default, we
| do not enable this as other CSRF protection services are in place.
|
| Supported: "lax", "strict"
|
*/
'same_site' => null,
]; ];

View file

@ -23,9 +23,9 @@
| Model Factories | Model Factories
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Here you may define all of your model factories. Model factories give | This directory should contain each of the model factory definitions for
| you a convenient way to create models for testing and seeding your | your application. Factories provide a convenient way to generate new
| database. Just tell the factory how a default model should look. | model instances for testing / seeding your application's database.
| |
*/ */

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false" <phpunit backupGlobals="false"
backupStaticAttributes="false" backupStaticAttributes="false"
bootstrap="bootstrap/autoload.php" bootstrap="vendor/autoload.php"
colors="true" colors="true"
convertErrorsToExceptions="true" convertErrorsToExceptions="true"
convertNoticesToExceptions="true" convertNoticesToExceptions="true"

View file

@ -7,6 +7,8 @@
* @author Taylor Otwell <taylor@laravel.com> * @author Taylor Otwell <taylor@laravel.com>
*/ */
define('LARAVEL_START', microtime(true));
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Register The Auto Loader | Register The Auto Loader
@ -19,7 +21,7 @@
| |
*/ */
require __DIR__.'/../bootstrap/autoload.php'; require __DIR__.'/../vendor/autoload.php';
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------

2
storage/debugbar/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
*
!.gitignore

View file

@ -20,9 +20,7 @@ namespace Tests;
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations; use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Poniverse\Lib\AccessToken; use Poniverse\Lib\AccessToken;
use Poniverse\Ponyfm\Models\User; use Poniverse\Ponyfm\Models\User;

View file

@ -3,6 +3,7 @@
namespace Tests; namespace Tests;
use Illuminate\Contracts\Console\Kernel; use Illuminate\Contracts\Console\Kernel;
use Storage;
use Laravel\BrowserKitTesting\TestCase as BaseTestCase; use Laravel\BrowserKitTesting\TestCase as BaseTestCase;
use Poniverse\Ponyfm\Models\User; use Poniverse\Ponyfm\Models\User;
@ -53,18 +54,17 @@ class TestCase extends BaseTestCase
$app->make(Kernel::class)->bootstrap(); $app->make(Kernel::class)->bootstrap();
$this->getTestFiles();
return $app; return $app;
} }
/** public function getTestFiles()
* @before
*/
public function initializeTestFiles()
{ {
// Ensure we have the Pony.fm test files // Ensure we have the Pony.fm test files
if (!static::$initializedFiles) { if (!static::$initializedFiles) {
\Storage::disk('local')->makeDirectory('test-files'); Storage::disk('local')->makeDirectory('test-files');
$storage = \Storage::disk('testing'); $storage = Storage::disk('testing');
// To add new test files, upload them to poniverse.net/files // To add new test files, upload them to poniverse.net/files
// and add them here with their last-modified date as a Unix // and add them here with their last-modified date as a Unix
@ -107,7 +107,7 @@ class TestCase extends BaseTestCase
public function tearDown() public function tearDown()
{ {
\Storage::disk('local')->deleteDirectory('testing-datastore'); Storage::disk('local')->deleteDirectory('testing-datastore');
parent::tearDown(); parent::tearDown();
} }
@ -125,8 +125,8 @@ class TestCase extends BaseTestCase
*/ */
public function getTestFileForUpload($filename) public function getTestFileForUpload($filename)
{ {
\Storage::disk('local')->makeDirectory('testing-datastore/tmp'); Storage::disk('local')->makeDirectory('testing-datastore/tmp');
\Storage::disk('local')->copy("test-files/${filename}", "testing-datastore/tmp/${filename}"); Storage::disk('local')->copy("test-files/${filename}", "testing-datastore/tmp/${filename}");
return new \Illuminate\Http\UploadedFile(storage_path("app/testing-datastore/tmp/${filename}"), $filename, null, null, null, true); return new \Illuminate\Http\UploadedFile(storage_path("app/testing-datastore/tmp/${filename}"), $filename, null, null, null, true);
} }