Skip to content

Commit

Permalink
Merge branch 'develop' into feature/vue-serverview
Browse files Browse the repository at this point in the history
  • Loading branch information
DaneEveritt committed Sep 6, 2018
2 parents 5c4d5f7 + c305320 commit 5ca1383
Show file tree
Hide file tree
Showing 110 changed files with 7,019 additions and 1,922 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ APP_CLEAR_TASKLOG=720
APP_DELETE_MINUTES=10
APP_ENVIRONMENT_ONLY=true
LOG_CHANNEL=daily
APP_
APP_LOCALE=en

DB_HOST=127.0.0.1
DB_PORT=3306
Expand Down
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,14 @@ public/assets/*
.dockerignore
Dockerfile
docker-compose.yml
# for image related files
misc
.phpstorm.meta.php
.php_cs.cache

coverage.xml

# Vagrant
*.log
resources/lang/locales.js
resources/assets/pterodactyl/scripts/helpers/ziggy.js
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
Empty file.
Empty file.
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
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
22 changes: 4 additions & 18 deletions app/Services/Nodes/NodeUpdateService.php
Original file line number Diff line number Diff line change
@@ -1,28 +1,18 @@
<?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\Services\Nodes;

use Pterodactyl\Models\Node;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException;
use Illuminate\Database\ConnectionInterface;
use Pterodactyl\Traits\Services\ReturnsUpdatedModels;
use Pterodactyl\Contracts\Repository\NodeRepositoryInterface;
use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException;
use Pterodactyl\Exceptions\Service\Node\ConfigurationNotPersistedException;
use Pterodactyl\Contracts\Repository\Daemon\ConfigurationRepositoryInterface;

class NodeUpdateService
{
use ReturnsUpdatedModels;

/**
* @var \Illuminate\Database\ConnectionInterface
*/
Expand Down Expand Up @@ -60,7 +50,7 @@ public function __construct(
*
* @param \Pterodactyl\Models\Node $node
* @param array $data
* @return \Pterodactyl\Models\Node|mixed
* @return \Pterodactyl\Models\Node
*
* @throws \Pterodactyl\Exceptions\DisplayException
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
Expand All @@ -74,14 +64,10 @@ public function handle(Node $node, array $data)
}

$this->connection->beginTransaction();
if ($this->getUpdatedModel()) {
$response = $this->repository->update($node->id, $data);
} else {
$response = $this->repository->withoutFreshModel()->update($node->id, $data);
}
$updatedModel = $this->repository->update($node->id, $data);

try {
$this->configRepository->setNode($node)->update();
$this->configRepository->setNode($updatedModel)->update();
$this->connection->commit();
} catch (RequestException $exception) {
// Failed to connect to the Daemon. Let's go ahead and save the configuration
Expand All @@ -95,6 +81,6 @@ public function handle(Node $node, array $data)
throw new DaemonConnectionException($exception);
}

return $response;
return $updatedModel;
}
}
Loading

0 comments on commit 5ca1383

Please sign in to comment.