Skip to content

Commit

Permalink
Merge remote-tracking branch 'pterodactyl/release/v0.7.10' into featu…
Browse files Browse the repository at this point in the history
…re/add-dockerfile
  • Loading branch information
parkervcp committed Sep 16, 2018
2 parents b370b2c + d5f166d commit 1ae245a
Show file tree
Hide file tree
Showing 116 changed files with 7,039 additions and 1,933 deletions.
3 changes: 2 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ APP_CLEAR_TASKLOG=720
APP_DELETE_MINUTES=10
APP_ENVIRONMENT_ONLY=true
LOG_CHANNEL=daily
APP_LOCALE=en

DB_HOST=127.0.0.1
DB_PORT=3306
Expand All @@ -27,4 +28,4 @@ [email protected]

QUEUE_HIGH=high
QUEUE_STANDARD=standard
QUEUE_LOW=low
QUEUE_LOW=low
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,7 @@ misc
.phpstorm.meta.php
.php_cs.cache

coverage.xml

# Vagrant
*.log
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@ This file is a running track of new features and fixes to each version of the pa

This project follows [Semantic Versioning](http://semver.org) guidelines.

## v0.7.10 (Derelict Dermodactylus)
### Fixed
* Scheduled tasks triggered manually no longer improperly change the `next_run_at` time and do not run twice in a row anymore.
* Changing the maximum web-based file upload size for a node now properly validates and updates.
* Changing configuration values for a node now correctly updates them on the daemon on the first request, rather than requiring a second request to set them.

### Changed
* Egg and server variable values are no longer limited to 191 characters. Turns out some games require a large number of characters in these fields.

### Added
* Users can now select their preferred language in their account settings.

## v0.7.9 (Derelict Dermodactylus)
### Fixed
* Fixes a two-factor authentication bypass present in the password reset process for an account.
Expand Down
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
[![Logo Image](https://cdn.pterodactyl.io/logos/Banner%20Logo%[email protected])](https://pterodactyl.io)

[![Build Status](https://travis-ci.org/pterodactyl/panel.svg?branch=develop)](https://travis-ci.org/pterodactyl/panel) [![StyleCI](https://styleci.io/repos/47508644/shield?branch=develop)](https://styleci.io/repos/47508644) [![codecov](https://codecov.io/gh/pterodactyl/panel/branch/develop/graph/badge.svg)](https://codecov.io/gh/Pterodactyl/Panel)
[![Build status](https://img.shields.io/travis/pterodactyl/panel/develop.svg?style=flat-square)](https://travis-ci.org/pterodactyl/panel)
[![StyleCI](https://styleci.io/repos/47508644/shield?branch=develop)](https://styleci.io/repos/47508644)
[![Codecov](https://img.shields.io/codecov/c/github/pterodactyl/panel/develop.svg?style=flat-square)](https://codecov.io/gh/Pterodactyl/Panel)
[![Discord](https://img.shields.io/discord/122900397965705216.svg?style=flat-square&label=Discord)](https://pterodactyl.io/discord)

# Pterodactyl Panel

Pterodactyl is the open-source game server management panel built with PHP7, Nodejs, and Go. Designed with security in mind, Pterodactyl runs all game servers in isolated Docker containers while exposing a beautiful and intuitive UI to administrators and users.
What more are you waiting for? Make game servers a first class citizen on your platform today.

![Image](https://cdn.pterodactyl.io/site-assets/mockup-macbook-grey.png)

## Support & Documentation
Support for using Pterodactyl can be found on our [Documentation Website](https://docs.pterodactyl.io), [Guides Website](https://guides.pterodactyl.io), or via our [Discord Chat](https://discord.gg/QRDZvVm).
Support for using Pterodactyl can be found on our [Documentation Website](https://pterodactyl.io/project/introduction.html), [Guides Website](https://guides.pterodactyl.io), or via our [Discord Chat](https://discord.gg/QRDZvVm).

### Supported Games
We support a huge variety of games by utilizing Docker containers to isolate each instance, giving you the power to host your games across the world without having to bloat each physical machine with additional dependencies.
Expand Down
26 changes: 9 additions & 17 deletions app/Console/Commands/Schedule/ProcessRunnableCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,14 @@

namespace Pterodactyl\Console\Commands\Schedule;

use Carbon\Carbon;
use Cake\Chronos\Chronos;
use Illuminate\Console\Command;
use Illuminate\Support\Collection;
use Pterodactyl\Services\Schedules\ProcessScheduleService;
use Pterodactyl\Contracts\Repository\ScheduleRepositoryInterface;

class ProcessRunnableCommand extends Command
{
/**
* @var \Carbon\Carbon
*/
protected $carbon;

/**
* @var string
*/
Expand All @@ -45,31 +40,28 @@ class ProcessRunnableCommand extends Command
/**
* ProcessRunnableCommand constructor.
*
* @param \Carbon\Carbon $carbon
* @param \Pterodactyl\Services\Schedules\ProcessScheduleService $processScheduleService
* @param \Pterodactyl\Contracts\Repository\ScheduleRepositoryInterface $repository
*/
public function __construct(
Carbon $carbon,
ProcessScheduleService $processScheduleService,
ScheduleRepositoryInterface $repository
) {
public function __construct(ProcessScheduleService $processScheduleService, ScheduleRepositoryInterface $repository)
{
parent::__construct();

$this->carbon = $carbon;
$this->processScheduleService = $processScheduleService;
$this->repository = $repository;
}

/**
* Handle command execution.
*
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function handle()
{
$schedules = $this->repository->getSchedulesToProcess($this->carbon->now()->toAtomString());
$schedules = $this->repository->getSchedulesToProcess(Chronos::now()->toAtomString());
if ($schedules->count() < 1) {
$this->line('There are no scheduled tasks for servers that need to be run.');

return;
}

$bar = $this->output->createProgressBar(count($schedules));
$schedules->each(function ($schedule) use ($bar) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Pterodactyl\Contracts\Repository\LocationRepositoryInterface;
use Pterodactyl\Transformers\Api\Application\LocationTransformer;
use Pterodactyl\Http\Controllers\Api\Application\ApplicationApiController;
use Pterodactyl\Http\Requests\Api\Application\Locations\GetLocationRequest;
use Pterodactyl\Http\Requests\Api\Application\Locations\GetLocationsRequest;
use Pterodactyl\Http\Requests\Api\Application\Locations\DeleteLocationRequest;
use Pterodactyl\Http\Requests\Api\Application\Locations\UpdateLocationRequest;
Expand Down Expand Up @@ -77,7 +78,7 @@ public function index(GetLocationsRequest $request): array
/**
* Return a single location.
*
* @param \Pterodactyl\Http\Controllers\Api\Application\Locations\GetLocationRequest $request
* @param \Pterodactyl\Http\Requests\Api\Application\Locations\GetLocationRequest $request
* @return array
*/
public function view(GetLocationRequest $request): array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public function store(StoreNodeRequest $request): JsonResponse
*/
public function update(UpdateNodeRequest $request): array
{
$node = $this->updateService->returnUpdatedModel()->handle(
$node = $this->updateService->handle(
$request->getModel(Node::class), $request->validated()
);

Expand Down
9 changes: 7 additions & 2 deletions app/Http/Controllers/Base/AccountController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@
use Illuminate\Contracts\Session\Session;
use Pterodactyl\Http\Controllers\Controller;
use Pterodactyl\Services\Users\UserUpdateService;
use Pterodactyl\Traits\Helpers\AvailableLanguages;
use Pterodactyl\Http\Requests\Base\AccountDataFormRequest;

class AccountController extends Controller
{
use AvailableLanguages;

/**
* @var \Prologue\Alerts\AlertsMessageBag
*/
Expand Down Expand Up @@ -48,7 +51,9 @@ public function __construct(AlertsMessageBag $alert, AuthManager $authManager, U
*/
public function index()
{
return view('base.account');
return view('base.account', [
'languages' => $this->getAvailableLanguages(true),
]);
}

/**
Expand All @@ -70,7 +75,7 @@ public function update(AccountDataFormRequest $request)
if ($request->input('do_action') === 'email') {
$data = ['email' => $request->input('new_email')];
} elseif ($request->input('do_action') === 'identity') {
$data = $request->only(['name_first', 'name_last', 'username']);
$data = $request->only(['name_first', 'name_last', 'username', 'language']);
} else {
$data = [];
}
Expand Down
13 changes: 11 additions & 2 deletions app/Http/Controllers/Server/Tasks/ActionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Pterodactyl\Http\Controllers\Server\Tasks;

use Carbon\Carbon;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Pterodactyl\Http\Controllers\Controller;
Expand All @@ -11,12 +10,22 @@

class ActionController extends Controller
{
/**
* @var \Pterodactyl\Services\Schedules\ProcessScheduleService
*/
private $processScheduleService;

/**
* @var \Pterodactyl\Contracts\Repository\ScheduleRepositoryInterface
*/
private $repository;

/**
* ActionController constructor.
*
* @param \Pterodactyl\Services\Schedules\ProcessScheduleService $processScheduleService
* @param \Pterodactyl\Contracts\Repository\ScheduleRepositoryInterface $repository
*/
public function __construct(ProcessScheduleService $processScheduleService, ScheduleRepositoryInterface $repository)
{
$this->processScheduleService = $processScheduleService;
Expand Down Expand Up @@ -61,7 +70,7 @@ public function trigger(Request $request): Response
$server = $request->attributes->get('server');
$this->authorize('toggle-schedule', $server);

$this->processScheduleService->setRunTimeOverride(Carbon::now())->handle(
$this->processScheduleService->handle(
$request->attributes->get('schedule')
);

Expand Down
2 changes: 1 addition & 1 deletion app/Http/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
use Illuminate\Foundation\Http\Kernel as HttpKernel;
use Pterodactyl\Http\Middleware\Api\AuthenticateKey;
use Illuminate\Routing\Middleware\SubstituteBindings;
use Pterodactyl\Http\Middleware\AccessingValidServer;
use Pterodactyl\Http\Middleware\Api\SetSessionDriver;
use Illuminate\Session\Middleware\AuthenticateSession;
use Illuminate\View\Middleware\ShareErrorsFromSession;
Expand All @@ -28,6 +27,7 @@
use Pterodactyl\Http\Middleware\Api\ApiSubstituteBindings;
use Illuminate\Foundation\Http\Middleware\ValidatePostSize;
use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
use Pterodactyl\Http\Middleware\Server\AccessingValidServer;
use Pterodactyl\Http\Middleware\Server\AuthenticateAsSubuser;
use Pterodactyl\Http\Middleware\Api\Daemon\DaemonAuthenticate;
use Pterodactyl\Http\Middleware\Server\SubuserBelongsToServer;
Expand Down
23 changes: 4 additions & 19 deletions app/Http/Middleware/LanguageMiddleware.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <[email protected]>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/

namespace Pterodactyl\Http\Middleware;

use Closure;
use Illuminate\Http\Request;
use Illuminate\Foundation\Application;
use Illuminate\Contracts\Config\Repository;

class LanguageMiddleware
{
Expand All @@ -21,33 +13,26 @@ class LanguageMiddleware
*/
private $app;

/**
* @var \Illuminate\Contracts\Config\Repository
*/
private $config;

/**
* LanguageMiddleware constructor.
*
* @param \Illuminate\Foundation\Application $app
* @param \Illuminate\Contracts\Config\Repository $config
* @param \Illuminate\Foundation\Application $app
*/
public function __construct(Application $app, Repository $config)
public function __construct(Application $app)
{
$this->app = $app;
$this->config = $config;
}

/**
* Handle an incoming request.
* Handle an incoming request and set the user's preferred language.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle(Request $request, Closure $next)
{
$this->app->setLocale($this->config->get('app.locale', 'en'));
$this->app->setLocale($request->user()->language ?? config('app.locale', 'en'));

return $next($request);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Middleware/Server/AccessingValidServer.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Pterodactyl\Http\Middleware;
namespace Pterodactyl\Http\Middleware\Server;

use Closure;
use Illuminate\Http\Request;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<?php

namespace Pterodactyl\Http\Controllers\Api\Application\Locations;
namespace Pterodactyl\Http\Requests\Api\Application\Locations;

use Pterodactyl\Models\Location;
use Pterodactyl\Http\Requests\Api\Application\Locations\GetLocationsRequest;

class GetLocationRequest extends GetLocationsRequest
{
Expand Down
4 changes: 2 additions & 2 deletions app/Jobs/Schedule/RunTaskJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Pterodactyl\Jobs\Schedule;

use Exception;
use Carbon\Carbon;
use Cake\Chronos\Chronos;
use Pterodactyl\Jobs\Job;
use InvalidArgumentException;
use Illuminate\Queue\SerializesModels;
Expand Down Expand Up @@ -158,7 +158,7 @@ private function markScheduleComplete()
$repository = app()->make(ScheduleRepositoryInterface::class);
$repository->withoutFreshModel()->update($this->schedule, [
'is_processing' => false,
'last_run_at' => Carbon::now()->toDateTimeString(),
'last_run_at' => Chronos::now()->toDateTimeString(),
]);
}

Expand Down
1 change: 1 addition & 0 deletions app/Models/Node.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ class Node extends Model implements CleansAttributes, ValidableContract
'daemonSFTP' => 'numeric|between:1024,65535',
'daemonListen' => 'numeric|between:1024,65535',
'maintenance_mode' => 'boolean',
'upload_size' => 'int|between:1,1024',
];

/**
Expand Down
1 change: 1 addition & 0 deletions app/Repositories/Eloquent/ScheduleRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public function getSchedulesToProcess(string $timestamp): Collection
{
return $this->getBuilder()->with('tasks')
->where('is_active', true)
->where('is_processing', false)
->where('next_run_at', '<=', $timestamp)
->get($this->getColumns());
}
Expand Down
Loading

0 comments on commit 1ae245a

Please sign in to comment.