Merge pull request #149 from Poniverse/shift-40781

This commit is contained in:
Adam Lavin 2021-02-14 19:10:13 +00:00 committed by GitHub
commit ccbf61f7b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 1045 additions and 1440 deletions

View file

@ -23,6 +23,7 @@ namespace App\Exceptions;
use Exception; use Exception;
use GrahamCampbell\Exceptions\ExceptionHandler; use GrahamCampbell\Exceptions\ExceptionHandler;
use Illuminate\Auth\AuthenticationException; use Illuminate\Auth\AuthenticationException;
use Throwable;
class Handler extends ExceptionHandler class Handler extends ExceptionHandler
{ {
@ -53,7 +54,7 @@ class Handler extends ExceptionHandler
* @param \Exception $e * @param \Exception $e
* @return void * @return void
*/ */
public function report(Exception $e) public function report(Throwable $e)
{ {
parent::report($e); parent::report($e);
} }
@ -65,7 +66,7 @@ class Handler extends ExceptionHandler
* @param \Exception $e * @param \Exception $e
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function render($request, Exception $e) public function render($request, Throwable $e)
{ {
return parent::render($request, $e); return parent::render($request, $e);
} }

View file

@ -31,6 +31,7 @@ class Kernel extends HttpKernel
*/ */
protected $middleware = [ protected $middleware = [
\App\Http\Middleware\TrustProxies::class, \App\Http\Middleware\TrustProxies::class,
\Fruitcake\Cors\HandleCors::class,
\App\Http\Middleware\CheckForMaintenanceMode::class, \App\Http\Middleware\CheckForMaintenanceMode::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class, \App\Http\Middleware\TrimStrings::class,
@ -65,7 +66,6 @@ class Kernel extends HttpKernel
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class, 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
'cors' => \Barryvdh\Cors\HandleCors::class,
'auth.oauth' => \App\Http\Middleware\AuthenticateOAuth::class, 'auth.oauth' => \App\Http\Middleware\AuthenticateOAuth::class,
'json-exceptions' => \App\Http\Middleware\JsonExceptions::class, 'json-exceptions' => \App\Http\Middleware\JsonExceptions::class,
]; ];

View file

@ -0,0 +1,20 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Http\Middleware\TrustHosts as Middleware;
class TrustHosts extends Middleware
{
/**
* Get the host patterns that should be trusted.
*
* @return array
*/
public function hosts()
{
return [
$this->allSubdomainsOfApplicationUrl(),
];
}
}

View file

@ -10,19 +10,18 @@
"license": "AGPL", "license": "AGPL",
"type": "project", "type": "project",
"require": { "require": {
"php": "^7.2|^8.0", "php": "^7.2.5|^8.0",
"laravel/framework": "^6.20", "laravel/framework": "^7.29",
"codescale/ffmpeg-php": "2.7.0", "codescale/ffmpeg-php": "2.7.0",
"barryvdh/laravel-ide-helper": "^2.8", "guzzlehttp/guzzle": "^6.3.1|^7.0.1",
"guzzlehttp/guzzle": "~6.0", "doctrine/dbal": "^3.0",
"doctrine/dbal": "^2.12",
"venturecraft/revisionable": "^1.36", "venturecraft/revisionable": "^1.36",
"pda/pheanstalk": "^4.0", "pda/pheanstalk": "^4.0",
"cviebrock/laravel-elasticsearch": "^4.0", "cviebrock/laravel-elasticsearch": "^4.0",
"barryvdh/laravel-debugbar": "^3.5", "barryvdh/laravel-debugbar": "^3.5",
"predis/predis": "^1.1", "predis/predis": "^1.1",
"ksubileau/color-thief-php": "^1.3", "ksubileau/color-thief-php": "^1.3",
"graham-campbell/exceptions": "^12.0", "graham-campbell/exceptions": "^14.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-rewrite",
@ -35,15 +34,15 @@
"fideloper/proxy": "^4.4" "fideloper/proxy": "^4.4"
}, },
"require-dev": { "require-dev": {
"mockery/mockery": "^1.0", "mockery/mockery": "^1.3.1",
"phpunit/phpunit": "^8.5.8|^9.3.3", "phpunit/phpunit": "^8.5.8|^9.3.3",
"symfony/dom-crawler": "^4.2", "symfony/dom-crawler": "^5.2",
"symfony/css-selector": "^4.2", "symfony/css-selector": "^5.2",
"laravel/browser-kit-testing": "^5.2", "laravel/browser-kit-testing": "^6.2",
"nategood/httpful": "^0.2.20", "nategood/httpful": "^0.2.20",
"nunomaduro/collision": "^3.0", "nunomaduro/collision": "^4.3",
"fakerphp/faker": "^1.9.1", "fakerphp/faker": "^1.9.1",
"facade/ignition": "^1.16.4" "facade/ignition": "^2.0"
}, },
"autoload": { "autoload": {
"classmap": [ "classmap": [
@ -68,9 +67,6 @@
"post-create-project-cmd": [ "post-create-project-cmd": [
"@php artisan key:generate --ansi" "@php artisan key:generate --ansi"
], ],
"post-update-cmd": [
"php artisan ide-helper:generate"
],
"post-autoload-dump": [ "post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi" "@php artisan package:discover --ansi"

2186
composer.lock generated

File diff suppressed because it is too large Load diff

View file

@ -39,6 +39,7 @@ return [
'array' => [ 'array' => [
'driver' => 'array', 'driver' => 'array',
'serialize' => false,
], ],
'database' => [ 'database' => [

View file

@ -1,20 +1,34 @@
<?php <?php
return [ return [
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Laravel CORS | Cross-Origin Resource Sharing (CORS) Configuration
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| allowedOrigins, allowedHeaders and allowedMethods can be set to array('*') | Here you may configure your settings for cross-origin resource sharing
| to accept any value. | or "CORS". This determines what cross-origin operations may execute
| | in web browsers. You are free to adjust these settings as needed.
*/ |
'supportsCredentials' => true, | To learn more: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
'allowedOrigins' => ['localhost:3000', 'pony.fm', 'stage.pony.fm'], |
'allowedHeaders' => ['*'], */
'allowedMethods' => ['*'],
'exposedHeaders' => [], 'paths' => ['api/*'],
'maxAge' => 0,
'hosts' => [], 'allowed_methods' => ['*'],
'allowed_origins' => ['localhost:3000', 'pony.fm', 'stage.pony.fm'],
'allowed_origins_patterns' => [],
'allowed_headers' => ['*'],
'exposed_headers' => [],
'max_age' => 0,
'supports_credentials' => false,
]; ];

View file

@ -72,4 +72,19 @@ return [
], ],
/*
|--------------------------------------------------------------------------
| Symbolic Links
|--------------------------------------------------------------------------
|
| Here you may configure the symbolic links that will be created when the
| `storage:link` Artisan command is executed. The array keys should be
| the locations of the links and the values should be their targets.
|
*/
'links' => [
public_path('storage') => storage_path('app/public'),
],
]; ];

View file

@ -4,45 +4,73 @@ return [
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Mail Driver | Default Mailer
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Laravel supports both SMTP and PHP's "mail" function as drivers for the | This option controls the default mailer that is used to send any email
| sending of e-mail. You may specify which one you're using throughout | messages sent by your application. Alternative mailers may be setup
| your application here. By default, Laravel is setup for SMTP mail. | and used as needed; however, this mailer will be used by default.
|
*/
'default' => env('MAIL_MAILER', 'smtp'),
/*
|--------------------------------------------------------------------------
| Mailer Configurations
|--------------------------------------------------------------------------
|
| Here you may configure all of the mailers used by your application plus
| their respective settings. Several examples have been configured for
| you and you are free to add your own as your application requires.
|
| Laravel supports a variety of mail "transport" drivers to be used while
| sending an e-mail. You will specify which one you are using for your
| mailers below. You are free to add additional mailers as required.
| |
| Supported: "smtp", "sendmail", "mailgun", "ses", | Supported: "smtp", "sendmail", "mailgun", "ses",
| "postmark", "log", "array" | "postmark", "log", "array"
| |
*/ */
'driver' => env('MAIL_DRIVER', 'smtp'), 'mailers' => [
'smtp' => [
'transport' => 'smtp',
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'port' => env('MAIL_PORT', 587),
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'timeout' => null,
'auth_mode' => null,
],
/* 'ses' => [
|-------------------------------------------------------------------------- 'transport' => 'ses',
| SMTP Host Address ],
|--------------------------------------------------------------------------
|
| Here you may provide the host address of the SMTP server used by your
| applications. A default option is provided that is compatible with
| the Mailgun mail service which will provide reliable deliveries.
|
*/
'host' => env('MAIL_HOST', 'smtp.mailgun.org'), 'mailgun' => [
'transport' => 'mailgun',
],
/* 'postmark' => [
|-------------------------------------------------------------------------- 'transport' => 'postmark',
| SMTP Host Port ],
|--------------------------------------------------------------------------
|
| This is the SMTP port used by your application to deliver e-mails to
| users of the application. Like the host we have set this value to
| stay compatible with the Mailgun e-mail application by default.
|
*/
'port' => env('MAIL_PORT', 587), 'sendmail' => [
'transport' => 'sendmail',
'path' => '/usr/sbin/sendmail -bs',
],
'log' => [
'transport' => 'log',
'channel' => env('MAIL_LOG_CHANNEL'),
],
'array' => [
'transport' => 'array',
],
],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -60,47 +88,6 @@ return [
'name' => env('MAIL_FROM_NAME', 'Example'), 'name' => env('MAIL_FROM_NAME', 'Example'),
], ],
/*
|--------------------------------------------------------------------------
| E-Mail Encryption Protocol
|--------------------------------------------------------------------------
|
| Here you may specify the encryption protocol that should be used when
| the application send e-mail messages. A sensible default using the
| transport layer security protocol should provide great security.
|
*/
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
/*
|--------------------------------------------------------------------------
| SMTP Server Username
|--------------------------------------------------------------------------
|
| If your SMTP server requires a username for authentication, you should
| set it here. This will get used to authenticate with your server on
| connection. You may also set the "password" value below this one.
|
*/
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
/*
|--------------------------------------------------------------------------
| Sendmail System Path
|--------------------------------------------------------------------------
|
| When using the "sendmail" driver to send e-mails, we will need to know
| the path to where Sendmail lives on this server. A default path has
| been provided here, which will work well on most of your systems.
|
*/
'sendmail' => '/usr/sbin/sendmail -bs',
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Markdown Mail Settings | Markdown Mail Settings
@ -120,17 +107,4 @@ return [
], ],
], ],
/*
|--------------------------------------------------------------------------
| Log Channel
|--------------------------------------------------------------------------
|
| If you are using the "log" driver, you may specify the logging channel
| if you prefer to keep mail messages separate from other log entries
| for simpler reading. Otherwise, the default channel will be used.
|
*/
'log_channel' => env('MAIL_LOG_CHANNEL'),
]; ];

View file

@ -55,6 +55,7 @@ return [
'secret' => env('AWS_SECRET_ACCESS_KEY'), 'secret' => env('AWS_SECRET_ACCESS_KEY'),
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
'queue' => env('SQS_QUEUE', 'your-queue-name'), 'queue' => env('SQS_QUEUE', 'your-queue-name'),
'suffix' => env('SQS_SUFFIX'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
], ],

View file

@ -92,10 +92,12 @@ return [
| Session Cache Store | Session Cache Store
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| When using the "apc", "memcached", or "dynamodb" session drivers you may | While using one of the framework's cache driven session backends you may
| list a cache store that should be used for these sessions. This value | list a cache store that should be used for these sessions. This value
| must match with one of the application's configured cache "stores". | must match with one of the application's configured cache "stores".
| |
| Affects: "apc", "dynamodb", "memcached", "redis"
|
*/ */
'store' => env('SESSION_STORE', null), 'store' => env('SESSION_STORE', null),
@ -166,7 +168,7 @@ return [
| |
*/ */
'secure' => env('SESSION_SECURE_COOKIE', false), 'secure' => env('SESSION_SECURE_COOKIE'),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -188,12 +190,12 @@ return [
| |
| This option determines how your cookies behave when cross-site requests | This option determines how your cookies behave when cross-site requests
| take place, and can be used to mitigate CSRF attacks. By default, we | 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. | will set this value to "lax" since this is a secure default value.
| |
| Supported: "lax", "strict" | Supported: "lax", "strict", "none", null
| |
*/ */
'same_site' => null, 'same_site' => 'lax',
]; ];

View file

@ -1,14 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false" <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
backupStaticAttributes="false" xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php" bootstrap="vendor/autoload.php"
colors="true" colors="true">
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false">
<testsuites> <testsuites>
<testsuite name="Application Test Suite"> <testsuite name="Application Test Suite">
<directory>./tests/</directory> <directory>./tests/</directory>
@ -20,15 +14,16 @@
</whitelist> </whitelist>
</filter> </filter>
<php> <php>
<env name="APP_ENV" value="testing"/> <server name="APP_ENV" value="testing"/>
<env name="APP_KEY" value="CMOxJYitit2cFgI9FbbxJJpWxBBZl6RU"/> <server name="APP_KEY" value="CMOxJYitit2cFgI9FbbxJJpWxBBZl6RU"/>
<env name="BCRYPT_ROUNDS" value="4"/> <server name="BCRYPT_ROUNDS" value="4"/>
<env name="CACHE_DRIVER" value="array"/> <server name="MAIL_MAILER" value="array"/>
<env name="SESSION_DRIVER" value="array"/> <server name="QUEUE_CONNECTION" value="sync"/>
<env name="QUEUE_CONNECTION" value="sync"/> <server name="SESSION_DRIVER" value="array"/>
<env name="APP_URL" value="http://ponyfm-dev.poni"/> <server name="TELESCOPE_ENABLED" value="false"/>
<env name="DB_CONNECTION" value="sqlite"/> <server name="APP_URL" value="http://ponyfm-dev.poni"/>
<env name="DB_DATABASE" value=":memory:"/> <server name="DB_CONNECTION" value="sqlite"/>
<env name="PONYFM_DATASTORE" value="/vagrant/storage/app/testing-datastore"/> <server name="DB_DATABASE" value=":memory:"/>
<server name="PONYFM_DATASTORE" value="/vagrant/storage/app/testing-datastore"/>
</php> </php>
</phpunit> </phpunit>

View file

@ -13,7 +13,7 @@ ELASTICSEARCH_HOSTS=localhost
SESSION_HTTPS_ONLY=false SESSION_HTTPS_ONLY=false
QUEUE_CONNECTION=beanstalkd QUEUE_CONNECTION=beanstalkd
MAIL_DRIVER=smtp MAIL_MAILER=smtp
MAIL_HOST=mailtrap.io MAIL_HOST=mailtrap.io
MAIL_PORT=2525 MAIL_PORT=2525
MAIL_USERNAME=null MAIL_USERNAME=null

View file

@ -13,7 +13,7 @@ ELASTICSEARCH_HOSTS=localhost
SESSION_HTTPS_ONLY=false SESSION_HTTPS_ONLY=false
QUEUE_CONNECTION=beanstalkd QUEUE_CONNECTION=beanstalkd
MAIL_DRIVER=smtp MAIL_MAILER=smtp
MAIL_HOST=mailtrap.io MAIL_HOST=mailtrap.io
MAIL_PORT=2525 MAIL_PORT=2525
MAIL_USERNAME=null MAIL_USERNAME=null