Merge remote-tracking branch 'origin/develop' into develop

# Conflicts:
#	app/Http/Controllers/Base/LanguageController.php
#	app/Http/Kernel.php
#	app/Http/Middleware/TrimStrings.php
#	app/Providers/RouteServiceProvider.php
This commit is contained in:
Dane Everitt 2017-04-01 21:03:10 -04:00
commit 5927e0e12a
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
24 changed files with 641 additions and 591 deletions

View file

@ -19,6 +19,7 @@ This project follows [Semantic Versioning](http://semver.org) guidelines.
* `[pre.7]` — Sidebar for file manager now is a single link rather than a dropdown. * `[pre.7]` — Sidebar for file manager now is a single link rather than a dropdown.
* 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. * 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.
* Servers are no longer queued for deletion due to the general hassle and extra logic required. * Servers are no longer queued for deletion due to the general hassle and extra logic required.
* Updated all panel components to run on Laravel v5.4 rather than 5.3 which is EOL.
## v0.6.0-pre.7 (Courageous Carniadactylus) ## v0.6.0-pre.7 (Courageous Carniadactylus)
### Fixed ### Fixed

View file

@ -154,6 +154,19 @@ class UpdateEnvironment extends Command
$variables['SESSION_DRIVER'] = $this->option('session-driver'); $variables['SESSION_DRIVER'] = $this->option('session-driver');
} }
if (is_null($this->option('queue-driver'))) {
$this->line('If you chose redis as your cache driver backend, you *must* have a redis server configured already.');
$variables['QUEUE_DRIVER'] = $this->choice('Which cache driver backend would you like to use?', [
'database' => 'Database (recommended)',
'redis' => 'Redis',
'sqs' => 'Amazon SQS',
'sync' => 'Sync',
'null' => 'None',
], config('queue.driver', 'database'));
} else {
$variables['QUEUE_DRIVER'] = $this->option('queue-driver');
}
$bar = $this->output->createProgressBar(count($variables)); $bar = $this->output->createProgressBar(count($variables));
foreach ($variables as $key => $value) { foreach ($variables as $key => $value) {

View file

@ -70,6 +70,6 @@ class Handler extends ExceptionHandler
return response()->json(['error' => 'Unauthenticated.'], 401); return response()->json(['error' => 'Unauthenticated.'], 401);
} }
return redirect()->guest('/auth/login'); return redirect()->guest(route('auth.login'));
} }
} }

View file

@ -0,0 +1,71 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
namespace Pterodactyl\Http\Controllers\Base;
use Auth;
use Session;
use Illuminate\Http\Request;
use Pterodactyl\Models\User;
use Pterodactyl\Http\Controllers\Controller;
class LanguageController extends Controller
{
/**
* A list of supported languages on the panel.
*
* @var array
*/
protected $languages = [
'de' => 'German',
'en' => 'English',
'et' => 'Estonian',
'nb' => 'Norwegian',
'nl' => 'Dutch',
'pt' => 'Portuguese',
'ro' => 'Romanian',
'ru' => 'Russian',
];
/**
* Sets the language for a user.
*
* @param \Illuminate\Http\Request $request
* @param string $language
* @return \Illuminate\Http\RedirectResponse
*/
public function setLanguage(Request $request, $language)
{
if (array_key_exists($language, $this->languages)) {
if (Auth::check()) {
$user = User::findOrFail(Auth::user()->id);
$user->language = $language;
$user->save();
}
Session::put('applocale', $language);
}
return redirect()->back();
}
}

View file

@ -44,7 +44,7 @@ class LanguageMiddleware
if (Session::has('applocale')) { if (Session::has('applocale')) {
App::setLocale(Session::get('applocale')); App::setLocale(Session::get('applocale'));
} elseif (Auth::check() && isset(Auth::user()->language)) { } elseif (Auth::check() && isset(Auth::user()->language)) {
Session::set('applocale', Auth::user()->language); Session::put('applocale', Auth::user()->language);
App::setLocale(Auth::user()->language); App::setLocale(Auth::user()->language);
} else { } else {
App::setLocale(Settings::get('default_language', 'en')); App::setLocale(Settings::get('default_language', 'en'));

View file

@ -18,7 +18,7 @@ class RedirectIfAuthenticated
public function handle($request, Closure $next, $guard = null) public function handle($request, Closure $next, $guard = null)
{ {
if (Auth::guard($guard)->check()) { if (Auth::guard($guard)->check()) {
return redirect('/'); return redirect(route('index'));
} }
return $next($request); return $next($request);

View file

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Middleware; namespace Pterodactyl\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\TrimStrings as BaseTrimmer; use Illuminate\Foundation\Http\Middleware\TrimStrings as BaseTrimmer;

View file

@ -25,11 +25,8 @@
namespace Pterodactyl\Observers; namespace Pterodactyl\Observers;
use Cache; use Cache;
use Carbon;
use Pterodactyl\Events; use Pterodactyl\Events;
use Pterodactyl\Models\Server; use Pterodactyl\Models\Server;
use Pterodactyl\Jobs\DeleteServer;
use Pterodactyl\Jobs\SuspendServer;
use Pterodactyl\Notifications\ServerCreated; use Pterodactyl\Notifications\ServerCreated;
use Illuminate\Foundation\Bus\DispatchesJobs; use Illuminate\Foundation\Bus\DispatchesJobs;

View file

@ -2,7 +2,6 @@
namespace Pterodactyl\Providers; namespace Pterodactyl\Providers;
use Illuminate\Contracts\Auth\Access\Gate as GateContract;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider; use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
class AuthServiceProvider extends ServiceProvider class AuthServiceProvider extends ServiceProvider
@ -22,8 +21,8 @@ class AuthServiceProvider extends ServiceProvider
* @param \Illuminate\Contracts\Auth\Access\Gate $gate * @param \Illuminate\Contracts\Auth\Access\Gate $gate
* @return void * @return void
*/ */
public function boot(GateContract $gate) public function boot()
{ {
parent::registerPolicies($gate); $this->registerPolicies();
} }
} }

View file

@ -33,21 +33,6 @@ class RouteServiceProvider extends ServiceProvider
*/ */
public function map() public function map()
{ {
$this->mapper();
Route::group(['namespace' => $this->namespace], function ($router) {
foreach (glob(app_path('Http//Routes') . '/*.php') as $file) {
$this->app->make('Pterodactyl\\Http\\Routes\\' . basename($file, '.php'))->map($router);
}
});
}
/**
* Configure all routes used by the application.
*
* @return void
*/
protected function mapper() {
Route::middleware(['web', 'auth', 'csrf']) Route::middleware(['web', 'auth', 'csrf'])
->namespace($this->namespace . '\Base') ->namespace($this->namespace . '\Base')
->group(base_path('routes/base.php')); ->group(base_path('routes/base.php'));

View file

@ -25,7 +25,6 @@
namespace Pterodactyl\Repositories; namespace Pterodactyl\Repositories;
use DB; use DB;
use Log;
use Crypt; use Crypt;
use Validator; use Validator;
use Pterodactyl\Models; use Pterodactyl\Models;

View file

@ -11,34 +11,32 @@
} }
], ],
"require": { "require": {
"php": ">=5.6.4", "php": ">=7.0.0",
"laravel/framework": "5.3.31", "laravel/framework": "5.4.16",
"barryvdh/laravel-debugbar": "2.2.3", "laravel/tinker": "1.0.0",
"doctrine/dbal": "2.5.5", "barryvdh/laravel-debugbar": "2.3.2",
"guzzlehttp/guzzle": "6.2.2", "doctrine/dbal": "2.5.12",
"guzzlehttp/guzzle": "6.2.3",
"pragmarx/google2fa": "1.0.1", "pragmarx/google2fa": "1.0.1",
"webpatser/laravel-uuid": "2.0.1", "webpatser/laravel-uuid": "2.0.1",
"prologue/alerts": "0.4.0", "prologue/alerts": "0.4.1",
"s1lentium/iptools": "1.1.0", "s1lentium/iptools": "1.1.0",
"edvinaskrucas/settings": "2.0.0", "edvinaskrucas/settings": "2.0.0",
"igaster/laravel-theme": "1.1.3", "igaster/laravel-theme": "1.14.0",
"nesbot/carbon": "1.21.0", "nesbot/carbon": "1.22.1",
"mtdowling/cron-expression": "1.1.0", "mtdowling/cron-expression": "1.2.0",
"dingo/api": "1.0.0-beta6", "dingo/api": "1.0.0-beta8",
"aws/aws-sdk-php": "3.19.20", "aws/aws-sdk-php": "3.25.1",
"predis/predis": "1.1.1", "predis/predis": "1.1.1",
"fideloper/proxy": "3.2.0", "fideloper/proxy": "3.3.0",
"laracasts/utilities": "2.1.0", "laracasts/utilities": "2.1.0",
"lord/laroute": "2.3.0", "lord/laroute": "2.4.4",
"nicolaslopezj/searchable": "1.9.5" "nicolaslopezj/searchable": "1.9.5"
}, },
"require-dev": { "require-dev": {
"fzaninotto/faker": "~1.4", "fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*", "mockery/mockery": "0.9.*",
"phpunit/phpunit": "~5.0", "phpunit/phpunit": "~5.7",
"symfony/css-selector": "3.1.*",
"symfony/dom-crawler": "3.1.*",
"laravel/homestead": "3.0.*",
"barryvdh/laravel-ide-helper": "^2.3" "barryvdh/laravel-ide-helper": "^2.3"
}, },
"autoload": { "autoload": {
@ -50,9 +48,9 @@
} }
}, },
"autoload-dev": { "autoload-dev": {
"classmap": [ "psr-4": {
"tests/TestCase.php" "Tests\\": "tests/"
] }
}, },
"scripts": { "scripts": {
"post-root-package-install": [ "post-root-package-install": [
@ -70,14 +68,11 @@
"Illuminate\\Foundation\\ComposerScripts::postUpdate", "Illuminate\\Foundation\\ComposerScripts::postUpdate",
"php artisan optimize", "php artisan optimize",
"php artisan config:cache" "php artisan config:cache"
],
"setup": [
"composer install --ansi --no-dev",
"php -r \"file_exists('.env') || copy('.env.example', '.env');\"",
"php artisan key:generate"
] ]
}, },
"config": { "config": {
"preferred-install": "dist" "preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
} }
} }

889
composer.lock generated

File diff suppressed because it is too large Load diff

View file

@ -6,6 +6,17 @@ return [
'version' => env('APP_VERSION', 'canary'), 'version' => env('APP_VERSION', 'canary'),
/*
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
|
| This value is the name of your application. This value is used when the
| framework needs to place the application's name in a notification or
| any other location as required by the application or its packages.
*/
'name' => 'Pterodactyl',
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Application Debug Mode | Application Debug Mode
@ -99,7 +110,9 @@ return [
| |
*/ */
'log' => 'daily', 'log' => env('APP_LOG', 'daily'),
'log_level' => env('APP_LOG_LEVEL', 'debug'),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -141,6 +154,11 @@ return [
Illuminate\View\ViewServiceProvider::class, Illuminate\View\ViewServiceProvider::class,
Illuminate\Notifications\NotificationServiceProvider::class, Illuminate\Notifications\NotificationServiceProvider::class,
/*
* Package Service Providers...
*/
Laravel\Tinker\TinkerServiceProvider::class,
/* /*
* Application Service Providers... * Application Service Providers...
*/ */

View file

@ -69,11 +69,6 @@ return [
'driver' => 'eloquent', 'driver' => 'eloquent',
'model' => Pterodactyl\Models\User::class, 'model' => Pterodactyl\Models\User::class,
], ],
// 'users' => [
// 'driver' => 'database',
// 'table' => 'users',
// ],
], ],
/* /*

View file

@ -11,9 +11,10 @@ return [
| framework when an event needs to be broadcast. You may set this to | framework when an event needs to be broadcast. You may set this to
| any of the connections defined in the "connections" array below. | any of the connections defined in the "connections" array below.
| |
| Supported: "pusher", "redis", "log", "null"
|
*/ */
'default' => env('BROADCAST_DRIVER', 'null'),
'default' => env('BROADCAST_DRIVER', 'pusher'),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -44,6 +45,10 @@ return [
'driver' => 'log', 'driver' => 'log',
], ],
'null' => [
'driver' => 'null',
],
], ],
]; ];

View file

@ -38,21 +38,28 @@ return [
'database' => [ 'database' => [
'driver' => 'database', 'driver' => 'database',
'table' => 'cache', 'table' => 'cache',
'connection' => null, 'connection' => null,
], ],
'file' => [ 'file' => [
'driver' => 'file', 'driver' => 'file',
'path' => storage_path('framework/cache'), 'path' => storage_path('framework/cache/data'),
], ],
'memcached' => [ 'memcached' => [
'driver' => 'memcached', 'driver' => 'memcached',
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
'sasl' => [
env('MEMCACHED_USERNAME'),
env('MEMCACHED_PASSWORD'),
],
'options' => [
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
],
'servers' => [ 'servers' => [
[ [
'host' => env('MEMCACHE_DRIVER_HOST', '127.0.0.1'), 'host' => env('MEMCACHED_HOST', '127.0.0.1'),
'port' => env('MEMCACHE_DRIVER_PORT', 11211), 'port' => env('MEMCACHED_PORT', 11211),
'weight' => 100, 'weight' => 100,
], ],
], ],

View file

@ -2,19 +2,6 @@
return [ return [
/*
|--------------------------------------------------------------------------
| PDO Fetch Style
|--------------------------------------------------------------------------
|
| By default, database results will be returned as instances of the PHP
| stdClass object; however, you may desire to retrieve records in an
| array format for simplicity. Here you can tweak the fetch style.
|
*/
'fetch' => PDO::FETCH_CLASS,
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Default Database Connection Name | Default Database Connection Name

View file

@ -39,45 +39,29 @@ return [
| may even configure multiple disks of the same driver. Defaults have | may even configure multiple disks of the same driver. Defaults have
| been setup for each driver as an example of the required options. | been setup for each driver as an example of the required options.
| |
| Supported Drivers: "local", "ftp", "s3", "rackspace"
|
*/ */
'disks' => [ 'disks' => [
'local' => [ 'local' => [
'driver' => 'local', 'driver' => 'local',
'root' => storage_path('app'), 'root' => storage_path('app'),
], ],
'ftp' => [ 'public' => [
'driver' => 'ftp', 'driver' => 'local',
'host' => 'ftp.example.com', 'root' => storage_path('app/public'),
'username' => 'your-username', 'url' => env('APP_URL') . '/storage',
'password' => 'your-password', 'visibility' => 'public',
// Optional FTP Settings...
// 'port' => 21,
// 'root' => '',
// 'passive' => true,
// 'ssl' => true,
// 'timeout' => 30,
], ],
's3' => [ 's3' => [
'driver' => 's3', 'driver' => 's3',
'key' => 'your-key', 'key' => env('AWS_KEY'),
'secret' => 'your-secret', 'secret' => env('AWS_SECRET'),
'region' => 'your-region', 'region' => env('AWS_REGION'),
'bucket' => 'your-bucket', 'bucket' => env('AWS_BUCKET'),
],
'rackspace' => [
'driver' => 'rackspace',
'username' => 'your-username',
'key' => 'your-key',
'container' => 'your-container',
'endpoint' => 'https://identity.api.rackspacecloud.com/v2.0/',
'region' => 'IAD',
'url_type' => 'publicURL',
], ],
], ],

View file

@ -11,7 +11,8 @@ return [
| sending of e-mail. You may specify which one you're using throughout | sending of e-mail. You may specify which one you're using throughout
| your application here. By default, Laravel is setup for SMTP mail. | your application here. By default, Laravel is setup for SMTP mail.
| |
| Supported: "smtp", "mail", "sendmail", "mailgun", "mandrill", "ses", "log" | Supported: "smtp", "sendmail", "mailgun", "mandrill", "ses",
| "sparkpost", "log", "array"
| |
*/ */
@ -124,4 +125,22 @@ return [
'pretend' => false, 'pretend' => false,
/*
|--------------------------------------------------------------------------
| Markdown Mail Settings
|--------------------------------------------------------------------------
|
| If you are using Markdown based email rendering, you may configure your
| theme and component paths here, allowing you to customize the design
| of the emails. Or, you may simply stick with the Laravel defaults!
|
*/
'markdown' => [
'theme' => 'default',
'paths' => [
resource_path('views/vendor/mail'),
],
],
]; ];

View file

@ -7,12 +7,11 @@ return [
| Default Queue Driver | Default Queue Driver
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| The Laravel queue API supports a variety of back-ends via an unified | Laravel's queue API supports an assortment of back-ends via a single
| API, giving you convenient access to each back-end using the same | API, giving you convenient access to each back-end using the same
| syntax for each one. Here you may set the default queue driver. | syntax for each one. Here you may set the default queue driver.
| |
| Supported: "null", "sync", "database", "beanstalkd", | Supported: "sync", "database", "beanstalkd", "sqs", "redis", "null"
| "sqs", "iron", "redis"
| |
*/ */
@ -39,7 +38,7 @@ return [
'driver' => 'database', 'driver' => 'database',
'table' => 'jobs', 'table' => 'jobs',
'queue' => env('QUEUE_STANDARD', 'standard'), 'queue' => env('QUEUE_STANDARD', 'standard'),
'retry_after' => 60, 'retry_after' => 90,
], ],
'sqs' => [ 'sqs' => [
@ -55,7 +54,7 @@ return [
'driver' => 'redis', 'driver' => 'redis',
'connection' => 'default', 'connection' => 'default',
'queue' => env('QUEUE_STANDARD', 'standard'), 'queue' => env('QUEUE_STANDARD', 'standard'),
'retry_after' => 60, 'retry_after' => 90,
], ],
], ],
@ -72,7 +71,8 @@ return [
*/ */
'failed' => [ 'failed' => [
'database' => 'mysql', 'table' => 'failed_jobs', 'database' => 'mysql',
'table' => 'failed_jobs',
], ],
]; ];

View file

@ -29,10 +29,8 @@ return [
'region' => 'us-east-1', 'region' => 'us-east-1',
], ],
'stripe' => [ 'sparkpost' => [
'model' => Pterodactyl\Models\User::class, 'secret' => env('SPARKPOST_SECRET'),
'key' => env('STRIPE_KEY'),
'secret' => env('STRIPE_SECRET'),
], ],
]; ];

View file

@ -16,7 +16,7 @@ return [
| |
*/ */
'driver' => env('SESSION_DRIVER', 'file'), 'driver' => env('SESSION_DRIVER', 'database'),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -85,6 +85,19 @@ return [
'table' => 'sessions', 'table' => 'sessions',
/*
|--------------------------------------------------------------------------
| Session Cache Store
|--------------------------------------------------------------------------
|
| When using the "apc" or "memcached" session drivers, you may specify a
| cache store that should be used for these sessions. This value must
| correspond with one of the application's configured cache stores.
|
*/
'store' => null,
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Session Sweeping Lottery | Session Sweeping Lottery
@ -135,7 +148,7 @@ return [
| |
*/ */
'domain' => null, 'domain' => env('SESSION_DOMAIN', null),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -148,6 +161,19 @@ return [
| |
*/ */
'secure' => false, 'secure' => env('SESSION_SECURE_COOKIE', false),
/*
|--------------------------------------------------------------------------
| HTTP Access Only
|--------------------------------------------------------------------------
|
| Setting this value to true will prevent JavaScript from accessing the
| value of the cookie and the cookie will only be accessible through
| the HTTP protocol. You are free to modify this option if needed.
|
*/
'http_only' => true,
]; ];

View file

@ -14,7 +14,7 @@ return [
*/ */
'paths' => [ 'paths' => [
realpath(base_path('resources/views')), resource_path('views'),
], ],
/* /*