Skip to content

Commit

Permalink
Initial Commit of Files
Browse files Browse the repository at this point in the history
PufferPanel v0.9 (Laravel) is now Pterodactyl 1.0
  • Loading branch information
DaneEveritt committed Dec 6, 2015
0 parents commit 1489f7a
Show file tree
Hide file tree
Showing 154 changed files with 10,159 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/vendor
*.DS_Store*
.env

composer.lock
621 changes: 621 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
## Pterodactyl Panel
Pterodactyl is the free game server management panel designed by users, for users. Featuring support for Vanilla Minecraft, Spigot, Source Dedicated Servers, BungeeCord, and many more. Pterodactyl is built on the `Laravel PHP Framework (v5.1) LTS`.

Pterodactyl is forked from PufferPanel and is developed by the core developer that brought you PufferPanel. The features are similar, but the code is new.

## Documentation
Support for using Pterodactyl can be found on our [community forums](https://community.pterodactyl.io) or on our [Discord chat](https://discord.gg/0gYt8oU8QOkDhKLS).

## License
```
Copyright (c) 2015 Pterodactyl Software & Design (Dane Everitt)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
```

### Additional License Information
Some Javascript and CSS used within the panel is licensed under a `MIT`, `Apache 2.0`, or `GPL` license. Please check their respective header files for more information information.

Some images used within Pterodactyl are Copyright (c) their respective owners.

`/public/images/403.jpg` is licensed under a [CC BY 2.0](http://creativecommons.org/licenses/by/2.0/) by [BigTallGuy](http://flickr.com/photos/bigtallguy/)

`/public/images/404.jpg` is licensed under a [CC BY-SA 2.0](http://creativecommons.org/licenses/by-sa/2.0/) by [nicsuzor](http://flickr.com/photos/nicsuzor/)
33 changes: 33 additions & 0 deletions app/Console/Commands/Inspire.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

namespace Pterodactyl\Console\Commands;

use Illuminate\Console\Command;
use Illuminate\Foundation\Inspiring;

class Inspire extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'inspire';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Display an inspiring quote';

/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$this->comment(PHP_EOL.Inspiring::quote().PHP_EOL);
}
}
30 changes: 30 additions & 0 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

namespace Pterodactyl\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
\Pterodactyl\Console\Commands\Inspire::class,
];

/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
$schedule->command('inspire')
->hourly();
}
}
8 changes: 8 additions & 0 deletions app/Events/Event.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace Pterodactyl\Events;

abstract class Event
{
//
}
8 changes: 8 additions & 0 deletions app/Exceptions/AccountNotFoundException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace Pterodactyl\Exceptions;

class AccountNotFoundException extends \Exception
{

}
8 changes: 8 additions & 0 deletions app/Exceptions/DisplayException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace Pterodactyl\Exceptions;

class DisplayException extends \Exception
{

}
78 changes: 78 additions & 0 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?php

namespace Pterodactyl\Exceptions;

use Exception;
use DisplayException;
use Debugbar;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;

class Handler extends ExceptionHandler
{
/**
* A list of the exception types that should not be reported.
*
* @var array
*/
protected $dontReport = [
HttpException::class,
ModelNotFoundException::class,
];

/**
* Report or log an exception.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Exception $e
* @return void
*/
public function report(Exception $e)
{
return parent::report($e);
}

/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $e
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $e)
{
if ($e instanceof ModelNotFoundException) {
$e = new NotFoundHttpException($e->getMessage(), $e);
}

if ($request->isXmlHttpRequest() || $request->ajax() || $request->is('/api/*')) {

$exception = 'An exception occured while attempting to perform this action, please try again.';

if ($e instanceof DisplayException) {
$exception = $e->getMessage();
}

// Live environment, just return a nice error.
if(!env('APP_DEBUG', false)) {
return response()->json([
'error' => $exception
], 500);
}

// If we are debugging, return the exception in it's full manner.
return response()->json([
'error' => $e->getMessage(),
'code' => $e->getCode(),
'file' => $e->getFile(),
'line' => $e->getLine()
], 500);

}

return parent::render($request, $e);
}
}
83 changes: 83 additions & 0 deletions app/Http/Controllers/API/UserController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?php

namespace Pterodactyl\Http\Controllers\API;

use Gate;
use Log;
use Debugbar;
use Pterodactyl\Models\API;
use Pterodactyl\Models\User;

use Pterodactyl\Http\Controllers\Controller;
use Illuminate\Http\Request;

class UserController extends Controller
{

/**
* Constructor
*/
public function __construct()
{
$this->middleware('api');
}

public function getAllUsers(Request $request)
{

// Policies don't work if the user isn't logged in for whatever reason in Laravel...
if(!API::checkPermission($request->header('X-Authorization'), 'get-users')) {
return API::noPermissionError();
}

return response()->json([
'users' => User::all()
]);
}

/**
* Returns JSON response about a user given their ID.
* If fields are provided only those fields are returned.
*
* Does not return protected fields (i.e. password & totp_secret)
*
* @param Request $request
* @param int $id
* @param string $fields
* @return Response
*/
public function getUser(Request $request, $id, $fields = null)
{

// Policies don't work if the user isn't logged in for whatever reason in Laravel...
if(!API::checkPermission($request->header('X-Authorization'), 'get-users')) {
return API::noPermissionError();
}

if (is_null($fields)) {
return response()->json(User::find($id));
}

$query = User::where('id', $id);
$explode = explode(',', $fields);

foreach($explode as &$exploded) {
if(!empty($exploded)) {
$query->addSelect($exploded);
}
}

try {
return response()->json($query->get());
} catch (\Exception $e) {
if ($e instanceof \Illuminate\Database\QueryException) {
return response()->json([
'error' => 'One of the fields provided in your argument list is invalid.'
], 500);
}
throw $e;
}

}

}
43 changes: 43 additions & 0 deletions app/Http/Controllers/Admin/AccountsController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

namespace Pterodactyl\Http\Controllers\Admin;

use Debugbar;
use Pterodactyl\Models\User;

use Pterodactyl\Http\Controllers\Controller;
use Illuminate\Http\Request;

class AccountsController extends Controller
{

/**
* Controller Constructor
*/
public function __construct()
{

// All routes in this controller are protected by the authentication middleware.
$this->middleware('auth');
$this->middleware('admin');

}

public function getIndex(Request $request)
{
return view('admin.accounts.index', [
'users' => User::paginate(20)
]);
}

public function getNew(Request $request)
{
//
}

public function getView(Request $request, $id)
{
//
}

}
30 changes: 30 additions & 0 deletions app/Http/Controllers/Admin/BaseController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

namespace Pterodactyl\Http\Controllers\Admin;

use Debugbar;

use Pterodactyl\Http\Controllers\Controller;
use Illuminate\Http\Request;

class BaseController extends Controller
{

/**
* Controller Constructor
*/
public function __construct()
{

// All routes in this controller are protected by the authentication middleware.
$this->middleware('auth');
$this->middleware('admin');

}

public function getIndex(Request $request)
{
return view('admin.index');
}

}
Loading

0 comments on commit 1489f7a

Please sign in to comment.