Initial Commit of Files

PufferPanel v0.9 (Laravel) is now Pterodactyl 1.0
This commit is contained in:
Dane Everitt 2015-12-06 13:58:49 -05:00
commit 1489f7a694
154 changed files with 10159 additions and 0 deletions

1
database/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
*.sqlite

View file

@ -0,0 +1,21 @@
<?php
/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| Here you may define all of your model factories. Model factories give
| you a convenient way to create models for testing and seeding your
| database. Just tell the factory how a default model should look.
|
*/
$factory->define(Pterodactyl\Models\User::class, function (Faker\Generator $faker) {
return [
'name' => $faker->name,
'email' => $faker->email,
'password' => bcrypt(str_random(10)),
'remember_token' => str_random(10),
];
});

View file

View file

@ -0,0 +1,106 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->increments('id')->unsigned();
$table->char('uuid', 36)->unique();
$table->string('username')->nullable();
$table->string('email')->unique();
$table->text('password');
$table->char('language', 2);
$table->char('session_id', 12);
$table->string('session_ip');
$table->tinyInteger('root_admin')->unsigned();
$table->tinyInteger('use_totp')->unsigned();
$table->char('totp_secret', 16);
$table->timestamps();
});
Schema::create('locations', function (Blueprint $table) {
$table->increments('id')->unsigned();
$table->string('short')->unique();
$table->string('long');
});
Schema::create('nodes', function (Blueprint $table) {
$table->increments('id')->unsigned();
$table->smallInteger('public')->unsigned();
$table->string('name');
$table->mediumInteger('location')->unsigned();
$table->string('fqdn')->unique();
$table->string('ip');
$table->integer('memory')->unsigned();
$table->integer('disk')->unsigned();
$table->char('daemonSecret', 36)->unique();
$table->smallInteger('daemonListen')->unsigned()->default(5656);
$table->smallInteger('daemonSFTP')->unsigned()->default(22);
$table->string('daemonBase')->default('/home/');
});
Schema::create('servers', function (Blueprint $table) {
$table->increments('id')->unsigned();
$table->char('uuid', 36)->unique();
$table->mediumInteger('node')->unsigned();
$table->string('name');
$table->tinyInteger('active')->unsigned();
$table->mediumInteger('owner')->unsigned();
$table->integer('memory')->unsigned();
$table->integer('disk')->unsigned();
$table->integer('io')->unsigned();
$table->integer('cpu')->unsigned();
$table->string('ip');
$table->integer('port')->unsigned();
$table->text('daemonStartup')->nullable();
$table->text('daemonSecret');
$table->string('username');
$table->integer('installed')->unsigned()->default(0);
$table->timestamps();
});
Schema::create('daemon', function (Blueprint $table) {
$table->increments('id')->unsigned();
$table->mediumInteger('server')->unsigned();
$table->string('parameter');
$table->text('value');
$table->tinyInteger('editable')->unsigned()->default(0);
$table->tinyInteger('visible')->unsigned()->default(0);
$table->text('regex')->nullable();
$table->timestamps();
});
Schema::create('allocations', function (Blueprint $table) {
$table->increments('id')->unsigned();
$table->mediumInteger('node')->unsigned();
$table->string('ip');
$table->mediumInteger('port');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('allocations');
Schema::dropIfExists('daemon');
Schema::dropIfExists('servers');
Schema::dropIfExists('nodes');
Schema::dropIfExists('locations');
Schema::dropIfExists('users');
}
}

View file

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddRemebermeToUsers extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->rememberToken()->after('password');
$table->dropColumn('session_id');
$table->dropColumn('session_ip');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('remember_token');
$table->char('session_id', 12)->after('language');
$table->string('session_ip')->after('session_id');
});
}
}

View file

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreatePasswordResetsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('password_resets', function (Blueprint $table) {
$table->string('email')->index();
$table->string('token')->index();
$table->timestamp('created_at');
});
Schema::table('users', function (Blueprint $table) {
$table->string('totp_secret', 16)->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('password_resets');
}
}

View file

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddShortcodeUuid extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('servers', function (Blueprint $table) {
$table->char('uuidShort', 8)->after('uuid')->unique();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('servers', function (Blueprint $table) {
$table->dropColumn('uuidShort');
});
}
}

View file

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class MakePermissionsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('permissions', function (Blueprint $table) {
$table->increments('id')->unsigned();
$table->integer('user_id')->unsigned();
$table->integer('server_id')->unsigned();
$table->string('permission');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('permissions');
}
}

View file

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class MakeSubusersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('subusers', function (Blueprint $table) {
$table->increments('id')->unsigned();
$table->integer('user_id')->unsigned();
$table->integer('server_id')->unsigned();
$table->char('daemonSecret', 36);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('subusers');
}
}

View file

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateApiTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('api', function (Blueprint $table) {
$table->increments('id')->unsigned();
$table->integer('user_id')->nullable()->unsigned();
$table->char('key', 36)->unique();
$table->json('allowed_ips')->nullable();
$table->index('key');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('api');
}
}

View file

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateApiPermissions extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('api_permissions', function (Blueprint $table) {
$table->increments('id')->unsigned();
$table->integer('key_id')->unsigned();
$table->string('permission');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('api_permissions');
}
}

View file

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddIndexToServers extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('servers', function (Blueprint $table) {
$table->index('uuidShort');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('servers', function (Blueprint $table) {
$table->dropIndex('uuidShort');
});
}
}

View file

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddDownloadsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('downloads', function (Blueprint $table) {
$table->increments('id')->unsigned();
$table->char('token', 36)->unique();
$table->mediumInteger('server');
$table->text('path');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('downloads');
}
}

View file

@ -0,0 +1,87 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddTimestampsToTables extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('allocations', function (Blueprint $table) {
$table->timestamps();
});
Schema::table('api', function (Blueprint $table) {
$table->timestamps();
});
Schema::table('api_permissions', function (Blueprint $table) {
$table->timestamps();
});
Schema::table('locations', function (Blueprint $table) {
$table->timestamps();
});
Schema::table('nodes', function (Blueprint $table) {
$table->timestamps();
});
Schema::table('permissions', function (Blueprint $table) {
$table->timestamps();
});
Schema::table('subusers', function (Blueprint $table) {
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('allocations', function (Blueprint $table) {
$table->dropColumn('created_at');
$table->dropColumn('updated_at');
});
Schema::table('api', function (Blueprint $table) {
$table->dropColumn('created_at');
$table->dropColumn('updated_at');
});
Schema::table('api_permissions', function (Blueprint $table) {
$table->dropColumn('created_at');
$table->dropColumn('updated_at');
});
Schema::table('locations', function (Blueprint $table) {
$table->dropColumn('created_at');
$table->dropColumn('updated_at');
});
Schema::table('nodes', function (Blueprint $table) {
$table->dropColumn('created_at');
$table->dropColumn('updated_at');
});
Schema::table('permissions', function (Blueprint $table) {
$table->dropColumn('created_at');
$table->dropColumn('updated_at');
});
Schema::table('subusers', function (Blueprint $table) {
$table->dropColumn('created_at');
$table->dropColumn('updated_at');
});
}
}

0
database/seeds/.gitkeep Normal file
View file

View file

@ -0,0 +1,21 @@
<?php
use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;
class DatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Model::unguard();
// $this->call(UserTableSeeder::class);
Model::reguard();
}
}