mirror of
https://github.com/barkeser2002/pterodactyl-addons.git
synced 2026-09-25 02:19:54 +03:00
732 lines
137 KiB
JSON
Executable File
732 lines
137 KiB
JSON
Executable File
{
|
|
"./app/Http/Controllers/Admin/Bagou/": [
|
|
{
|
|
"type": "folder"
|
|
}
|
|
],
|
|
"./app/Http/Controllers/Admin/Bagou/BagouCenterController.php": [
|
|
{
|
|
"type": "newfile",
|
|
"theme": "any",
|
|
"add": "<?php\n\nnamespace Pterodactyl\\Http\\Controllers\\Admin\\Bagou;\n\nuse Illuminate\\View\\View;\nuse Prologue\\Alerts\\AlertsMessageBag;\nuse Pterodactyl\\Http\\Controllers\\Controller;\nuse Illuminate\\Support\\Facades\\Http;\n\nclass BagouCenterController extends Controller\n{\n protected $alert;\n\n public function __construct(\n AlertsMessageBag $alert\n ) {\n $this->alert = $alert;\n }\n /**\n * Display licensing system\n */\n public function index(): View\n {\n $apistatus = Http::get('https://api.bagou450.com/api/client/pterodactyl/checkOnline')->object();\n $cdnstatus = Http::get('https://cdn.bagou450.com/status')->object();\n\n return view('admin.bagoucenter.index', ['apistatus' => $apistatus, 'cdnstatus' => $cdnstatus]);\n }\n public function settings(): View\n {\n return view('admin.bagoucenter.support.index');\n }\n}\n"
|
|
}
|
|
],
|
|
"./app/Http/Controllers/Admin/Bagou/BagouLicenseController.php": [
|
|
{
|
|
"type": "newfile",
|
|
"theme": "any",
|
|
"add": "<?php\n\nnamespace Pterodactyl\\Http\\Controllers\\Admin\\Bagou;\n\nuse Illuminate\\View\\View;\nuse Pterodactyl\\Models\\Bagoulicense;\nuse Illuminate\\Http\\RedirectResponse;\nuse Prologue\\Alerts\\AlertsMessageBag;\nuse Pterodactyl\\Http\\Controllers\\Controller;\nuse Illuminate\\Http\\Request;\nuse Illuminate\\Support\\Facades\\Http;\n\nclass BagouLicenseController extends Controller\n{\n protected $alert;\n\n public function __construct(\n AlertsMessageBag $alert\n ) {\n $this->alert = $alert;\n }\n /**\n * Display licensing system\n */\n public function index(): View\n {\n $addonslist = Http::get('https://api.bagou450.com/api/client/pterodactyl/addonsList')->json();\n $licenses = Bagoulicense::all();\n return view('admin.bagoucenter.license.index', ['addonslist' => $addonslist, 'licenses' => $licenses]);\n }\n\n /**\n * Display license of the addon\n *\n * @throws \\Pterodactyl\\Exceptions\\Repository\\RecordNotFoundException\n */\n public function license(string $addon): View\n {\n $dbaddon = Bagoulicense::where('addon', $addon)->first();\n $addonslist = Http::get('https://api.bagou450.com/api/client/pterodactyl/addonsList')->json();\n $licenses = Bagoulicense::all();\n return view('admin.bagoucenter.license.license', [\n 'addon' => $addon,\n 'enabled' => ($dbaddon)? $dbaddon['enabled'] : 0,\n 'usage' => ($dbaddon) ? $dbaddon['usage'] : null ,\n 'maxusage' => ($dbaddon) ? $dbaddon['maxusage'] : null,\n 'license' => ($dbaddon) ? $dbaddon['license']: 'Your license',\n 'addonslist' => $addonslist,\n 'licenses' => $licenses\n ]);\n }\n\n /**\n * Set a license\n *\n * @throws \\Throwable\n */\n public function setlicense(Request $request, $addon): RedirectResponse\n { \n $license = Http::accept('application/json')->post(\"https://api.bagou450.com/api/client/pterodactyl/license\", [\n 'id' => $request->license,\n 'selectaddon' => $addon\n ])->object();\n if($license->message == 'Transaction is not valid.') {\n $this->alert->danger('License not found please contact me on discord')->flash();\n return redirect()->route('admin.bagoucenter.license.addon', $addon);\n } else if($license->message == 'Too many license usage please contact me on discord') {\n $this->alert->danger('License are already used on too many panel please contact me on discord')->flash();\n return redirect()->route('admin.bagoucenter.license.addon', $addon);\n } else if ($license->message == 'User blacklisted') {\n if(Bagoulicense::where('addon', $addon)->exists()) {\n\n Bagoulicense::where('addon', $addon)->update(['license' => $request->license, 'usage' => 1, 'maxusage' => 1, 'enabled' => false]);\n } else {\n Bagoulicense::create(['addon' => $addon, 'license' => $request->license, 'usage' => 1, 'maxusage' => 1, 'enabled' => false]);\n }\n $this->alert->danger('You are BLACKLISTED (probably because of a paypal dispute)')->flash();\n return redirect()->route('admin.bagoucenter.license.addon', $addon);\n } else if($license->message == 'Not the good addon') {\n $this->alert->danger('This license is not for this addon!')->flash();\n return redirect()->route('admin.bagoucenter.license.addon', $addon, );\n } else if($license->message == 'done' && $license->name == $addon && !$license->blacklisted) {\n if(Bagoulicense::where('addon', $addon)->exists()) {\n\n Bagoulicense::where('addon', $addon)->update(['license' => $request->license, 'usage' => $license->usage, 'maxusage' => $license->maxusage, 'enabled' => true]);\n } else {\n Bagoulicense::create(['addon' => $addon, 'license' => $request->license, 'usage' => $license->usage, 'maxusage' => $license->maxusage, 'enabled' => true]);\n }\n \n $this->alert->success('License updated sucessfully!')->flash();\n return redirect()->route('admin.bagoucenter.license.addon', $addon);\n }\n $this->alert->danger('Error!')->flash();\n return redirect()->route('admin.bagoucenter.license.addon', $addon);\n }\n\n /**\n * Rmove a license\n *\n * @throws \\Throwable\n */\n public function removelicense($addon): RedirectResponse\n { \n if(Bagoulicense::where('addon', $addon)->exists()) {\n $transaction = Bagoulicense::where('addon', $addon)->first();\n if(!$transaction) {\n $this->alert->danger('No license found.')->flash();\n return redirect()->route('admin.bagoucenter.license.addon', $addon);\n }\n $transaction = $transaction['license'];\n $license = Http::delete(\"https://api.bagou450.com/api/client/pterodactyl/license?id=$transaction\")->object();\n Bagoulicense::where('addon', $addon)->delete();\n $this->alert->success('License removed sucessfully')->flash();\n return redirect()->route('admin.bagoucenter.license.addon', $addon); \n } else {\n $this->alert->danger('No license found.')->flash();\n return redirect()->route('admin.bagoucenter.license.addon', $addon); \n }\n\n }\n}\n"
|
|
}
|
|
],
|
|
"./app/Http/Controllers/Admin/Bagou/BagouSettingsController.php": [
|
|
{
|
|
"type": "newfile",
|
|
"theme": "any",
|
|
"add": "<?php\n\nnamespace Pterodactyl\\Http\\Controllers\\Admin\\Bagou;\n\nuse Illuminate\\View\\View;\nuse Pterodactyl\\Models\\Bagoulicense;\nuse Prologue\\Alerts\\AlertsMessageBag;\nuse Pterodactyl\\Http\\Controllers\\Controller;\nuse Illuminate\\Support\\Facades\\Http;\n\nclass BagouSettingsController extends Controller\n{\n protected $alert;\n\n public function __construct(\n AlertsMessageBag $alert\n ) {\n $this->alert = $alert;\n }\n /**\n * Display licensing system\n */\n public function index(): View\n {\n $addonslist = Http::get('https://api.bagou450.com/api/client/pterodactyl/addonsList')->json();\n $licenses = Bagoulicense::all();\n return view('admin.bagoucenter.settings.index', [ 'addonslist' => $addonslist,\n 'licenses' => $licenses]);\n }\n\n /**\n * Display licensing system\n */\n public function addon(string $addon): View\n {\n $addonslist = Http::get('https://api.bagou450.com/api/client/pterodactyl/addonsList')->json();\n $licenses = Bagoulicense::all();\n return view($addon['tabroute'], ['addonslist' => $addonslist,\n 'licenses' => $licenses]);\n }\n}\n"
|
|
}
|
|
],
|
|
"./app/Http/Controllers/Admin/Bagou/BagouVersionsController.php": [
|
|
{
|
|
"type": "newfile",
|
|
"theme": "any",
|
|
"add": "<?php\n\nnamespace Pterodactyl\\Http\\Controllers\\Admin\\Bagou;\n\nuse Illuminate\\View\\View;\nuse Pterodactyl\\Models\\Bagoulicense;\nuse Prologue\\Alerts\\AlertsMessageBag;\nuse Pterodactyl\\Http\\Controllers\\Controller;\nuse Illuminate\\Support\\Facades\\Http;\n\nclass BagouVersionsController extends Controller\n{\n protected AlertsMessageBag $alert;\n\n public function __construct(\n AlertsMessageBag $alert\n ) {\n $this->alert = $alert;\n }\n /**\n * Display licensing system\n */\n public function index(): View\n {\n $addonslist = Http::get('https://api.bagou450.com/api/client/pterodactyl/addonsList')->json();\n $licenses = Bagoulicense::all();\n return view('admin.bagoucenter.versions.index', ['addonslist' => $addonslist, 'licenses' => $licenses]);\n }\n /**\n * Refresh Versions\n */\n public function refresh(): View\n {\n $licenses = Bagoulicense::all();\n foreach($licenses as $license) {\n $id = $license['license'];\n $version = Http::get(\"https://api.bagou450.com/api/client/pterodactyl/getVersion?id=$id\");\n if($version->failed()) {\n $addonslist = Http::get('https://api.bagou450.com/api/client/pterodactyl/addonsList')->json();\n $this->alert->danger('Error!')->flash();\n return view('admin.bagoucenter.versions.index', ['addonslist' => $addonslist, 'licenses' => $licenses]);\n } else {\n Bagoulicense::where('license', '=', $id)->update(['version' => $version->json()['version']]);\n }\n }\n $addonslist = Http::get('https://api.bagou450.com/api/client/pterodactyl/addonsList')->json();\n $licenses = Bagoulicense::all();\n\n $this->alert->success('Versions updated sucessfully!')->flash();\n return view('admin.bagoucenter.versions.index', ['addonslist' => $addonslist, 'licenses' => $licenses]);\n }\n}\n"
|
|
}
|
|
],
|
|
"./database/migrations/2022_07_04_151819_create_bagoulicense_table.php": [
|
|
{
|
|
"type": "newfile",
|
|
"theme": "any",
|
|
"add": "<?php\n\nuse Illuminate\\Database\\Migrations\\Migration;\nuse Illuminate\\Database\\Schema\\Blueprint;\nuse Illuminate\\Support\\Facades\\Schema;\n\nclass CreateBagoulicenseTable extends Migration\n{\n /**\n * Run the migrations.\n *\n * @return void\n */\n public function up()\n {\n Schema::create('bagoulicense', function (Blueprint $table) {\n $table->id();\n $table->string('addon');\n $table->string('license');\n $table->integer('usage');\n $table->integer('maxusage');\n $table->boolean('enabled');\n $table->timestamps();\n });\n }\n\n /**\n * Reverse the migrations.\n *\n * @return void\n */\n public function down()\n {\n Schema::dropIfExists('bagoulicense');\n }\n}\n"
|
|
}
|
|
],
|
|
"./routes/admin.php": [
|
|
{
|
|
"type": "under",
|
|
"theme": "any",
|
|
"add": "/*\n|--------------------------------------------------------------------------\n| Bagou License Center Routes\n|--------------------------------------------------------------------------\n|\n| Endpoint: /admin/bagoucenter\n|\n*/\nRoute::group(['prefix' => 'bagoucenter'], function () {\n Route::get('/', [Admin\\Bagou\\BagouCenterController::class, 'index'])->name('admin.bagoucenter');\n Route::get('/license/', [Admin\\Bagou\\BagouLicenseController::class, 'index'])->name('admin.bagoucenter.license');\n Route::get('/license/{addon}', [Admin\\Bagou\\BagouLicenseController::class, 'license'])->name('admin.bagoucenter.license.addon');\n \n Route::get('/versions/', [Admin\\Bagou\\BagouVersionsController::class, 'index'])->name('admin.bagoucenter.versions');\n\n Route::get('/settings', [Admin\\Bagou\\BagouSettingsController::class, 'index'])->name('admin.bagoucenter.settings');\n Route::get('/settings/{addon}', [Admin\\Bagou\\BagouSettingsController::class, 'settings'])->name('admin.bagoucenter.settings.addon');\n\n Route::get('/support/', [Admin\\Bagou\\BagouCenterController::class, 'settings'])->name('admin.bagoucenter.support');\n\n Route::post('/license/{addon}', [Admin\\Bagou\\BagouLicenseController::class, 'setlicense']);\n \n Route::post('/versions', [Admin\\Bagou\\BagouVersionsController::class, 'refresh']);\n\n Route::delete('/license/{addon}', [Admin\\Bagou\\BagouLicenseController::class, 'removelicense']);\n \n});",
|
|
"where": " Route::delete('/egg/{egg:id}/variables/{variable:id}', [Admin\\Nests\\EggVariableController::class, 'destroy']);\n});"
|
|
},
|
|
{
|
|
"type": "under",
|
|
"theme": "any",
|
|
"add": "/*\n|--------------------------------------------------------------------------\n| Cloud servers Controller Routes\n|--------------------------------------------------------------------------\n|\n| Endpoint: /admin/cloud\n|\n*/\nRoute::group(['prefix' => 'cloud'], function () {\n Route::get('/', [Admin\\Cloud\\CloudController::class, 'index'])->name('admin.cloud.index');\n Route::post('/savesettings', [Admin\\Cloud\\CloudController::class, 'savesettings'])->name('admin.cloud.savesettings');\n\n});",
|
|
"where": " Route::delete('/egg/{egg:id}/variables/{variable:id}', [Admin\\Nests\\EggVariableController::class, 'destroy']);\n});"
|
|
},
|
|
{
|
|
"type": "under",
|
|
"theme": "any",
|
|
"add": " Route::group(['prefix' => 'cloud'], function () {\n Route::post('/view/{user:id}/suspend', [Admin\\Cloud\\UserController::class, 'suspend'])->name('admin.users.cloud.suspend');\n });",
|
|
"where": "Route::delete('/view/{user:id}', [Admin\\UserController::class, 'delete']);"
|
|
}
|
|
],
|
|
"./resources/views/admin/bagoucenter/index.blade.php": [
|
|
{
|
|
"type": "newfile",
|
|
"theme": "any",
|
|
"add": "@extends('layouts.admin')\n@include('partials/admin.settings.nav', ['activeTab' => 'basic'])\n\n@section('title')\n Bagou License\n@endsection\n\n@section('content-header')\n<h1>Bagou Center<small>Manage all bagou450 addons.</small></h1>\n <ol class=\"breadcrumb\">\n <li><a href=\"{{ route('admin.index') }}\">Admin</a></li>\n <li class=\"active\">Bagou Center</li>\n </ol>\n@endsection\n@section('content')\n@include('admin.bagoucenter.nav', ['addon' => null])\n\n <div class=\"row\" style=\"margin-top: 15px;\">\n <div class=\"col-xs-12\">\n <div class=\"box\">\n <div class=\"box-header with-border\">\n <h3 class=\"box-title\">Bagou Center</h3>\n </div>\n <p class=\"box-body\">\n Select a tab above for manage all your Bagou450 addons!</span>.\n <br>\n <span style=\"font-size: 20px;\">Api status: @if ($apistatus === 1) Online <i class=\"fa fa-check-circle\" style=\"color: green;\" aria-hidden=\"true\"></i> @elseif ($apistatus === 2) Maintenance mode <i class=\"fa fa-exclamation-circle\" style=\"color: yellow;\" aria-hidden=\"true\"></i> @else Down <i class=\"fa fa-minus-circle\" style=\"color: red;\" aria-hidden=\"true\"></i> @endif</span>\n <br>\n <span style=\"font-size: 20px;\">CDN status: @if ($cdnstatus === 1) Online <i class=\"fa fa-check-circle\" style=\"color: green;\" aria-hidden=\"true\"></i> @elseif ($cdnstatus === 2) Maintenance mode <i class=\"fa fa-exclamation-circle\" style=\"color: yellow;\" aria-hidden=\"true\"></i> @else Down <i class=\"fa fa-minus-circle\" style=\"color: red;\" aria-hidden=\"true\"></i> @endif</span>\n\n </p>\n </div>\n </div>\n </div>\n@endsection"
|
|
}
|
|
],
|
|
"./resources/views/admin/bagoucenter/license.blade.php": [
|
|
{
|
|
"type": "newfile",
|
|
"theme": "any",
|
|
"add": "@extends('layouts.admin')\n@include('partials/admin.settings.nav', ['activeTab' => 'basic'])\n\n@section('title')\n Bagou License\n@endsection\n\n@section('content-header')\n <h1>Bagou License<small>Configure license for Bagou450 Addons.</small></h1>\n <ol class=\"breadcrumb\">\n <li><a href=\"{{ route('admin.index') }}\">Admin</a></li>\n <li class=\"active\">Bagou License</li>\n </ol>\n@endsection\n@section('content')\n@include('admin.bagoulicense.nav', ['addon' => $addon])\n\n <div class=\"row\">\n <div class=\"col-xs-12\">\n <div class=\"box\">\n <div class=\"box-header with-border\">\n <h3 class=\"box-title\">Bagou License</h3>\n </div>\n <form action=\"{{ route('admin.settings') }}\" method=\"POST\">\n <div class=\"box-body\">\n <div class=\"row\">\n <div class=\"form-group col-md-4\">\n <label class=\"control-label\">Company Name</label>\n <div>\n <input type=\"text\" class=\"form-control\" name=\"app:name\" value=\"{{ old('app:name', config('app.name')) }}\" />\n <p class=\"text-muted\"><small>This is the name that is used throughout the panel and in emails sent to clients.</small></p>\n </div>\n </div>\n <div class=\"form-group col-md-4\">\n <label class=\"control-label\">Require 2-Factor Authentication</label>\n <div>\n <div class=\"btn-group\" data-toggle=\"buttons\">\n @php\n $level = old('pterodactyl:auth:2fa_required', config('pterodactyl.auth.2fa_required'));\n @endphp\n <label class=\"btn btn-primary @if ($level == 0) active @endif\">\n <input type=\"radio\" name=\"pterodactyl:auth:2fa_required\" autocomplete=\"off\" value=\"0\" @if ($level == 0) checked @endif> Not Required\n </label>\n <label class=\"btn btn-primary @if ($level == 1) active @endif\">\n <input type=\"radio\" name=\"pterodactyl:auth:2fa_required\" autocomplete=\"off\" value=\"1\" @if ($level == 1) checked @endif> Admin Only\n </label>\n <label class=\"btn btn-primary @if ($level == 2) active @endif\">\n <input type=\"radio\" name=\"pterodactyl:auth:2fa_required\" autocomplete=\"off\" value=\"2\" @if ($level == 2) checked @endif> All Users\n </label>\n </div>\n <p class=\"text-muted\"><small>If enabled, any account falling into the selected grouping will be required to have 2-Factor authentication enabled to use the Panel.</small></p>\n </div>\n </div>\n <div class=\"form-group col-md-4\">\n <label class=\"control-label\">Status</label>\n <div>\n <p>@extends('layouts.admin')\n@include('partials/admin.settings.nav', ['activeTab' => 'basic'])\n\n@section('title')\n Bagou License\n@endsection\n\n@section('content-header')\n<h1>Bagou Center<small>Manage all bagou450 addons.</small></h1>\n <ol class=\"breadcrumb\">\n <li><a href=\"{{ route('admin.index') }}\">Admin</a></li>\n <li class=\"active\">Bagou Center</li>\n </ol>\n@endsection\n@section('content')\n@include('admin.bagoulicense.nav', ['addon' => $addon])\n\n <div class=\"row\">\n <div class=\"col-xs-12\">\n <div class=\"box\">\n <div class=\"box-header with-border\">\n <h3 class=\"box-title\">Bagou License</h3>\n </div>\n <form method=\"POST\">\n <div class=\"box-body\">\n <div class=\"row\">\n <div class=\"form-group col-md-4\">\n <label class=\"control-label\">Addon license (Transaction id)</label>\n <div>\n <input type=\"text\" class=\"form-control\" name=\"license\" value=\"{{ $license }}\" />\n <p class=\"text-muted\"><small>Add here your transaction id if not work contact me on <a href=\"https://discord.bagou450.com\">discord</a></small></p>\n </div>\n </div>\n <div class=\"form-group col-md-4\">\n <label class=\"control-label\">Usage</label>\n <div>\n <p>{{ $usage && $maxusage ? \"$usage / $maxusage panel(s)\" : 'No license' }} <br> {{ $usage && $maxusage ? 'Contact me on discord for increase panel limit.' : 'For use the addon you need to insert a license' }}</p>\n </div>\n </div>\n <div class=\"form-group col-md-4\">\n <label class=\"control-label\">Status</label>\n <div>\n <p style=\"font-size: 50px\">{{$enabled ? '✅' : '\uD83D\uDEAB' }}</p>\n </div>\n </div>\n </div>\n </div>\n <div class=\"box-footer\">\n {!! csrf_field() !!}\n <button type=\"submit\" name=\"_method\" value=\"POST\" style=\"margin-left: 8px\" class=\"btn btn-sm btn-primary pull-right \">Save</button>\n {!! csrf_field() !!}\n <button type=\"submit\" name=\"_method\" value=\"DELETE\" class=\"btn btn-sm btn-danger pull-right \">Remove License</button>\n\n </form>\n </div>\n\n </div>\n </div>\n </div>\n@endsection\n</p>\n </div>\n </div>\n </div>\n </div>\n <div class=\"box-footer\">\n {!! csrf_field() !!}\n <button type=\"submit\" name=\"_method\" value=\"PATCH\" class=\"btn btn-sm btn-primary pull-right\">Save</button>\n </div>\n </form>\n </div>\n </div>\n </div>\n@endsection"
|
|
}
|
|
],
|
|
"./resources/views/admin/bagoucenter/nav.blade.php": [
|
|
{
|
|
"type": "newfile",
|
|
"theme": "any",
|
|
"add": "@php\n $router = app('router');\n@endphp\n<div class=\"row\">\n <div class=\"col-xs-12\">\n <div class=\"nav-tabs-custom nav-tabs-floating\" style=\"margin-bottom: 1px;\">\n <ul class=\"nav nav-tabs\">\n <li class=\"{{ $router->currentRouteNamed('admin.bagoucenter') ? 'active' : '' }}\">\n <a href=\"{{ route('admin.bagoucenter') }}\">Overview</a>\n </li>\n <li class=\"{{ $router->currentRouteNamed('admin.bagoucenter.license') || $router->currentRouteNamed('admin.bagoucenter.license.addon')? 'active' : '' }}\">\n <a href=\"{{ route('admin.bagoucenter.license') }}\">License</a>\n </li>\n <li class=\"{{ $router->currentRouteNamed('admin.bagoucenter.versions') || str_starts_with($router->current()->uri, 'admin/bagoucenter/versions') ? 'active' : '' }}\">\n <a href=\"{{ route('admin.bagoucenter.versions') }}\">Version checker</a>\n </li>\n <li class=\"{{ $router->currentRouteNamed('admin.bagoucenter.settings') || str_starts_with($router->current()->uri, 'admin/bagoucenter/settings') ? 'active' : '' }}\">\n <a href=\"{{ route('admin.bagoucenter.settings') }}\">Settings</a>\n </li>\n <li class=\"{{ $router->currentRouteNamed('admin.bagoucenter.support') || str_starts_with($router->current()->uri, 'admin/bagoucenter/support') ? 'active' : '' }}\">\n <a href=\"{{ route('admin.bagoucenter.support') }}\">Support</a>\n </li>\n </ul>\n </div>\n </div>\n</div>"
|
|
}
|
|
],
|
|
"./resources/views/admin/bagoucenter/license": [
|
|
{
|
|
"type": "folder"
|
|
}
|
|
],
|
|
"./resources/views/admin/bagoucenter/license/index.blade.php": [
|
|
{
|
|
"type": "newfile",
|
|
"theme": "any",
|
|
"add": "@extends('layouts.admin')\n@include('partials/admin.settings.nav', ['activeTab' => 'basic'])\n\n@section('title')\n Bagou License\n@endsection\n\n@section('content-header')\n <h1>Bagou Center<small>Manage all bagou450 addons.</small></h1>\n <ol class=\"breadcrumb\">\n <li><a href=\"{{ route('admin.index') }}\">Admin</a></li>\n <li class=\"active\">Bagou Center</li>\n </ol>\n@endsection\n@section('content')\n@include('admin.bagoucenter.nav')\n@include('admin.bagoucenter.license.nav', ['addon' => null, 'addonslist' => $addonslist, 'licenses' => $licenses])\n\n <div class=\"row\">\n <div class=\"col-xs-12\">\n <div class=\"box\">\n <div class=\"box-header with-border\">\n <h3 class=\"box-title\">Bagou License</h3>\n </div>\n <p class=\"box-body\">\n You can manage your license here.\n <br>Actual license status:\n <ul>\n @foreach ($addonslist as $addon)\n @php\n $found = false;\n @endphp\n @foreach($licenses as $license) \n @if($license->addon == $addon['id'])\n @php\n $found = true;\n @endphp\n <li>{{$addon['name']}}: <span style=\"color: green;\">Activated</span></li>\n @endif\n @endforeach\n @if (!$found)\n <li>{{$addon['name']}}: <span style=\"color: red;\">Disabled</span></li>\n @endif\n @endforeach\n </ul>\n </p>\n </div>\n </div>\n </div>\n@endsection"
|
|
}
|
|
],
|
|
"./resources/views/admin/bagoucenter/license/nav.blade.php": [
|
|
{
|
|
"type": "newfile",
|
|
"theme": "any",
|
|
"add": "@php\n $router = app('router');\n@endphp\n<div class=\"row\">\n <div class=\"col-xs-12\">\n <div class=\"nav-tabs-custom nav-tabs-floating\">\n <ul class=\"nav nav-tabs\">\n <li class=\"{{ $router->currentRouteNamed('admin.bagoucenter.license') ? 'active' : '' }}\">\n <a href=\"{{ route('admin.bagoucenter.license') }}\">Overview</a>\n </li>\n @foreach ($addonslist as $addonn) \n @if (isset($addonn['id']) && isset($addonn['name']))\n <li class=\"{{ $addon == $addonn['id'] ? 'active' : '' }}\">\n <a href=\"{{ route('admin.bagoucenter.license.addon', $addonn['id']) }}\">{{$addonn['name']}} @if($addonn['new']) <span class=\"label label-success\"> NEW </span> @endif</a>\n </li>\n @endif\n @endforeach\n </ul>\n </div>\n </div>\n</div>"
|
|
}
|
|
],
|
|
"./resources/views/admin/bagoucenter/license/license.blade.php": [
|
|
{
|
|
"type": "newfile",
|
|
"theme": "any",
|
|
"add": "@extends('layouts.admin')\n@include('partials/admin.settings.nav', ['activeTab' => 'basic'])\n\n@section('title')\n Bagou License\n@endsection\n\n@section('content-header')\n<h1>Bagou Center<small>Manage all bagou450 addons.</small></h1>\n <ol class=\"breadcrumb\">\n <li><a href=\"{{ route('admin.index') }}\">Admin</a></li>\n <li class=\"active\">Bagou Center</li>\n </ol>\n@endsection\n@section('content')\n@include('admin.bagoucenter.nav')\n@include('admin.bagoucenter.license.nav', ['addon' => $addon, 'addonslist' => $addonslist, 'licenses' => $licenses])\n\n <div class=\"row\">\n <div class=\"col-xs-12\">\n <div class=\"box\">\n <div class=\"box-header with-border\">\n <h3 class=\"box-title\">Bagou License</h3>\n </div>\n <form action=\"{{ route('admin.settings') }}\" method=\"POST\">\n <div class=\"box-body\">\n <div class=\"row\">\n <div class=\"form-group col-md-4\">\n <label class=\"control-label\">Company Name</label>\n <div>\n <input type=\"text\" class=\"form-control\" name=\"app:name\" value=\"{{ old('app:name', config('app.name')) }}\" />\n <p class=\"text-muted\"><small>This is the name that is used throughout the panel and in emails sent to clients.</small></p>\n </div>\n </div>\n <div class=\"form-group col-md-4\">\n <label class=\"control-label\">Require 2-Factor Authentication</label>\n <div>\n <div class=\"btn-group\" data-toggle=\"buttons\">\n @php\n $level = old('pterodactyl:auth:2fa_required', config('pterodactyl.auth.2fa_required'));\n @endphp\n <label class=\"btn btn-primary @if ($level == 0) active @endif\">\n <input type=\"radio\" name=\"pterodactyl:auth:2fa_required\" autocomplete=\"off\" value=\"0\" @if ($level == 0) checked @endif> Not Required\n </label>\n <label class=\"btn btn-primary @if ($level == 1) active @endif\">\n <input type=\"radio\" name=\"pterodactyl:auth:2fa_required\" autocomplete=\"off\" value=\"1\" @if ($level == 1) checked @endif> Admin Only\n </label>\n <label class=\"btn btn-primary @if ($level == 2) active @endif\">\n <input type=\"radio\" name=\"pterodactyl:auth:2fa_required\" autocomplete=\"off\" value=\"2\" @if ($level == 2) checked @endif> All Users\n </label>\n </div>\n <p class=\"text-muted\"><small>If enabled, any account falling into the selected grouping will be required to have 2-Factor authentication enabled to use the Panel.</small></p>\n </div>\n </div>\n <div class=\"form-group col-md-4\">\n <label class=\"control-label\">Status</label>\n <div>\n <p>@extends('layouts.admin')\n@include('partials/admin.settings.nav', ['activeTab' => 'basic'])\n\n@section('title')\n Bagou License\n@endsection\n\n@section('content-header')\n <h1>Bagou License<small>Configure license for Bagou450 Addons.</small></h1>\n <ol class=\"breadcrumb\">\n <li><a href=\"{{ route('admin.index') }}\">Admin</a></li>\n <li class=\"active\">Bagou License</li>\n </ol>\n@endsection\n@section('content')\n@include('admin.bagoucenter.nav')\n@include('admin.bagoucenter.license.nav', ['addon' => $addon, 'addonslist' => $addonslist, 'licenses' => $licenses])\n\n <div class=\"row\">\n <div class=\"col-xs-12\">\n <div class=\"box\">\n <div class=\"box-header with-border\">\n <h3 class=\"box-title\">Bagou License</h3>\n </div>\n <form method=\"POST\">\n <div class=\"box-body\">\n <div class=\"row\">\n <div class=\"form-group col-md-4\">\n <label class=\"control-label\">Addon license (Transaction id)</label>\n <div>\n <input type=\"text\" class=\"form-control\" name=\"license\" value=\"{{ $license }}\" />\n <p class=\"text-muted\"><small>Add here your transaction id if not work contact me on <a href=\"https://discord.bagou450.com\">discord</a></small></p>\n </div>\n </div>\n <div class=\"form-group col-md-4\">\n <label class=\"control-label\">Usage</label>\n <div>\n <p>{{ $usage && $maxusage ? \"$usage / $maxusage panel(s)\" : 'No license' }} <br> {{ $usage && $maxusage ? 'Contact me on discord for increase panel limit.' : 'For use the addon you need to insert a license' }}</p>\n </div>\n </div>\n <div class=\"form-group col-md-4\">\n <label class=\"control-label\">Status</label>\n <div>\n <p style=\"font-size: 50px\">{{$enabled ? '✅' : '\uD83D\uDEAB' }}</p>\n </div>\n </div>\n </div>\n </div>\n <div class=\"box-footer\">\n {!! csrf_field() !!}\n <button type=\"submit\" name=\"_method\" value=\"POST\" style=\"margin-left: 8px\" class=\"btn btn-sm btn-primary pull-right \">Save</button>\n {!! csrf_field() !!}\n <button type=\"submit\" name=\"_method\" value=\"DELETE\" class=\"btn btn-sm btn-danger pull-right \">Remove License</button>\n\n </form>\n </div>\n\n </div>\n </div>\n </div>\n@endsection\n</p>\n </div>\n </div>\n </div>\n </div>\n <div class=\"box-footer\">\n {!! csrf_field() !!}\n <button type=\"submit\" name=\"_method\" value=\"PATCH\" class=\"btn btn-sm btn-primary pull-right\">Save</button>\n </div>\n </form>\n </div>\n </div>\n </div>\n@endsection"
|
|
}
|
|
],
|
|
"./resources/views/admin/bagoucenter/settings": [
|
|
{
|
|
"type": "folder"
|
|
}
|
|
],
|
|
"./resources/views/admin/bagoucenter/settings/index.blade.php": [
|
|
{
|
|
"type": "newfile",
|
|
"theme": "any",
|
|
"add": "@extends('layouts.admin')\n@include('partials/admin.settings.nav', ['activeTab' => 'basic'])\n\n@section('title')\n Bagou License\n@endsection\n\n@section('content-header')\n <h1>Bagou Center<small>Manage all bagou450 addons.</small></h1>\n <ol class=\"breadcrumb\">\n <li><a href=\"{{ route('admin.index') }}\">Admin</a></li>\n <li class=\"active\">Bagou Center</li>\n </ol>\n@endsection\n@section('content')\n@include('admin.bagoucenter.nav')\n@include('admin.bagoucenter.settings.nav', ['addon' => null, 'addonslist' => $addonslist, 'licenses' => $licenses])\n\n <div class=\"row\">\n <div class=\"col-xs-12\">\n <div class=\"box\">\n <div class=\"box-header with-border\">\n <h3 class=\"box-title\">Bagou Settings</h3>\n </div>\n <p class=\"box-body\">\n Choose a tab above for manage addon settings\n </p>\n </div>\n </div>\n </div>\n@endsection"
|
|
}
|
|
],
|
|
"./resources/views/admin/bagoucenter/settings/nav.blade.php": [
|
|
{
|
|
"type": "newfile",
|
|
"theme": "any",
|
|
"add": "@php\n $router = app('router');\n@endphp\n<div class=\"row\">\n <div class=\"col-xs-12\">\n <div class=\"nav-tabs-custom nav-tabs-floating\">\n <ul class=\"nav nav-tabs\">\n <li class=\"{{ $router->currentRouteNamed('admin.bagoucenter.settings') ? 'active' : '' }}\">\n <a href=\"{{ route('admin.bagoucenter.settings') }}\">Overview</a>\n </li>\n @foreach ($addonslist as $addonn)\n @foreach($licenses as $license) \n @if($license->addon == $addonn['id'] && $addonn['tab'])\n @php\n $found = true;\n @endphp\n <li class=\"{{ $addon == $addonn['id'] ? 'active' : '' }}\">\n <a href=\"{{ route($addonn['tabroute'], $addonn['id']) }}\">{{$addonn['name']}} @if($addonn['new']) <span class=\"label label-success\"> NEW </span> @endif</a>\n </li>\n @endif\n @endforeach\n @endforeach\n </ul>\n </div>\n </div>\n</div>"
|
|
}
|
|
],
|
|
"./resources/views/admin/bagoucenter/support": [
|
|
{
|
|
"type": "folder"
|
|
}
|
|
],
|
|
"./resources/views/admin/bagoucenter/support/index.blade.php": [
|
|
{
|
|
"type": "newfile",
|
|
"theme": "any",
|
|
"add": "@extends('layouts.admin')\n@include('partials/admin.settings.nav', ['activeTab' => 'basic'])\n\n@section('title')\n Bagou License\n@endsection\n\n@section('content-header')\n<h1>Bagou Center<small>Manage all bagou450 addons.</small></h1>\n <ol class=\"breadcrumb\">\n <li><a href=\"{{ route('admin.index') }}\">Admin</a></li>\n <li class=\"active\">Bagou Center</li>\n </ol>\n@endsection\n@section('content')\n@include('admin.bagoucenter.nav', ['addon' => null])\n\n <div class=\"row\" style=\"margin-top: 15px;\">\n <div class=\"col-xs-12\">\n <div class=\"box\">\n <div class=\"box-header with-border\">\n <h3 class=\"box-title\">Bagou Support</h3>\n </div>\n <p class=\"box-body\">\n You can contact me trough many way!</span>.\n <br>\n <span style=\"font-size: 20px;\">Discord: <a href=\"http://discord.bagou450.com\">here</a> (24 hour response time) </span>\n <br>\n <span style=\"font-size: 20px;\">Sms (No call): +33 7 56 89 00 36 (24 hours response time) </span>\n <br>\n <span style=\"font-size: 20px;\">Email: contact@bagou450.com (48 hours response time) </span>\n\n </p>\n </div>\n </div>\n </div>\n@endsection"
|
|
}
|
|
],
|
|
"./resources/views/admin/bagoucenter/versions": [
|
|
{
|
|
"type": "folder"
|
|
}
|
|
],
|
|
"./resources/views/admin/bagoucenter/versions/index.blade.php": [
|
|
{
|
|
"type": "newfile",
|
|
"theme": "any",
|
|
"add": "@extends('layouts.admin')\n@include('partials/admin.settings.nav', ['activeTab' => 'basic'])\n\n@section('title')\n Bagou License\n@endsection\n\n@section('content-header')\n <h1>Bagou Center<small>Manage all bagou450 addons.</small></h1>\n <ol class=\"breadcrumb\">\n <li><a href=\"{{ route('admin.index') }}\">Admin</a></li>\n <li class=\"active\">Bagou Center</li>\n </ol>\n@endsection\n@section('content')\n@include('admin.bagoucenter.nav')\n\n <div class=\"row\" style=\"margin-top: 15px;\">\n <div class=\"col-xs-12\">\n <div class=\"box\">\n <div class=\"box-header with-border\">\n <h3 class=\"box-title\">Bagou Update Checker</h3>\n </div>\n <p class=\"box-body\">\n You can manage your license here.\n <br>Actual license status:\n <ul>\n @foreach ($addonslist as $addon)\n @foreach($licenses as $license) \n @if($license->addon == $addon['id'])\n <li>{{$addon['name']}} {{$license->version}}: @if($addon['version'] == $license->version) <span style=\"color: green;\">Updated</span> @else <span style=\"color: red;\">Outdated (Latest version: {{$addon['version']}})</span> @endif</li>\n @endif\n @endforeach\n @endforeach\n </ul>\n \n </p>\n <div class=\"box-footer\">\n <form method=\"POST\">\n @csrf\n <button type=\"submit\" name=\"_method\" value=\"POST\" style=\"margin-left: 8px\" class=\"btn btn-sm btn-primary pull-right \">Refresh</button>\n</form>\n </div>\n </div>\n \n </div>\n </div>\n@endsection"
|
|
}
|
|
],
|
|
"./resources/views/layouts/admin.blade.php": [
|
|
{
|
|
"type": "above",
|
|
"theme": "any",
|
|
"where": "<li class=\"header\">MANAGEMENT</li>",
|
|
"add": " <li class=\"{{ ! starts_with(Route::currentRouteName(), 'admin.bagoucenter') ?: 'active' }}\">\n <a href=\"{{ route('admin.bagoucenter')}}\">\n <i class=\"fa fa-globe\"></i> <span>Bagou Center</span>\n </a>\n </li>"
|
|
}
|
|
],
|
|
"./app/Http/Controllers/Admin/Cloud/": [
|
|
{
|
|
"type": "folder"
|
|
}
|
|
],
|
|
"./app/Http/Controllers/Admin/Cloud/CloudController.php": [
|
|
{
|
|
"type": "newfile",
|
|
"theme": "any",
|
|
"add": "<?php\n/**\n * Pterodactyl - Panel\n * Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.\n *\n * This software is licensed under the terms of the MIT license.\n * https://opensource.org/licenses/MIT\n */\n\nnamespace Pterodactyl\\Http\\Controllers\\Admin\\Cloud;\n\nuse Javascript;\nuse Illuminate\\View\\View;\nuse Pterodactyl\\Models\\Egg;\nuse Pterodactyl\\Models\\Server;\nuse Pterodactyl\\Models\\Node;\nuse Pterodactyl\\Models\\Bagoulicense;\nuse Illuminate\\Support\\Facades\\Http;\nuse Pterodactyl\\Models\\Location;\n\nuse Pterodactyl\\Models\\Setting;\nuse Illuminate\\Http\\RedirectResponse;\nuse Prologue\\Alerts\\AlertsMessageBag;\nuse Pterodactyl\\Http\\Controllers\\Controller;\nuse Pterodactyl\\Services\\Eggs\\EggUpdateService;\nuse Pterodactyl\\Services\\Eggs\\EggCreationService;\nuse Pterodactyl\\Services\\Eggs\\EggDeletionService;\nuse Pterodactyl\\Http\\Requests\\Admin\\Egg\\EggFormRequest;\nuse Pterodactyl\\Contracts\\Repository\\EggRepositoryInterface;\nuse Pterodactyl\\Contracts\\Repository\\NestRepositoryInterface;\nuse Illuminate\\Http\\Request;\n\nclass CloudController extends Controller\n{\n protected $alert;\n\n protected $creationService;\n\n protected $deletionService;\n\n protected $nestRepository;\n\n protected $repository;\n\n protected $updateService;\n\n public function __construct(\n AlertsMessageBag $alert,\n EggCreationService $creationService,\n EggDeletionService $deletionService,\n EggRepositoryInterface $repository,\n EggUpdateService $updateService,\n NestRepositoryInterface $nestRepository\n ) {\n $this->alert = $alert;\n $this->creationService = $creationService;\n $this->deletionService = $deletionService;\n $this->nestRepository = $nestRepository;\n $this->repository = $repository;\n $this->updateService = $updateService;\n }\n\n /**\n * Handle a request to display the Cloud servers page.\n *\n * @throws \\Pterodactyl\\Exceptions\\Repository\\RecordNotFoundException\n */\n public function index()\n {\n $eggs = Egg::get();\n $cloudservers = Server::where('cloud', true)->get();\n $cloudnodes = Node::where('cloud', true)->get();\n $nodeselection = Setting::where('key', 'cloud_nodeselect')->first();\n $locationselection = Setting::where('key', 'cloud_locationselect')->first();\n $transaction = Bagoulicense::where('addon', '585')->firstOrFail()->license;\n $license = Http::get(\"https://api.bagou450.com/api/client/pterodactyl/checklicense?id=$transaction&name=585\");\n $code = $license->status();\n $license = $license->object();\n if ($code !== 200) {\n $this->alert->danger('Error with the license key')->flash();\n return redirect()->route('admin.bagoulicense.license', 'cloudservers');\n } else {\n if(!$nodeselection) {\n $nodeselection = 'false';\n } else {\n $nodeselection = $nodeselection['value'];\n }\n if(!$locationselection) {\n $locationselection = 'false';\n } else {\n $locationselection = $locationselection['value'];\n }\n $cloudlocations = Location::where('cloud', true)->get();\n\n return view('admin.cloud.index', ['eggs' => $eggs, 'cloudservers' => $cloudservers, 'cloudnodes' => $cloudnodes,'cloudlocations' => $cloudlocations, 'nodeselection' => $nodeselection, 'locationselection' => $locationselection]);\n }\n \n }\n\n /**\n * Handle a request to display the Egg creation page.\n *\n * @throws \\Pterodactyl\\Exceptions\\Repository\\RecordNotFoundException\n */\n public function savesettings(Request $request, Server $server)\n {\n $transaction = Bagoulicense::where('addon', '585')->firstOrFail()->license;\n $license = Http::get(\"https://api.bagou450.com/api/client/pterodactyl/checklicense?id=$transaction&name=585\");;\n $code = $license->status();\n $license = $license->object();\n if ($code !== 200) {\n $this->alert->danger('Error with the license key')->flash();\n return redirect()->route('admin.bagoulicense.license', 'cloudservers');\n } else {\n $eggs = Egg::get();\n $cloudservers = Server::where('cloud', true)->get();\n if(!$request->add_eggs) {\n $this->alert->danger(\n 'You need to have a least of one egg'\n )->flash();\n return view('admin.cloud.index', ['eggs' => $eggs, 'cloudservers' => $cloudservers,]);\n }\n Egg::where('cloud', true)->update(['cloud' => false]);\n foreach($request->add_eggs as $egg) {\n Egg::where('id', $egg)->update(['cloud' => true]);\n }\n $eggs = Egg::get();\n $locationselection = $request->locationselection;\n $nodeselection = $request->nodeselection;\n if($request->locationselection !== 'true' || $request->nodeselection === 'false') {\n if(Setting::where('key', 'cloud_nodeselect')->exists()) {\n Setting::where('key', 'cloud_nodeselect')->update(['value' => $request->nodeselection]);\n } else {\n $setting = new Setting;\n $setting->key = 'cloud_nodeselect';\n $setting->value = $request->nodeselection;\n $setting->save();\n }\n } else {\n $nodeselection = 'false';\n if(Setting::where('key', 'cloud_nodeselect')->exists()) {\n Setting::where('key', 'cloud_nodeselect')->update(['value' => 'false']);\n } else {\n $setting = new Setting;\n $setting->key = 'cloud_nodeselect';\n $setting->value = 'false';\n $setting->save();\n }\n }\n if($request->nodeselection !== 'true' || $request->locationselection === 'false') {\n\n if(Setting::where('key', 'cloud_locationselect')->exists()) {\n Setting::where('key', 'cloud_locationselect')->update(['value' => $request->locationselection]);\n } else {\n $setting = new Setting;\n $setting->key = 'cloud_locationselect';\n $setting->value = $request->locationselection;\n $setting->save();\n }\n } else {\n $locationselection = 'false';\n if(Setting::where('key', 'cloud_locationselect')->exists()) {\n Setting::where('key', 'cloud_locationselect')->update(['value' => 'false']);\n } else {\n $setting = new Setting;\n $setting->key = 'cloud_locationselect';\n $setting->value = 'false';\n $setting->save();\n }\n }\n $cloudnodes = Node::where('cloud', true)->get();\n $cloudlocations = Location::where('cloud', true)->get();\n\n $this->alert->success(trans('Settings updated sucessfully'))->flash();\n return view('admin.cloud.index', ['eggs' => $eggs, 'cloudservers' => $cloudservers, 'cloudnodes' => $cloudnodes, 'cloudlocations' => $cloudlocations, 'nodeselection' => $nodeselection, 'locationselection' => $locationselection]);\n }\n }\n}\n"
|
|
}
|
|
],
|
|
"./app/Http/Controllers/Admin/Cloud/UserController.php": [
|
|
{
|
|
"type": "newfile",
|
|
"theme": "any",
|
|
"add": "<?php\n\nnamespace Pterodactyl\\Http\\Controllers\\Admin\\Cloud;\n\nuse Illuminate\\Http\\Request;\nuse Pterodactyl\\Models\\User;\nuse Pterodactyl\\Models\\Server;\nuse Prologue\\Alerts\\AlertsMessageBag;\nuse Pterodactyl\\Http\\Controllers\\Controller;\nuse Pterodactyl\\Services\\Servers\\SuspensionService;\nuse Pterodactyl\\Models\\Bagoulicense;\nuse Illuminate\\Support\\Facades\\Http;\nuse Pterodactyl\\Services\\Servers\\ServerDeletionService;\n\nclass UserController extends Controller\n{\n\n /**\n * @var \\Pterodactyl\\Services\\Servers\\SuspensionService\n */\n protected $suspensionservice;\n /**\n * @var \\Pterodactyl\\Services\\Servers\\ServerDeletionService\n */\n protected $deletionService;\n\n /**\n * UserController constructor.\n */\n public function __construct(\n AlertsMessageBag $alert,\n SuspensionService $suspensionservice,\n ServerDeletionService $deletionService,\n\n ) {\n $this->alert = $alert;\n $this->suspensionservice = $suspensionservice;\n $this->deletionService = $deletionService;\n\n }\n\n /**\n * Suspend/Unsuspend Cloud user servers\n *\n * @return \\Illuminate\\View\\View\n */\n public function suspend(User $user)\n {\n $transaction = Bagoulicense::where('addon', '585')->firstOrFail()->license;\n $license = Http::get(\"https://api.bagou450.com/api/client/pterodactyl/checklicense?id=$transaction&name=585\");\n $code = $license->status();\n $license = $license->object();\n if ($code !== 200) {\n $this->alert->danger('Error with the license key')->flash();\n return redirect()->route('admin.bagoulicense.license', 'cloudservers');\n } else {\n $action = 'suspend';\n if($user->suspended) {\n $action = 'unsuspend';\n }\n $clousservers = Server::where('cloud', 1)->where('cloud_owner', $user->uuid)->get();\n foreach($clousservers as $server) {\n $this->suspensionservice->toggle(Server::where('id', $server->id)->firstOrFail(), $action);\n }\n User::where('uuid', $user->uuid)->update(['suspended' => !$user->suspended]);\n $this->alert->success('User suspended sucessfully')->flash();\n\n return redirect()->route('admin.users.view', $user->id);\n }\n}\n\n /**\n * Remove Cloud user\n *\n * @return \\Illuminate\\View\\View\n */\n public function removecloud(User $user)\n {\n $transaction = Bagoulicense::where('addon', '585')->firstOrFail()->license;\n $license = Http::get(\"https://api.bagou450.com/api/client/pterodactyl/checklicense?id=$transaction&name=585\");\n $code = $license->status();\n $license = $license->object();\n if ($code !== 200) {\n $this->alert->danger('Error with the license key')->flash();\n return redirect()->route('admin.bagoulicense.license', 'cloudservers');\n } else {\n\n $clousservers = Server::where('cloud', 1)->where('cloud_owner', $user->uuid)->get();\n foreach($clousservers as $server) {\n $this->deletionService->withForce(true)->handle(Server::where('id', $server->id)->firstOrFail());\n }\n User::where('uuid', $user->uuid)->update(['cloud' => !$user->cloud]);\n $this->alert->success('Cloud removed sucessfully')->flash();\n\n return redirect()->route('admin.users.view', $user->id);\n }\n}\n}\n"
|
|
}
|
|
],
|
|
"./app/Http/Controllers/Api/Application/Cloud/": [
|
|
{
|
|
"type": "folder"
|
|
}
|
|
],
|
|
"./app/Http/Controllers/Api/Application/Cloud/UserController.php": [
|
|
{
|
|
"type": "newfile",
|
|
"theme": "any",
|
|
"add": "<?php\n\nnamespace Pterodactyl\\Http\\Controllers\\Api\\Application\\Cloud;\n\nuse Pterodactyl\\Models\\User;\nuse Illuminate\\Http\\JsonResponse;\nuse Pterodactyl\\Http\\Controllers\\Api\\Application\\ApplicationApiController;\nuse Pterodactyl\\Models\\Server;\nuse Pterodactyl\\Services\\Servers\\SuspensionService;\nuse Pterodactyl\\Services\\Servers\\ServerDeletionService;\n\nclass UserController extends ApplicationApiController\n{\n\n /**\n * @var \\Pterodactyl\\Services\\Servers\\SuspensionService\n */\n protected $suspensionservice;\n /**\n * @var \\Pterodactyl\\Services\\Servers\\ServerDeletionService\n */\n protected $serverdeletionservice;\n /**\n * UserController constructor.\n */\n public function __construct(\n SuspensionService $suspensionservice,\n ServerDeletionService $serverdeletionservice,\n ) {\n parent::__construct();\n $this->suspensionservice = $suspensionservice;\n $this->serverdeletionservice = $serverdeletionservice;\n }\n /**\n * Suspend Cloud user servers\n *\n */\n public function suspend(User $user): JsonResponse\n {\n $action = 'suspend';\n if($user->suspended) {\n $action = 'unsuspend';\n }\n $userservers = $user->servers;\n $clousservers = Server::where('cloud', 1)->where('cloud_owner', $user->uuid)->get();\n foreach($userservers as $server) {\n $this->suspensionservice->toggle(Server::where('id', $server->id)->firstOrFail(), $action);\n }\n foreach($clousservers as $server) {\n $this->suspensionservice->toggle(Server::where('id', $server->id)->firstOrFail(), $action);\n }\n User::where('uuid', $user->uuid)->update(['suspended' => !$user->suspended]);\n\n return new JsonResponse([], JsonResponse::HTTP_NO_CONTENT);\n }\n\n /**\n * Terminate/Delete Cloud user servers\n *\n */\n public function terminate(User $user): JsonResponse\n {\n $userservers = $user->servers;\n $clousservers = Server::where('cloud', 1)->where('cloud_owner', $user->uuid)->get();\n foreach($clousservers as $server) {\n $this->serverdeletionservice->withForce(true)->handle($server);\n }\n User::where('uuid', $user->uuid)->update(['cloud' => false]);\n $cloudusers = User::where('subcloud', 1)->where('subcloud_owner', $user->id)->get();\n foreach($cloudusers as $user) {\n User::where('uuid', $user->uuid)->update(['subcloud' => 0]);\n }\n return new JsonResponse([], JsonResponse::HTTP_NO_CONTENT);\n }\n \n \n}"
|
|
}
|
|
],
|
|
"./app/Http/Controllers/Api/Client/Cloud/": [
|
|
{
|
|
"type": "folder"
|
|
}
|
|
],
|
|
"./app/Http/Controllers/Api/Client/Cloud/CloudController.php": [
|
|
{
|
|
"type": "newfile",
|
|
"theme": "any",
|
|
"add": "<?php\n\nnamespace Pterodactyl\\Http\\Controllers\\Api\\Client\\Cloud;\n\nuse Pterodactyl\\Models\\User;\nuse Pterodactyl\\Models\\Server;\nuse Pterodactyl\\Models\\Egg;\nuse Pterodactyl\\Models\\Node;\nuse Pterodactyl\\Models\\PanelName;\nuse Pterodactyl\\Models\\Permission;\nuse Spatie\\QueryBuilder\\QueryBuilder;\nuse Spatie\\QueryBuilder\\AllowedFilter;\nuse Pterodactyl\\Models\\Filters\\MultiFieldServerFilter;\nuse Pterodactyl\\Repositories\\Eloquent\\ServerRepository;\nuse Pterodactyl\\Transformers\\Api\\Client\\UserTransformer;\nuse Pterodactyl\\Http\\Requests\\Api\\Client\\GetServersRequest;\nuse Pterodactyl\\Http\\Controllers\\Api\\Client\\ClientApiController;\nuse Pterodactyl\\Services\\Servers\\ServerDeletionService;\nuse Illuminate\\Http\\Request;\nuse Pterodactyl\\Models\\Setting;\nuse Symfony\\Component\\HttpKernel\\Exception\\BadRequestHttpException;\nuse Pterodactyl\\Models\\Bagoulicense;\nuse Illuminate\\Support\\Facades\\Http;\nclass CloudController extends ClientApiController\n{\n /**\n * @var \\Pterodactyl\\Repositories\\Eloquent\\ServerRepository\n */\n private $repository;\n\n /**\n * ClientController constructor.\n */\n public function __construct(ServerRepository $repository)\n {\n parent::__construct();\n\n $this->repository = $repository;\n }\n\n public function infos(Request $request) {\n $transaction = Bagoulicense::where('addon', '585')->firstOrFail()->license;\n $license = Http::get(\"https://api.bagou450.com/api/client/pterodactyl/checklicense?id=$transaction&name=585\");\n $code = $license->status();\n $license = $license->object();\n if ($code !== 200) {\n throw new BadRequestHttpException('License error please contact a administrator.');\n } else {\n $user = $request->user();\n if(!$user->cloud) {\n\n throw new BadRequestHttpException('You are not a cloud user');\n }\n $eggs = Egg::where('cloud', true)->get();\n $users = User::where('uuid', $user->uuid)->get()->merge(User::where('subcloud', true)->where('subcloud_owner', $user->id)->get());\n $cloudservers = Server::where('cloud' ,true)->where('cloud_owner', $user->uuid)->get();\n $available = Array('ram' => $user->cloud_ram, 'disk' => $user->cloud_disk, 'cpu' => $user->cloud_cpu, 'backups' => $user->cloud_backup, 'databases' => $user->cloud_database, 'allocations' => $user->cloud_allocation);\n foreach($cloudservers as $cloudserver) {\n if($user->cloud_ram !== -1) {\n $available['ram'] -= $cloudserver->memory;\n }\n if($user->cloud_disk !== -1) {\n $available['disk'] -= $cloudserver->disk;\n }\n if($user->cloud_cpu !== -1) {\n $available['cpu'] -= $cloudserver->cpu;\n }\n if($user->cloud_backup !== -1) {\n $available['backups'] -= $cloudserver->backup_limit;\n }\n if($user->cloud_allocation !== -1) {\n $available['allocations'] -= $cloudserver->allocation_limit;\n }\n if($user->cloud_database !== -1) {\n $available['databases'] -= $cloudserver->database_limit;\n }\n }\n\n $nodeselection = Setting::where('key', 'cloud_nodeselect')->first();\n if(!$nodeselection) {\n $nodeselection = 'false';\n } else {\n $nodeselection = $nodeselection['value'];\n }\n $cloudnodes = Node::where('cloud', true)->get();\n return Array('eggs' => $eggs, 'users' => $users, 'available' => $available, 'nodeselection' => $nodeselection, 'nodes' => $cloudnodes);\n }\n }\n /**\n * Get panel name\n */\n public function cloudname(Request $request): Array\n {\n $owner = $request->user();\n $transaction = Bagoulicense::where('addon', '585')->firstOrFail()->license;\n $license = Http::get(\"https://api.bagou450.com/api/client/pterodactyl/checklicense?id=$transaction&name=585\");\n\n $code = $license->status();\n $license = $license->object();\n if ($code !== 200) {\n return ['name' => 'Pterodactyl', 'img' => '', 'footer' => '', 'footerlink' => ''];\n } else {\n if($request->owner == \"true\") {\n\n $name = PanelName::where('ownerid', $owner->subcloud_owner)->first();\n if(!$name) {\n return ['name' => '', 'img' => '', 'footer' => '', 'footerlink' => ''];\n }\n return ['name' => $name->name, 'img' => $name->img, 'footer' => $name->footer, 'footerlink' => $name->footerlink];\n }\n $name = PanelName::where('ownerid', $owner->id)->first();\n if(!$name) {\n return ['name' => '', 'img' => '', 'footer' => '', 'footerlink' => ''];\n }\n return ['name' => $name->name, 'img' => $name->img, 'footer' => $name->footer, 'footerlink' => $name->footerlink];\n }\n }\n}"
|
|
}
|
|
],
|
|
"./app/Http/Controllers/Api/Client/Cloud/CloudServersController.php": [
|
|
{
|
|
"type": "newfile",
|
|
"theme": "any",
|
|
"add": "<?php\n\nnamespace Pterodactyl\\Http\\Controllers\\Api\\Client\\Cloud;\n\nuse Pterodactyl\\Models\\User;\nuse Pterodactyl\\Models\\Egg;\nuse Pterodactyl\\Models\\Server;\nuse Pterodactyl\\Models\\Setting;\nuse Pterodactyl\\Models\\Node;\nuse Pterodactyl\\Models\\Permission;\nuse Pterodactyl\\Models\\EggVariable;\nuse Spatie\\QueryBuilder\\QueryBuilder;\nuse Spatie\\QueryBuilder\\AllowedFilter;\nuse Pterodactyl\\Models\\Filters\\MultiFieldServerFilter;\nuse Pterodactyl\\Repositories\\Eloquent\\ServerRepository;\nuse Pterodactyl\\Repositories\\Eloquent\\NodeRepository;\nuse Pterodactyl\\Transformers\\Api\\Client\\UserTransformer;\nuse Pterodactyl\\Http\\Requests\\Api\\Client\\GetServersRequest;\nuse Pterodactyl\\Http\\Controllers\\Api\\Client\\ClientApiController;\nuse Pterodactyl\\Services\\Servers\\ServerCreationService;\nuse Symfony\\Component\\HttpKernel\\Exception\\BadRequestHttpException;\nuse Pterodactyl\\Models\\Objects\\DeploymentObject;\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Http\\Request;\nuse Pterodactyl\\Services\\Servers\\ServerDeletionService;\nuse Pterodactyl\\Services\\Subusers\\SubuserCreationService;\nuse Pterodactyl\\Services\\Servers\\SuspensionService;\nuse Pterodactyl\\Models\\Bagoulicense;\nuse Illuminate\\Support\\Facades\\Http;\nclass CloudServersController extends ClientApiController\n{\n /**\n * @var \\Pterodactyl\\Repositories\\Eloquent\\ServerRepository\n */\n private $repository;\n /**\n * @var \\Pterodactyl\\Services\\Servers\\ServerCreationService\n */\n private $creationService;\n /**\n * @var \\Pterodactyl\\Services\\Servers\\ServerDeletionService\n */\n protected $deletionService;\n\n /**\n * @var \\Pterodactyl\\Services\\Subusers\\SubuserCreationService\n */\n protected $subuserCreationService;\n /**\n * @var \\Pterodactyl\\Services\\Servers\\SuspensionService\n */\n protected $suspensionService;\n\n /**\n * ClientController constructor.\n */\n public function __construct(ServerRepository $repository, NodeRepository $noderepository, ServerCreationService $creationService, ServerDeletionService $deletionService, SubuserCreationService $subuserCreationService, SuspensionService $suspensionService)\n {\n parent::__construct();\n\n $this->repository = $repository;\n $this->creationService = $creationService;\n $this->noderepository = $noderepository;\n $this->deletionService = $deletionService;\n $this->subuserCreationService = $subuserCreationService;\n $this->suspensionService = $suspensionService;\n }\n\n public function search(Request $request) {\n $transaction = Bagoulicense::where('addon', '585')->firstOrFail()->license;\n $license = Http::get(\"https://api.bagou450.com/api/client/pterodactyl/checklicense?id=$transaction&name=585\");\n $code = $license->status();\n $license = $license->object();\n if ($code !== 200) {\n throw new BadRequestHttpException('License error please contact a administrator.');\n } else {\n $serverid = $request->serverid;\n $user = $request->user();\n if(!$serverid) {\n throw new BadRequestHttpException('You need to enter a server external id!');\n }\n $found = Server::where('cloud_owner', $user->uuid)->where('cloud', 1)->where('external_id', $serverid)->firstOrFail();\n return $found;\n }\n }\n\n public function create(Request $request) {\n $transaction = Bagoulicense::where('addon', '585')->firstOrFail()->license;\n $license = Http::get(\"https://api.bagou450.com/api/client/pterodactyl/checklicense?id=$transaction&name=585\");\n $code = $license->status();\n $license = $license->object();\n if ($code !== 200) {\n throw new BadRequestHttpException('License error please contact a administrator.');\n } else {\n $owner = $request->user();\n $name = $request->name;\n $cpu = $request->cpu;\n $ram = $request->ram;\n $disk = $request->disk;\n $backups = $request->backups;\n $databases = $request->databases;\n $allocations = $request->allocations;\n $nodeid = $request->node;\n $eggid = $request->egg;\n $locationid = $request->location;\n $serverscount = Server::where('cloud' ,true)->where('cloud_owner', $owner->uuid)->count();\n\n $nestid = Egg::where('id', $eggid)->firstOrFail()->nest_id;\n $startup = Egg::where('id', $eggid)->firstOrFail()->startup;\n $docker = Egg::where('id', $eggid)->firstOrFail()->docker_images;\n $docker = $docker[array_key_first($docker)];\n $env = EggVariable::where('egg_id', '=', $eggid)->get();\n $nodeselection = Setting::where('key', 'cloud_nodeselect')->first();\n $locationselection = Setting::where('key', 'cloud_locationselect')->first();\n\n if(!$nodeselection) {\n $nodeselection = 'false';\n } else {\n $nodeselection = $nodeselection['value'];\n }\n if(!$locationselection) {\n $locationselection = 'false';\n } else {\n $locationselection = $locationselection['value'];\n }\n $environement = [];\n $cloudservers = Server::where('cloud' ,true)->where('cloud_owner', $owner->uuid)->get();\n $available = Array('ram' => $owner->cloud_ram, 'disk' => $owner->cloud_disk, 'cpu' => $owner->cloud_cpu, 'backups' => $owner->cloud_backup, 'databases' => $owner->cloud_database, 'allocations' => $owner->cloud_allocation);\n foreach($cloudservers as $cloudserver) {\n if($owner->cloud_ram !== -1) {\n $available['ram'] -= $cloudserver->memory;\n }\n if($owner->cloud_disk !== -1) {\n $available['disk'] -= $cloudserver->disk;\n }\n if($owner->cloud_cpu !== -1) {\n $available['cpu'] -= $cloudserver->cpu;\n }\n if($owner->cloud_backup !== -1) {\n $available['backups'] -= $cloudserver->backup_limit;\n }\n if($owner->cloud_allocation !== -1) {\n $available['allocations'] -= $cloudserver->allocation_limit;\n }\n if($owner->cloud_database !== -1) {\n $available['databases'] -= $cloudserver->database_limit;\n }\n }\n\n if(Node::where('cloud', true)->count() == 0) {\n throw new BadRequestHttpException('No node found please contact an administrator');\n }\n if(!$owner->cloud) {\n throw new BadRequestHttpException('You are not a cloud user');\n }\n\n if($ram > $available['ram']) {\n throw new BadRequestHttpException('You need more ram');\n }\n if($disk > $available['disk']) {\n throw new BadRequestHttpException('You need more disk');\n }\n if($cpu > $available['cpu']) {\n throw new BadRequestHttpException('You need more cpu');\n }\n if($backups > $available['backups']) {\n throw new BadRequestHttpException('You need more backups');\n }\n if($allocations > $available['allocations']) {\n throw new BadRequestHttpException('You need more allocations');\n }\n if($databases > $available['databases']) {\n throw new BadRequestHttpException('You need more databases');\n }\n if($serverscount >= $owner->cloud_servers ) {\n throw new BadRequestHttpException('You can\\'t create more servers');\n }\n \n if($nodeid && $nodeselection !== 'true') {\n throw new BadRequestHttpException('You can\\'t create a server on this node');\n }\n\n foreach ($env as $item) {\n $environement[$item->env_variable] = $item->default_value;\n }\n if($request->external) {\n $userid = $request->userid;\n } else {\n $userid = User::where('uuid', $request->userid)->firstOrFail()->id;\n }\n $data = Array(\n 'name' => $name,\n 'description' => '',\n 'status' => Server::STATUS_INSTALLING,\n 'owner_id' => $userid,\n 'memory' => $ram,\n 'swap' => 0,\n 'disk' => $disk,\n 'io' => 500,\n 'cpu' => $cpu,\n 'oom_disabled' => true,\n 'nest_id' => $nestid,\n 'egg_id' => $eggid,\n 'startup' => $startup,\n 'image' => $docker,\n 'database_limit' => $databases,\n 'allocation_limit' => $allocations,\n 'backup_limit' => $backups,\n 'environment' => $environement,\n 'start_on_completion' => true,\n );\n if($request->external) {\n $data['external_id'] = $request->external;\n }\n $object = new DeploymentObject();\n $object->setDedicated(false);\n $object->setPorts([]);\n $object->setCloud(true);\n $object->setNode(-1);\n if($nodeid) {\n $object->setNode($nodeid);\n } else if ($locationid) {\n $object->setLocations([$locationid]);\n }\n\n $server = $this->creationService->handle($data, $object);\n Server::where('id', $server->id)->update(['cloud' => true, 'cloud_owner' => $owner->uuid]);\n try {\n User::where('uuid', $request->owner)->update(['cloud_database' => $owner->cloud_database - $databases, 'cloud_allocation' => $owner->cloud_allocation - $allocations,'cloud_ram' => $owner->cloud_ram - $ram, 'cloud_disk' => $owner->cloud_disk - $disk, 'cloud_cpu' => $owner->cloud_cpu - $cpu, 'cloud_backup' => $owner->cloud_backup - $backups]);\n } catch(err) {\n $this->deletionService->withForce(true)->handle($server);\n throw new BadRequestHttpException('Error can\\'t remove ram');\n\n }\n if($userid !== $owner->id) {\n $permissions = [];\n foreach (Permission::permissions()->all() as $key => $perm) {\n foreach ($perm['keys'] as $subKey => $sub) {\n array_push($permissions, $key . '.' . $subKey);\n }\n }\n $this->subuserCreationService->handle($server, $owner->email, $permissions);\n }\n\n return new JsonResponse([], JsonResponse::HTTP_NO_CONTENT);\n }\n }\n /**\n * Remove a cloud server\n */\n public function delete(Request $request) {\n $transaction = Bagoulicense::where('addon', '585')->firstOrFail()->license;\n $license = Http::get(\"https://api.bagou450.com/api/client/pterodactyl/checklicense?id=$transaction&name=585\");\n $code = $license->status();\n $license = $license->object();\n if ($code !== 200) {\n throw new BadRequestHttpException('License error please contact a administrator.');\n } else {\n $server = Server::where('uuid', $request->serveruuid)->firstOrFail();\n $user = $request->user();\n\n if($user->uuid != $server->cloud_owner) {\n throw new BadRequestHttpException('You are not the owner');\n }\n\n $this->deletionService->withForce(true)->handle($server);\n\n return new JsonResponse([], JsonResponse::HTTP_NO_CONTENT);\n }\n \n }\n\n /**\n * Suspend a cloud server\n */\n public function suspend(Request $request) {\n $transaction = Bagoulicense::where('addon', '585')->firstOrFail()->license;\n $license = Http::get(\"https://api.bagou450.com/api/client/pterodactyl/checklicense?id=$transaction&name=585\");\n $code = $license->status();\n $license = $license->object();\n if ($code !== 200) {\n throw new BadRequestHttpException('License error please contact a administrator.');\n } else {\n $server = Server::where('uuid', $request->serveruuid)->firstOrFail();\n $user = $request->user();\n\n if($user->uuid != $server->cloud_owner) {\n throw new BadRequestHttpException('You are not the owner');\n }\n if($server->status === 'suspended') {\n $this->suspensionService->toggle($server, 'unsuspend');\n } else {\n $this->suspensionService->toggle($server, 'suspend');\n\n }\n\n return new JsonResponse([], JsonResponse::HTTP_NO_CONTENT);\n }\n\n }\n\n public function edit(Request $request, User $user) {\n $transaction = Bagoulicense::where('addon', '585')->firstOrFail()->license;\n $license = Http::get(\"https://api.bagou450.com/api/client/pterodactyl/checklicense?id=$transaction&name=585\");\n $code = $license->status();\n $license = $license->object();\n if ($code !== 200) {\n throw new BadRequestHttpException('License error please contact a administrator.');\n } else {\n $server = Server::where('uuid', $request->uuid)->firstOrFail();\n $name = $request->name;\n $cpu = $request->cpu;\n $ram = $request->ram;\n $disk = $request->disk;\n $backups = $request->backups;\n $databases = $request->databases;\n $allocations = $request->allocations;\n $location = $request->location ?? 1; // NEED TO CHANGE IT\n $userid = User::where('uuid', $request->userid)->firstOrFail()->id;\n $owner = $request->user();\n $eggid = $request->egg;\n $nestid = Egg::where('id', $eggid)->firstOrFail()->nest_id;\n $startup = Egg::where('id', $eggid)->firstOrFail()->startup;\n $docker = Egg::where('id', $eggid)->firstOrFail()->docker_images;\n $docker = $docker[array_key_first($docker)];\n $env = EggVariable::where('egg_id', '=', $eggid)->get();\n \n $environement = [];\n if($server->cloud_owner != $owner->uuid) {\n return throw new BadRequestHttpException('You are not the owner');\n }\n if($owner->cloud_ram+$server['memory'] < $ram) {\n return throw new BadRequestHttpException('You need more ram');\n }\n if($owner->cloud_disk+$server['disk'] < $disk) {\n return throw new BadRequestHttpException('You need more disk');\n }\n if($owner->cloud_cpu+$server['cpu'] < $cpu) {\n return throw new BadRequestHttpException('You need more cpu');\n }\n if($owner->cloud_backup+$server['backup_limit'] < $backups) {\n return throw new BadRequestHttpException('You need more backups');\n }\n if($owner->cloud_allocation+$server['allocation_limit'] < $allocations) {\n return throw new BadRequestHttpException('You need more allocations');\n }\n if($owner->cloud_database+$server['database_limit'] < $databases) {\n return throw new BadRequestHttpException('You need more databases');\n }\n \n foreach ($env as $item) {\n $environement[$item->env_variable] = $item->default_value;\n }\n $data = Array(\n 'name' => $name,\n 'owner_id' => $userid,\n 'memory' => $ram,\n 'disk' => $disk,\n 'cpu' => $cpu,\n 'nest_id' => $nestid,\n 'egg_id' => $eggid,\n 'startup' => $startup,\n 'image' => $docker,\n 'database_limit' => $databases,\n 'allocation_limit' => $allocations,\n 'backup_limit' => $backups,\n );\n\n try {\n User::where('uuid', $request->owner)->update(['cloud_database' => $owner->cloud_database + $server['database_limit'] - $databases, 'cloud_allocation' => $owner->cloud_allocation+$server['allocation_limit'] - $allocations,'cloud_ram' => $owner->cloud_ram +$server['memory']- $ram, 'cloud_disk' => $owner->cloud_disk +$server['disk']- $disk, 'cloud_cpu' => $owner->cloud_cpu +$server['cpu']- $cpu, 'cloud_backup' => $owner->cloud_backup+$server['backup_limit'] - $backups]);\n } catch(err) {\n $this->deletionService->withForce(true)->handle($server);\n return throw new BadRequestHttpException('Error can\\'t remove ram');\n\n }\n Server::where('uuid', $request->uuid)->update($data);\n Server::where('id', $server->id)->update(['cloud' => true, 'cloud_owner' => $owner->uuid]);\n\n return new JsonResponse([], JsonResponse::HTTP_NO_CONTENT);\n }\n }\n}\n"
|
|
}
|
|
],
|
|
"./app/Http/Controllers/Api/Client/Cloud/CloudSettingsController.php": [
|
|
{
|
|
"type": "newfile",
|
|
"theme": "any",
|
|
"add": "<?php\n\nnamespace Pterodactyl\\Http\\Controllers\\Api\\Client\\Cloud;\n\nuse Pterodactyl\\Models\\User;\nuse Pterodactyl\\Models\\Server;\nuse Pterodactyl\\Models\\Egg;\nuse Pterodactyl\\Models\\PanelName;\nuse Pterodactyl\\Models\\Permission;\nuse Spatie\\QueryBuilder\\QueryBuilder;\nuse Spatie\\QueryBuilder\\AllowedFilter;\nuse Pterodactyl\\Models\\Filters\\MultiFieldServerFilter;\nuse Pterodactyl\\Repositories\\Eloquent\\ServerRepository;\nuse Pterodactyl\\Transformers\\Api\\Client\\UserTransformer;\nuse Pterodactyl\\Http\\Requests\\Api\\Client\\GetServersRequest;\nuse Pterodactyl\\Http\\Controllers\\Api\\Client\\ClientApiController;\nuse Pterodactyl\\Services\\Servers\\ServerDeletionService;\nuse Illuminate\\Http\\Request;\nuse Illuminate\\Http\\JsonResponse;\nuse Pterodactyl\\Models\\Bagoulicense;\nuse Illuminate\\Support\\Facades\\Http;\nuse Symfony\\Component\\HttpKernel\\Exception\\BadRequestHttpException;\n\nclass CloudSettingsController extends ClientApiController\n{\n /**\n * @var \\Pterodactyl\\Repositories\\Eloquent\\ServerRepository\n */\n private $repository;\n\n /**\n * ClientController constructor.\n */\n public function __construct(ServerRepository $repository)\n {\n parent::__construct();\n\n $this->repository = $repository;\n }\n /**\n * Set panel name\n */\n public function setcloudname(Request $request)\n {\n $transaction = Bagoulicense::where('addon', '585')->firstOrFail()->license;\n $license = Http::get(\"https://api.bagou450.com/api/client/pterodactyl/checklicense?id=$transaction&name=585\");\n $code = $license->status();\n $license = $license->object();\n\n if ($code !== 200) {\n throw new BadRequestHttpException('License error please contact a administrator.');\n } else {\n $id = User::where('uuid', $request->owneruuid)->firstOrFail()->id;\n if(PanelName::where('ownerid', $id)->exists()) {\n PanelName::where('ownerid', $id)->update([\n 'name' => $request->name,\n 'img' => $request->img,\n 'footer' => $request->footer,\n 'footerlink' => $request->footerlink,\n ]);\n return new JsonResponse([], JsonResponse::HTTP_NO_CONTENT);;\n }\n $panelname = new PanelName;\n $panelname->ownerid = $id;\n $panelname->name = $request->name;\n $panelname->img = $request->img;\n $panelname->footer = $request->footer;\n $panelname->footerlink = $request->footerlink;\n $panelname->save();\n\n\n return new JsonResponse([], JsonResponse::HTTP_NO_CONTENT);\n }\n\n }\n}"
|
|
}
|
|
],
|
|
"./app/Http/Controllers/Api/Client/Cloud/CloudUserController.php": [
|
|
{
|
|
"type": "newfile",
|
|
"theme": "any",
|
|
"add": "<?php\n\nnamespace Pterodactyl\\Http\\Controllers\\Api\\Client\\Cloud;\n\nuse Pterodactyl\\Models\\User;\nuse Pterodactyl\\Models\\Server;\nuse Pterodactyl\\Models\\Egg;\nuse Pterodactyl\\Models\\Permission;\nuse Spatie\\QueryBuilder\\QueryBuilder;\nuse Spatie\\QueryBuilder\\AllowedFilter;\nuse Pterodactyl\\Models\\Filters\\MultiFieldServerFilter;\nuse Pterodactyl\\Repositories\\Eloquent\\ServerRepository;\nuse Pterodactyl\\Transformers\\Api\\Client\\UserTransformer;\nuse Pterodactyl\\Http\\Requests\\Api\\Client\\GetServersRequest;\nuse Pterodactyl\\Http\\Controllers\\Api\\Client\\ClientApiController;\nuse Pterodactyl\\Services\\Users\\UserCreationService;\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Http\\Request;\nuse Pterodactyl\\Services\\Users\\UserDeletionService;\nuse Symfony\\Component\\HttpKernel\\Exception\\BadRequestHttpException;\nuse Pterodactyl\\Services\\Users\\UserUpdateService;\nuse Pterodactyl\\Models\\Bagoulicense;\nuse Illuminate\\Support\\Facades\\Http;\nclass CloudUserController extends ClientApiController\n{\n /**\n * @var \\Pterodactyl\\Repositories\\Eloquent\\ServerRepository\n */\n private $repository;\n /**\n * @var \\Pterodactyl\\Services\\Users\\UserCreationService\n */\n protected $creationService;\n /**\n * @var \\Pterodactyl\\Services\\Users\\UserUpdateService\n */\n protected $updateService;\n /**\n * @var \\Pterodactyl\\Services\\Users\\UserDeletionService\n */\n \n protected $deletionService;\n /**\n * ClientController constructor.\n */\n public function __construct(\n ServerRepository $repository,\n UserCreationService $creationService, \n UserDeletionService $deletionService, \n UserUpdateService $updateService\n )\n {\n parent::__construct();\n\n $this->repository = $repository;\n $this->creationService = $creationService;\n $this->deletionService = $deletionService;\n $this->updateService = $updateService;\n }\n\n /**\n * Return all users linked to clouduser\n */\n public function index(Request $request): array\n {\n $transaction = Bagoulicense::where('addon', '585')->firstOrFail()->license;\n $license = Http::get(\"https://api.bagou450.com/api/client/pterodactyl/checklicense?id=$transaction&name=585\");\n $code = $license->status();\n $license = $license->object();\n if ($code !== 200) {\n throw new BadRequestHttpException('License error please contact a administrator.');\n } else {\n $user = $request->user();\n $transformer = $this->getTransformer(UserTransformer::class);\n\n // Start the query builder and ensure we eager load any requested relationships from the request.\n $builder = QueryBuilder::for(\n User::query()->with($this->getIncludesForTransformer($transformer))\n )->allowedFilters([\n 'cloud',\n ]);\n\n $builder = $builder->where('users.subcloud', true)->where('users.subcloud_owner', $user->id);\n\n\n $users = $builder->paginate(min($request->query('per_page', 50), 100))->appends($request->query());\n return $this->fractal->transformWith($transformer)->collection($users)->toArray();\n }\n }\n\n /**\n * Return user linked to clouduser\n\n */\n public function search(Request $request): array\n {\n $transaction = Bagoulicense::where('addon', '585')->firstOrFail()->license;\n $license = Http::get(\"https://api.bagou450.com/api/client/pterodactyl/checklicense?id=$transaction&name=585\");\n $code = $license->status();\n $license = $license->object();\n if ($code !== 200) {\n throw new BadRequestHttpException('License error please contact a administrator.');\n } else {\n $email = $request->email;\n $clouduser = $request->user();\n\n $user = User::where('users.subcloud', true)->where('users.subcloud_owner', $clouduser->id)->where('email', $email)->first();\n $first = true;\n if($user == null) {\n $user = User::where('email', $email)->first();\n $first = false;\n }\n if($user == null) {\n throw new BadRequestHttpException('No user');\n }\n return array('first' => $first, 'user' => $user);\n }\n }\n /**\n * Change the owner of the user\n */\n public function setowner(Request $request)\n {\n $transaction = Bagoulicense::where('addon', '585')->firstOrFail()->license;\n $license = Http::get(\"https://api.bagou450.com/api/client/pterodactyl/checklicense?id=$transaction&name=585\");\n $code = $license->status();\n $license = $license->object();\n if ($code !== 200) {\n throw new BadRequestHttpException('License error please contact a administrator.');\n } else {\n $email = $request->email;\n $clouduser = $request->user();\n $user = User::where('email', $email)->firstOrFail();\n if($user->subcloud) {\n throw new BadRequestHttpException('This user already have a owner!');\n }\n User::where('email', $email)->update(['subcloud' => 1, 'subcloud_owner' => $clouduser->id]);\n return new JsonResponse([], JsonResponse::HTTP_NO_CONTENT);\n }\n }\n /**\n * Create a user\n */\n public function create(Request $request)\n {\n $transaction = Bagoulicense::where('addon', '585')->firstOrFail()->license;\n $license = Http::get(\"https://api.bagou450.com/api/client/pterodactyl/checklicense?id=$transaction&name=585\");\n $code = $license->status();\n $license = $license->object();\n if ($code !== 200) {\n throw new BadRequestHttpException('License error please contact a administrator.');\n } else {\n $owner = $request->user();\n \n if(!$owner->cloud) {\n throw new BadRequestHttpException('You are not a cloud user');\n }\n \n $data = array(\n 'email' => $request->email,\n 'username' => $request->username,\n 'name_first' => $request->first,\n 'name_last' => $request->last,\n 'password' => $request->password,\n 'root_admin' => 0,\n 'language' => 'en',\n 'cloud' => 0,\n 'cloud_database' => 0,\n \"cloud_allocation\" => 0,\n \"cloud_backup\" => 0,\n \"cloud_cpu\" => 0,\n \"cloud_ram\" => 0,\n \"cloud_disk\" => 0,\n \"cloud_users\" => 0,\n \"cloud_servers\" => 0\n );\n $userscount = User::where('subcloud_owner', $owner->id)->where('subcloud', 1)->count();\n\n if($userscount >= $owner->cloud_users ) {\n throw new BadRequestHttpException('You can\\'t create more users');\n }\n $user = $this->creationService->handle($data);\n\n User::where('id', $user->id)->update(['subcloud' => true, 'subcloud_owner' => $owner->id]);\n if($request->whmcs) {\n return $user;\n }\n return new JsonResponse([], JsonResponse::HTTP_NO_CONTENT);\n }\n }\n\n /**\n * Remove user\n */\n public function delete(Request $request) {\n $transaction = Bagoulicense::where('addon', '585')->firstOrFail()->license;\n $license = Http::get(\"https://api.bagou450.com/api/client/pterodactyl/checklicense?id=$transaction&name=585\");\n $code = $license->status();\n $license = $license->object();\n if ($code !== 200) {\n throw new BadRequestHttpException('License error please contact a administrator.');\n } else {\n $owner = $request->user();\n $user = User::where('uuid', $request->useruuid)->firstOrFail();\n if($owner->id !== $user['subcloud_owner'] && $user['subcloud']) {\n throw new BadRequestHttpException('You are not the owner');\n }\n if(Server::where('owner_id', $user['id'])->exists()) {\n throw new BadRequestHttpException('Some servers are associated to this user please remove it before.');\n }\n $this->deletionService->handle($user);\n return new JsonResponse([], JsonResponse::HTTP_NO_CONTENT);\n }\n }\n\n /**\n * Edit a user\n */\n public function edit(Request $request)\n {\n $transaction = Bagoulicense::where('addon', '585')->firstOrFail()->license;\n $license = Http::get(\"https://api.bagou450.com/api/client/pterodactyl/checklicense?id=$transaction&name=585\");\n $code = $license->status();\n $license = $license->object();\n if ($code !== 200) {\n throw new BadRequestHttpException('License error please contact a administrator.');\n } else {\n $owner = $request->user();\n $user = User::where('uuid', $request->useruuid)->firstOrFail();\n if($owner->id !== $user['subcloud_owner'] && $user['subcloud']) {\n throw new BadRequestHttpException('You are not the owner');\n }\n $data = array(\n 'email' => $request->email,\n 'username' => $request->username,\n 'name_first' => $request->first,\n 'name_last' => $request->last,\n 'password' => $request->password,\n 'root_admin' => 0,\n 'language' => 'en',\n 'cloud' => 0,\n 'cloud_database' => 0,\n \"cloud_allocation\" => 0,\n \"cloud_backup\" => 0,\n \"cloud_cpu\" => 0,\n \"cloud_ram\" => 0,\n \"cloud_disk\" => 0,\n \"cloud_users\" => 0,\n \"cloud_servers\" => 0\n );\n $this->updateService\n ->handle($user, $data);\n\n return new JsonResponse([], JsonResponse::HTTP_NO_CONTENT);\n }\n }\n\n}"
|
|
}
|
|
],
|
|
"./app/Models/Bagoulicense.php": [
|
|
{
|
|
"type": "newfile",
|
|
"theme": "any",
|
|
"add": "<?php\n\nnamespace Pterodactyl\\Models;\n\n/**\n * @property int $id\n * @property string $uuid\n * @property int $nest_id\n * @property string $author\n * @property string $name\n * @property string|null $description\n * @property array|null $features\n * @property string $docker_image -- deprecated, use $docker_images\n * @property string $update_url\n * @property array<string, string> $docker_images\n * @property array|null $file_denylist\n * @property string|null $config_files\n * @property string|null $config_startup\n * @property string|null $config_logs\n * @property string|null $config_stop\n * @property int|null $config_from\n * @property string|null $startup\n * @property bool $script_is_privileged\n * @property string|null $script_install\n * @property string $script_entry\n * @property string $script_container\n * @property int|null $copy_script_from\n * @property \\Carbon\\Carbon $created_at\n * @property \\Carbon\\Carbon $updated_at\n * @property string|null $copy_script_install\n * @property string $copy_script_entry\n * @property string $copy_script_container\n * @property string|null $inherit_config_files\n * @property string|null $inherit_config_startup\n * @property string|null $inherit_config_logs\n * @property string|null $inherit_config_stop\n * @property string $inherit_file_denylist\n * @property array|null $inherit_features\n */\nclass BagouLicense extends Model\n{\n /**\n * The resource name for this model when it is transformed into an\n * API representation using fractal.\n */\n public const RESOURCE_NAME = 'BagouLicense';\n\n /**\n * Defines the current egg export version.\n */\n public const EXPORT_VERSION = 'PTDL_v2';\n\n /**\n * The table associated with the model.\n *\n * @var string\n */\n protected $table = 'bagoulicense';\n\n /**\n * Fields that are not mass assignable.\n *\n * @var array\n */\n protected $fillable = [\n 'addon',\n 'license',\n 'usage',\n 'maxusage',\n 'enabled'\n ];\n\n /**\n * Cast values to correct type.\n *\n * @var array\n */\n protected $casts = [\n 'addon' => 'string',\n 'license' => 'string',\n 'usage' => 'integer',\n 'maxusage' => 'integer',\n 'enabled' => 'boolean'\n ];\n\n /**\n * @var array\n */\n public static array $validationRules = [\n 'addon' => 'required|string',\n 'license' => 'required|string',\n ];\n\n}"
|
|
}
|
|
],
|
|
"./app/Models/PanelName.php": [
|
|
{
|
|
"type": "newfile",
|
|
"theme": "any",
|
|
"add": "<?php\n\nnamespace Pterodactyl\\Models;\n\nuse Illuminate\\Support\\Str;\nuse Symfony\\Component\\Yaml\\Yaml;\nuse Illuminate\\Container\\Container;\nuse Illuminate\\Notifications\\Notifiable;\nuse Illuminate\\Contracts\\Encryption\\Encrypter;\n\nclass PanelName extends Model\n{\n use Notifiable;\n\n /**\n * The resource name for this model when it is transformed into an\n * API representation using fractal.\n */\n public const RESOURCE_NAME = 'panelname';\n\n\n /**\n * The table associated with the model.\n *\n * @var string\n */\n protected $table = 'panelname';\n\n /**\n * The attributes excluded from the model's JSON form.\n *\n * @var array\n */\n protected $hidden = ['daemon_token_id', 'daemon_token'];\n\n /**\n * Cast values to correct type.\n *\n * @var array\n */\n protected $casts = [\n 'ownerid' => 'integer',\n 'name' => 'string',\n 'img' => 'string',\n 'footer' => 'string',\n 'footerlink' => 'string',\n ];\n\n /**\n * Fields that are mass assignable.\n *\n * @var array\n */\n protected $fillable = [\n 'ownerid', 'name', 'img', 'footer', 'footerlink'\n ];\n\n /**\n * @var array\n */\n public static array $validationRules = [\n 'ownerid' => 'required|integer|exists:users,id',\n 'name' => 'nullable|string',\n 'img' => 'nullable|string',\n 'footer' => 'nullable|string',\n 'footerlink' => 'nullable|string',\n ];\n\n /**\n * Default values for specific columns that are generally not changed on base installs.\n *\n * @var array\n */\n protected $attributes = [\n 'ownerid' => 0,\n 'name' => \"Pterodactyl\",\n 'img' => ','\n ];\n\n\n}"
|
|
}
|
|
],
|
|
"./database/migrations/2022_07_23_174610_add_cloud_to_users_table.php": [
|
|
{
|
|
"type": "newfile",
|
|
"theme": "any",
|
|
"add": "<?php\n\nuse Illuminate\\Database\\Migrations\\Migration;\nuse Illuminate\\Database\\Schema\\Blueprint;\nuse Illuminate\\Support\\Facades\\Schema;\n\nclass AddCloudToUsersTable extends Migration\n{\n /**\n * Run the migrations.\n *\n * @return void\n */\n public function up()\n {\n Schema::table('users', function (Blueprint $table) {\n $table->boolean('cloud')->default(false);\n $table->Biginteger('cloud_database')->default(0);\n $table->Biginteger('cloud_allocation')->default(0);\n $table->Biginteger('cloud_backup')->default(0);\n $table->Biginteger('cloud_cpu')->default(0);\n $table->Biginteger('cloud_ram')->default(0);\n $table->Biginteger('cloud_disk')->default(0);\n $table->Biginteger('cloud_users')->default(0);\n $table->Biginteger('cloud_servers')->default(0);\n $table->boolean('subcloud')->default(false);\n $table->integer('subcloud_owner')->default(0);\n\n });\n }\n\n /**\n * Reverse the migrations.\n *\n * @return void\n */\n public function down()\n {\n Schema::table('users', function (Blueprint $table) {\n $table->dropColumn('cloud');\n $table->dropColumn('cloud_database');\n $table->dropColumn('cloud_allocation');\n $table->dropColumn('cloud_backup');\n $table->dropColumn('cloud_cpu');\n $table->dropColumn('cloud_ram');\n $table->dropColumn('cloud_disk');\n $table->dropColumn('cloud_users');\n $table->dropColumn('cloud_servers');\n $table->dropColumn('subcloud');\n $table->dropColumn('subcloud_owner');\n });\n }\n}"
|
|
}
|
|
],
|
|
"./database/migrations/2022_07_23_174615_add_cloud_to_servers_table.php": [
|
|
{
|
|
"type": "newfile",
|
|
"theme": "any",
|
|
"add": "<?php\n\nuse Illuminate\\Database\\Migrations\\Migration;\nuse Illuminate\\Database\\Schema\\Blueprint;\nuse Illuminate\\Support\\Facades\\Schema;\n\nclass AddCloudToServersTable extends Migration\n{\n /**\n * Run the migrations.\n *\n * @return void\n */\n public function up()\n {\n Schema::table('servers', function (Blueprint $table) {\n $table->boolean('cloud');\n $table->char('cloud_owner', 36);\n });\n }\n\n /**\n * Reverse the migrations.\n *\n * @return void\n */\n public function down()\n {\n Schema::table('servers', function (Blueprint $table) {\n $table->dropColumn('cloud');\n $table->dropColumn('cloud_owner');\n\n });\n }\n}"
|
|
}
|
|
],
|
|
"./database/migrations/2022_07_23_225448_add_cloud_to_eggs_table.php": [
|
|
{
|
|
"type": "newfile",
|
|
"theme": "any",
|
|
"add": "<?php\n\nuse Illuminate\\Database\\Migrations\\Migration;\nuse Illuminate\\Database\\Schema\\Blueprint;\nuse Illuminate\\Support\\Facades\\Schema;\n\nclass AddCloudToEggsTable extends Migration\n{\n /**\n * Run the migrations.\n *\n * @return void\n */\n public function up()\n {\n Schema::table('eggs', function (Blueprint $table) {\n $table->boolean('cloud');\n });\n }\n\n /**\n * Reverse the migrations.\n *\n * @return void\n */\n public function down()\n {\n Schema::table('eggs', function (Blueprint $table) {\n $table->dropColumn('cloud');\n });\n }\n}"
|
|
}
|
|
],
|
|
"./database/migrations/2022_08_01_160357_create_panelname_table.php": [
|
|
{
|
|
"type": "newfile",
|
|
"theme": "any",
|
|
"add": "<?php\n\nuse Illuminate\\Database\\Migrations\\Migration;\nuse Illuminate\\Database\\Schema\\Blueprint;\nuse Illuminate\\Support\\Facades\\Schema;\n\nclass CreatePanelnameTable extends Migration\n{\n /**\n * Run the migrations.\n *\n * @return void\n */\n public function up()\n {\n Schema::create('panelname', function (Blueprint $table) {\n $table->id();\n $table->string('ownerid')->nullable();\n $table->string('name')->nullable();\n $table->timestamps();\n });\n }\n\n /**\n * Reverse the migrations.\n *\n * @return void\n */\n public function down()\n {\n Schema::dropIfExists('panelname');\n }\n}"
|
|
}
|
|
],
|
|
"./database/migrations/2022_08_04_165351_add_img_to_panelname_table.php": [
|
|
{
|
|
"type": "newfile",
|
|
"theme": "any",
|
|
"add": "<?php\n\nuse Illuminate\\Database\\Migrations\\Migration;\nuse Illuminate\\Database\\Schema\\Blueprint;\nuse Illuminate\\Support\\Facades\\Schema;\n\nclass AddImgToPanelnameTable extends Migration\n{\n /**\n * Run the migrations.\n *\n * @return void\n */\n public function up()\n {\n Schema::table('panelname', function (Blueprint $table) {\n $table->string('img')->nullable();\n });\n }\n\n /**\n * Reverse the migrations.\n *\n * @return void\n */\n public function down()\n {\n Schema::table('panelname', function (Blueprint $table) {\n $table->dropCollum('img');\n });\n }\n}"
|
|
}
|
|
],
|
|
"./database/migrations/2022_08_05_175146_add_cloud_to_nodes.php": [
|
|
{
|
|
"type": "newfile",
|
|
"theme": "any",
|
|
"add": "<?php\n\nuse Illuminate\\Database\\Migrations\\Migration;\nuse Illuminate\\Database\\Schema\\Blueprint;\nuse Illuminate\\Support\\Facades\\Schema;\n\nclass AddCloudToNodes extends Migration\n{\n /**\n * Run the migrations.\n *\n * @return void\n */\n public function up()\n {\n Schema::table('nodes', function (Blueprint $table) {\n $table->boolean('cloud')->default(1);\n });\n }\n\n /**\n * Reverse the migrations.\n *\n * @return void\n */\n public function down()\n {\n Schema::table('nodes', function (Blueprint $table) {\n $table->dropCollum('cloud');\n });\n }\n}"
|
|
}
|
|
],
|
|
"./database/migrations/2022_08_08_093731_add_footer_to_panelname_table.php": [
|
|
{
|
|
"type": "newfile",
|
|
"theme": "any",
|
|
"add": "<?php\n\nuse Illuminate\\Database\\Migrations\\Migration;\nuse Illuminate\\Database\\Schema\\Blueprint;\nuse Illuminate\\Support\\Facades\\Schema;\n\nclass AddFooterToPanelnameTable extends Migration\n{\n /**\n * Run the migrations.\n *\n * @return void\n */\n public function up()\n {\n Schema::table('panelname', function (Blueprint $table) {\n $table->string('footer')->nullable();\n $table->string('footerlink')->nullable();\n });\n }\n\n /**\n * Reverse the migrations.\n *\n * @return void\n */\n public function down()\n {\n Schema::table('panelname', function (Blueprint $table) {\n $table->dropColumn('footer');\n $table->dropColumn('footerlink');\n });\n }\n}"
|
|
}
|
|
],
|
|
"./database/migrations/2022_08_08_222313_add_suspended_to_users_table.php": [
|
|
{
|
|
"type": "newfile",
|
|
"theme": "any",
|
|
"add": "<?php\n\nuse Illuminate\\Database\\Migrations\\Migration;\nuse Illuminate\\Database\\Schema\\Blueprint;\nuse Illuminate\\Support\\Facades\\Schema;\n\nclass AddSuspendedToUsersTable extends Migration\n{\n /**\n * Run the migrations.\n *\n * @return void\n */\n public function up()\n {\n Schema::table('users', function (Blueprint $table) {\n $table->boolean('suspended')->default(false);\n });\n }\n\n /**\n * Reverse the migrations.\n *\n * @return void\n */\n public function down()\n {\n Schema::table('users', function (Blueprint $table) {\n $table->dropColumn('suspended');\n });\n }\n}"
|
|
}
|
|
],
|
|
"./database/migrations/2022_08_30_145059_add_cloud_to_locations_table.php": [
|
|
{
|
|
"type": "newfile",
|
|
"theme": "any",
|
|
"add": "<?php\n\nuse Illuminate\\Database\\Migrations\\Migration;\nuse Illuminate\\Database\\Schema\\Blueprint;\nuse Illuminate\\Support\\Facades\\Schema;\n\nclass AddCloudToLocationsTable extends Migration\n{\n /**\n * Run the migrations.\n *\n * @return void\n */\n public function up()\n {\n Schema::table('locations', function (Blueprint $table) {\n $table->boolean('cloud')->default(true);\n });\n }\n\n /**\n * Reverse the migrations.\n *\n * @return void\n */\n public function down()\n {\n Schema::table('locations', function (Blueprint $table) {\n $table->dropColumn('cloud');\n });\n }\n}\n"
|
|
}
|
|
],
|
|
"./app/Http/Requests/Api/Application/Users/StoreUserRequest.php": [
|
|
{
|
|
"type": "under",
|
|
"theme": "any",
|
|
"add": " 'cloud',\n 'cloud_database',\n 'cloud_allocation',\n 'cloud_backup',\n 'cloud_cpu',\n 'cloud_ram',\n 'cloud_disk',\n 'cloud_users',\n 'cloud_servers',",
|
|
"where": "'root_admin',"
|
|
}
|
|
],
|
|
"./app/Http/Controllers/Admin/UserController.php": [
|
|
{
|
|
"type": "under",
|
|
"theme": "any",
|
|
"add": "use Pterodactyl\\Services\\Servers\\ServerDeletionService;",
|
|
"where": "use Pterodactyl\\Contracts\\Repository\\UserRepositoryInterface;"
|
|
},
|
|
{
|
|
"type": "under",
|
|
"theme": "any",
|
|
"add": " /**\n * @var \\Pterodactyl\\Services\\Servers\\ServerDeletionService\n */\n protected $serverdeletionservice;",
|
|
"where": "protected $updateService;"
|
|
},
|
|
{
|
|
"type": "replace",
|
|
"theme": "any",
|
|
"add": " UserRepositoryInterface $repository,\n ServerDeletionService $serverdeletionservice,",
|
|
"where": "UserRepositoryInterface $repository"
|
|
},
|
|
{
|
|
"type": "under",
|
|
"theme": "any",
|
|
"add": " $this->serverdeletionservice = $serverdeletionservice;",
|
|
"where": "$this->updateService = $updateService;"
|
|
},
|
|
{
|
|
"type": "above",
|
|
"theme": "any",
|
|
"add": " $userservers = $user->servers;\n $clousservers = Server::where('cloud', 1)->where('cloud_owner', $user->uuid)->get();\n foreach($userservers as $server) {\n $this->serverdeletionservice->withForce(true)->handle($server);\n }\n foreach($clousservers as $server) {\n $this->serverdeletionservice->withForce(true)->handle($server);\n }\n $cloudusers = User::where('subcloud', 1)->where('subcloud_owner', $user->id)->get();\n foreach($cloudusers as $user) {\n User::where('uuid', $user->uuid)->update(['subcloud' => 0]);\n }",
|
|
"where": "$this->deletionService->handle($user);"
|
|
}
|
|
],
|
|
"./app/Models/Node.php": [
|
|
{
|
|
"type": "under",
|
|
"theme": "any",
|
|
"add": " 'cloud' => 'boolean',",
|
|
"where": "'maintenance_mode' => 'boolean',"
|
|
},
|
|
{
|
|
"type": "under",
|
|
"theme": "any",
|
|
"add": " 'cloud' => 'boolean',",
|
|
"where": "'upload_size' => 'int|between:1,1024',"
|
|
},
|
|
{
|
|
"type": "under",
|
|
"theme": "any",
|
|
"add": " 'cloud',",
|
|
"where": "'description', 'maintenance_mode',"
|
|
}
|
|
],
|
|
"./app/Http/Controllers/Api/Client/ClientController.php": [
|
|
{
|
|
"type": "replace",
|
|
"theme": "any",
|
|
"add": " } elseif ($type === 'cloud') {\n $builder = $builder->where('servers.cloud_owner', $user->uuid)->where('servers.cloud', true);\n } else {\n $builder = $builder->whereIn('servers.id', $user->accessibleServers()->pluck('id')->all());\n }",
|
|
"where": " } else {\n $builder = $builder->whereIn('servers.id', $user->accessibleServers()->pluck('id')->all());\n }"
|
|
}
|
|
],
|
|
"./app/Models/Objects/DeploymentObject.php": [
|
|
{
|
|
"type": "under",
|
|
"theme": "any",
|
|
"add": " public function getCloud(): bool\n {\n if($this->cloud) {\n return true;\n }\n return false;\n }\n\n /**\n * @return $this\n */\n public function setCloud(bool $cloud)\n {\n $this->cloud = $cloud;\n\n return $this;\n }\n /**\n * @return $this\n */\n public function setNode(int $node)\n {\n $this->node = $node;\n\n return $this;\n }\n\n public function getNode(): int\n {\n return $this->node;\n }",
|
|
"where": " return $this;\n }" }
|
|
],
|
|
"./app/Services/Servers/ServerCreationService.php": [
|
|
{
|
|
"type": "under",
|
|
"theme": "any",
|
|
"add": " ->setCloud($deployment->getCloud())\n ->setNode($deployment->getNode())",
|
|
"where": ">setMemory(Arr::get($data, 'memory'))"
|
|
}
|
|
],
|
|
"./app/Services/Deployment/FindViableNodesService.php": [
|
|
{
|
|
"type": "under",
|
|
"theme": "any",
|
|
"add": " /**Add cloud */\n\n public function setCloud(bool $cloud): self \n {\n $this->cloud = $cloud;\n return $this;\n }\n public function setNode(int $node): self \n {\n $this->node = $node;\n return $this;\n } ",
|
|
"where": " /**\n * Set the amount of memory that this server will be using. As with disk space, nodes that\n * do not have enough free memory will be filtered out.\n *\n * @return $this\n */\n public function setMemory(int $memory): self\n {\n $this->memory = $memory;\n\n return $this;\n }"
|
|
},
|
|
{
|
|
"type": "under",
|
|
"theme": "any",
|
|
"add": " if($this->cloud) {\n $query = $query->where('nodes.cloud', true);\n }\n if($this->node != -1) {\n $query = $query->where('nodes.id', $this->node);\n }",
|
|
"where": "->where('nodes.public', 1);"
|
|
}
|
|
],
|
|
"./app/Models/User.php": [
|
|
{
|
|
"type": "under",
|
|
"theme": "any",
|
|
"add": " 'cloud',\n 'cloud_database',\n 'cloud_allocation',\n 'cloud_backup',\n 'cloud_cpu',\n 'cloud_ram',\n 'cloud_disk',\n 'cloud_users',\n 'cloud_servers',\n 'subcloud',\n 'subcloud_owner',\n 'suspended'",
|
|
"where": "'root_admin',"
|
|
},
|
|
{
|
|
"type": "under",
|
|
"theme": "any",
|
|
"add": " 'cloud' => false,\n 'subcloud' => false,\n 'suspended' => false,",
|
|
"where": "'totp_secret' => null,"
|
|
},
|
|
{
|
|
"type": "under",
|
|
"theme": "any",
|
|
"add": " 'cloud' => 'boolean',\n 'cloud_database' => 'sometimes|nullable|numeric',\n 'cloud_allocation' => 'sometimes|nullable|numeric',\n 'cloud_backup' => 'sometimes|nullable|numeric',\n 'cloud_cpu' => 'sometimes|nullable|numeric',\n 'cloud_ram' => 'sometimes|nullable|numeric',\n 'cloud_disk' => 'sometimes|nullable|numeric',\n 'cloud_users' => 'sometimes|nullable|numeric',\n 'cloud_servers' => 'sometimes|nullable|numeric',\n 'subcloud' => 'sometimes|boolean',\n 'subcloud_owner' => 'sometimes|nullable|numeric',\n 'suspended' => 'boolean',",
|
|
"where": " 'totp_secret' => 'nullable|string',"
|
|
},
|
|
{
|
|
"type": "under",
|
|
"theme": "any",
|
|
"add": " $builder->where('servers.owner_id', $this->id)->orWhere('subusers.user_id', $this->id)->orWhere('cloud_owner', $this->id)->where('cloud', true);",
|
|
"where": "$builder->where('servers.owner_id', $this->id)->orWhere('subusers.user_id', $this->id);"
|
|
}
|
|
],
|
|
"./resources/views/admin/users/view.blade.php": [
|
|
{
|
|
"type": "above",
|
|
"theme": "any",
|
|
"add": " @if ($user->cloud)\n <div class=\"col-xs-12\">\n <div class=\"box {{ $user->suspended ? 'box-success' : 'box-warning '}}\">\n <div class=\"box-header with-border\">\n <h3 class=\"box-title\">{{ $user->suspended ? 'Unsuspend Cloud User' : 'Suspend Cloud User'}}</h3>\n </div>\n <div class=\"box-body\">\n <p class=\"no-margin\">All servers of the users are going to be {{ $user->suspended ? 'unsuspended' : 'suspended'}} same for linked cloud servers.</p>\n </div>\n <div class=\"box-footer\">\n <form action=\"{{ route('admin.users.cloud.suspend', $user->id) }}\" method=\"POST\">\n {!! csrf_field() !!}\n {!! method_field('POST') !!}\n <input type=\"submit\" class=\"btn btn-sm {{ $user->suspended ? 'btn-success' : 'btn-warning '}} pull-right\" value=\"{{ $user->suspended ? 'Unsuspend Cloud User' : 'Suspend Cloud User'}}\" />\n </form>\n </div>\n </div>\n </div>\n @endif",
|
|
"where": "<div class=\"col-xs-12\">"
|
|
},
|
|
{
|
|
"type": "above",
|
|
"theme": "any",
|
|
"add": "<h3 class=\"box-title\">Password</h3>" ,
|
|
"where": " <h3 class=\"box-title\">Cloud (set 0 for unlimited)</h3>\n </div>\n <div class=\"box-body\">\n <div class=\"form-group\">\n <label for=\"cloud\" class=\"control-label\">Cloud user</label>\n \n <div>\n <select name=\"cloud\" class=\"form-control\">\n <option value=\"0\">@lang('strings.no')</option>\n <option value=\"1\" {{ $user->cloud ? 'selected=\"selected\"' : '' }}>@lang('strings.yes')</option>\n </select>\n <p class=\"text-muted\"><small>Setting this to 'Yes' gives a user cloud access.</small></p>\n </div>\n </div>\n <div class=\"form-group col-xs-4 \">\n <label for=\"cloud_database\" class=\"control-label\">Databases</label>\n <div>\n <input type=\"text\" name=\"cloud_database\" class=\"form-control\" value=\"{{ old('cloud_database', $user->cloud_database) }}\"/>\n <p class=\"text-muted\"><small>The number of database that user can allocate to their server.</small></p>\n </div>\n </div>\n <div class=\"form-group col-xs-4 \">\n <label for=\"cloud_allocation\" class=\"control-label\">Allocations</label>\n <div>\n <input type=\"text\" name=\"cloud_allocation\" class=\"form-control\" value=\"{{ old('cloud_allocation', $user->cloud_allocation) }}\"/>\n <p class=\"text-muted\"><small>The number of allocations that user can allocate to their server.</small></p>\n </div>\n </div>\n <div class=\"form-group col-xs-4 \">\n <label for=\"cloud_backup\" class=\"control-label\">Backup</label>\n <div>\n <input type=\"text\" name=\"cloud_backup\" class=\"form-control\" value=\"{{ old('cloud_backup', $user->cloud_backup) }}\"/>\n <p class=\"text-muted\"><small>The number of backups that user can allocate to their server.</small></p>\n </div>\n </div>\n <div class=\"form-group col-xs-4 \">\n <label for=\"cloud_cpu\" class=\"control-label\">Cpu</label>\n <div>\n <div class=\"input-group\">\n <input type=\"text\" name=\"cloud_cpu\" class=\"form-control\" value=\"{{ old('cloud_cpu', $user->cloud_cpu) }}\"/>\n <span class=\"input-group-addon\">%</span>\n </div>\n <p class=\"text-muted\"><small>The cpu that user can allocate to their server.</small></p>\n </div>\n </div>\n <div class=\"form-group col-xs-4 \">\n <label for=\"cloud_ram\" class=\"control-label\">Ram</label>\n <div>\n <div class=\"input-group\">\n <input type=\"text\" name=\"cloud_ram\" class=\"form-control\" value=\"{{ old('cloud_ram', $user->cloud_ram) }}\"/>\n <span class=\"input-group-addon\">MB</span>\n </div>\n <p class=\"text-muted\"><small>The ram that user can allocate to their server.</small></p>\n </div>\n </div>\n <div class=\"form-group col-xs-4 \">\n <label for=\"cloud_disk\" class=\"control-label\">Disk</label>\n <div>\n <div class=\"input-group\">\n <input type=\"text\" name=\"cloud_disk\" class=\"form-control\" value=\"{{ old('cloud_disk', $user->cloud_disk) }}\"/>\n <span class=\"input-group-addon\">MB</span>\n </div>\n <p class=\"text-muted\"><small>The disk that user can allocate to their server.</small></p>\n </div>\n </div>\n <div class=\"form-group col-xs-6 \">\n <label for=\"cloud_users\" class=\"control-label\">Users</label>\n <div>\n <input type=\"text\" name=\"cloud_users\" class=\"form-control\" value=\"{{ old('cloud_users', $user->cloud_users) }}\"/>\n <p class=\"text-muted\"><small>The number of users that user can create.</small></p>\n </div>\n </div>\n <div class=\"form-group col-xs-6 \">\n <label for=\"cloud_servers\" class=\"control-label\">Servers</label>\n <div>\n <input type=\"text\" name=\"cloud_servers\" class=\"form-control\" value=\"{{ old('cloud_servers', $user->cloud_servers) }}\"/>\n <p class=\"text-muted\"><small>The number of servers that user can create.</small></p>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"col-md-6\">\n <div class=\"box\">\n <div class=\"box-header with-border\">"
|
|
}
|
|
],
|
|
"./resources/views/admin/nodes/index.blade.php": [
|
|
{
|
|
"type": "replace",
|
|
"theme": "any",
|
|
"add": " <td>{!! $node->maintenance_mode ? '<span class=\"label label-warning\"><i class=\"fa fa-wrench\"></i></span> ' : '' !!} <a href=\"{{ route('admin.nodes.view', $node->id) }}\">{{ $node->name }}</a> {!! $node->cloud ? '<i class=\"fa fa-cloud\"></i> ' : '' !!} </td>,",
|
|
"where": " <td>{!! $node->maintenance_mode ? '<span class=\"label label-warning\"><i class=\"fa fa-wrench\"></i></span> ' : '' !!}<a href=\"{{ route('admin.nodes.view', $node->id) }}\">{{ $node->name }}</a></td>"
|
|
}
|
|
],
|
|
"./resources/views/admin/nodes/view/index.blade.php": [
|
|
{
|
|
"type": "replace",
|
|
"theme": "any",
|
|
"add": " <div class=\"col-sm-12\">\n <div class=\"info-box bg-blue\">\n <span class=\"info-box-icon\"><i class=\"ion ion-social-buffer-outline\"></i></span>\n <div class=\"info-box-content\" style=\"padding: 23px 10px 0;\">\n <span class=\"info-box-text\">Total Servers</span>\n <span class=\"info-box-number\">{{ $node->servers_count }}</span>\n </div>\n </div>\n </div>",
|
|
"where": " <div class=\"col-sm-12\">\n <div class=\"info-box bg-blue\">\n <span class=\"info-box-icon\"><i class=\"ion ion-social-buffer-outline\"></i></span>\n <div class=\"info-box-content\" style=\"padding: 23px 10px 0;\">\n <span class=\"info-box-text\">Total Servers</span>\n <span class=\"info-box-number\">{{ $node->servers_count }}</span>\n </div>\n </div>\n </div>"
|
|
}
|
|
],
|
|
"./resources/views/layouts/admin.blade.php": [
|
|
{
|
|
"type": "above",
|
|
"theme": "any",
|
|
"add": " <li class=\"{{ ! starts_with(Route::currentRouteName(), 'admin.cloud') ?: 'active' }}\">\n <a href=\"{{ route('admin.cloud.index')}}\">\n <i class=\"fa fa-cloud\"></i> <span>Cloud Servers</span>\n </a>\n </li>",
|
|
"where": "<li class=\"header\">MANAGEMENT</li>"
|
|
}
|
|
],
|
|
"./resources/views/admin/nodes/view/settings.blade.php": [
|
|
{
|
|
"type": "above",
|
|
"theme": "any",
|
|
"add": "<div class=\"form-group col-xs-12\">\n <label class=\"form-label\"><span class=\"label label-warning\"><i class=\"fa fa-cloud\"></i></span> Cloud servers</label>\n <div>\n <div class=\"radio radio-success radio-inline\">\n <input type=\"radio\" id=\"pCloudFalse\" value=\"0\" name=\"cloud\" {{ (old('cloud', $node->cloud) == false) ? 'checked' : '' }}>\n <label for=\"pCloudFalse\"> Disabled</label>\n </div>\n <div class=\"radio radio-info radio-inline\">\n <input type=\"radio\" id=\"pCloudTrue\" value=\"1\" name=\"cloud\" {{ (old('cloud', $node->cloud) == true) ? 'checked' : '' }}>\n <label for=\"pCloudTrue\"> Enabled</label>\n </div>\n </div>\n <p class=\"text-muted small\">If the node is marked as 'Cloud' server from cloud addons are going to be created on it (you can allow cloud to multiple nodes).</p>\n </div>",
|
|
"where": " <p class=\"text-muted small\">If the node is marked as 'Under Maintenance' users won't be able to access servers that are on this node.</p>\n </div>"
|
|
}
|
|
],
|
|
"./resources/scripts/components/App.tsx": [
|
|
{
|
|
"type": "under",
|
|
"theme": "any",
|
|
"add": "import CloudRouter from '@/routers/CloudRouter';\nimport CloudRoute from './elements/CloudRoute';",
|
|
"where": "import Spinner from '@/components/elements/Spinner';"
|
|
},
|
|
{
|
|
"type": "after",
|
|
"theme": "any",
|
|
"add": " cloud: boolean;\n cloud_database: number;\n cloud_allocation: number;\n cloud_backup: number;\n cloud_cpu: number;\n cloud_ram: number;\n cloud_disk: number;\n cloud_users: number;\n cloud_servers: number;\n subcloud_owner: string;\n subcloud: string;",
|
|
"where": "created_at: string;"
|
|
},
|
|
{
|
|
"type": "after",
|
|
"theme": "any",
|
|
"add": " cloud: PterodactylUser.cloud,\n cloud_database: PterodactylUser.cloud_database,\n cloud_allocation: PterodactylUser.cloud_allocation,\n cloud_backup: PterodactylUser.cloud_backup,\n cloud_cpu: PterodactylUser.cloud_cpu,\n cloud_ram: PterodactylUser.cloud_ram,\n cloud_disk: PterodactylUser.cloud_disk,\n cloud_users: PterodactylUser.cloud_users,\n cloud_servers: PterodactylUser.cloud_servers,\n subcloud: PterodactylUser.subcloud,\n subcloud_owner: PterodactylUser.subcloud_owner,",
|
|
"where": " updatedAt: new Date(PterodactylUser.updated_at),"
|
|
},
|
|
{
|
|
"type": "above",
|
|
"theme": "any",
|
|
"add": " <CloudRoute path={'/cloud'}>\n <Spinner.Suspense>\n <CloudRouter />\n </Spinner.Suspense>\n </CloudRoute>",
|
|
"where": "<AuthenticatedRoute path={'/'}>"
|
|
}
|
|
],
|
|
"./resources/scripts/components/NavigationBar.tsx": [
|
|
{
|
|
"type": "under",
|
|
"theme": "any",
|
|
"add": "import useSWR from 'swr';\nimport cloudName, { CloudName } from '@/api/cloud/cloudName';",
|
|
"where": "import Avatar from '@/components/Avatar';"
|
|
},
|
|
{
|
|
"type": "under",
|
|
"theme": "any",
|
|
"add": " const cloud = useStoreState((state: ApplicationStore) => state.user.data!.cloud);\n const uuid = useStoreState((state: ApplicationStore) => state.user.data!.uuid);\n const subcloud = useStoreState((state: ApplicationStore) => state.user.data!.subcloud);\n const subcloud_owner = useStoreState((state: ApplicationStore) => state.user.data?.subcloud_owner);\n const { data, error } = useSWR<CloudName>(\n ['/cloud/cloudname'],\n () => cloudName(subcloud_owner ? subcloud_owner : cloud ? uuid : '', subcloud ? true : false),\n {\n revalidateOnFocus: false,\n }\n );\n React.useEffect(() => {\n if (error) {\n console.log(error);\n }\n }, [error]);",
|
|
"where": "const [isLoggingOut, setIsLoggingOut] = useState(false);"
|
|
},
|
|
{
|
|
"type": "replace",
|
|
"theme": "any",
|
|
"add": " <>\n {(subcloud || cloud) && !data ? (\n <div css={tw`w-full`}>\n <SpinnerOverlay visible={true} />\n </div>\n ) : (\n <div className={'w-full bg-neutral-900 shadow-md overflow-x-auto'}>",
|
|
"where": "<div className={'w-full bg-neutral-900 shadow-md overflow-x-auto'}>"
|
|
},
|
|
{
|
|
"type": "replace",
|
|
"theme": "any",
|
|
"add": " <Link\n to={'/'}\n className={\n 'text-2xl font-header px-4 no-underline text-neutral-200 hover:text-neutral-100 transition-colors duration-150 flex'\n }\n >\n {((subcloud || cloud) && data?.name !== '' && data?.name) || (data?.img && data?.img !== '') ? (\n <>\n <img src={data?.img} className='h-12 mr-2 my-auto' />\n <span className='my-auto flex'> {data?.name}</span>\n </>\n ) : (\n name\n )}\n </Link>",
|
|
"where": " <Link\n to={'/'}\n className={\n 'text-2xl font-header px-4 no-underline text-neutral-200 hover:text-neutral-100 transition-colors duration-150'\n }\n >\n {name}\n </Link>"
|
|
},
|
|
{
|
|
"type": "above",
|
|
"theme": "any",
|
|
"add": "{cloud && (\n <Tooltip placement={'bottom'} content={'Cloud'}>\n <NavLink to={'/cloud/'}>\n <FontAwesomeIcon icon={faCloud} />\n </NavLink>\n </Tooltip>\n )}\n",
|
|
"where": "<Tooltip placement={'bottom'} content={'Account Settings'}>"
|
|
},
|
|
{
|
|
"type": "under",
|
|
"theme": "any",
|
|
"add": " )}\n </>",
|
|
"where": " </button>\n </Tooltip>\n </RightNavigation>\n </div>\n </div>"
|
|
},
|
|
{
|
|
"type": "replace",
|
|
"theme": "any",
|
|
"add": "import { faCloud, faCogs, faLayerGroup, faSignOutAlt } from '@fortawesome/free-solid-svg-icons';",
|
|
"where": "import { faCogs, faLayerGroup, faSignOutAlt } from '@fortawesome/free-solid-svg-icons';"
|
|
}
|
|
],
|
|
"./resources/scripts/components/elements/PageContentBlock.tsx": [
|
|
{
|
|
"type": "under",
|
|
"theme": "any",
|
|
"add": "import SpinnerOverlay from './SpinnerOverlay';\nimport { ApplicationStore } from '@/state';\nimport cloudName, { CloudName } from '@/api/cloud/cloudName';\nimport useSWR from 'swr';\nimport { useStoreState } from 'easy-peasy';",
|
|
"where": "mport FlashMessageRender from '@/components/FlashMessageRender';"
|
|
},
|
|
{
|
|
"type": "above",
|
|
"theme": "any",
|
|
"add": "const cloud = useStoreState((state: ApplicationStore) => state.user.data!.cloud);\n const uuid = useStoreState((state: ApplicationStore) => state.user.data!.uuid);\n const subcloud = useStoreState((state: ApplicationStore) => state.user.data!.subcloud);\n const subcloud_owner = useStoreState((state: ApplicationStore) => state.user.data?.subcloud_owner);\n const { data } = useSWR<CloudName>(\n ['/cloud/cloudname'],\n () => cloudName(subcloud_owner ? subcloud_owner : cloud ? uuid : '', subcloud ? true : false),\n {\n revalidateOnFocus: false,\n }\n );",
|
|
"where": "return ("
|
|
},
|
|
{
|
|
"type": "above",
|
|
"theme": "any",
|
|
"add": " {(subcloud || cloud) && !data ? (\n <div css={tw`w-full`}>\n <SpinnerOverlay visible={true} />\n </div>\n ) : (\n",
|
|
"where": "<>"
|
|
},
|
|
{
|
|
"type": "replace",
|
|
"theme": "any",
|
|
"add": " <ContentContainer css={tw`mb-4`}>\n <p css={tw`text-center text-neutral-500 text-xs`}>\n {(subcloud || cloud) && data?.footer !== '' && data?.footer ? (\n <a\n rel={'noopener nofollow noreferrer'}\n href={data?.footerlink}\n target={'_blank'}\n css={tw`no-underline text-neutral-500 hover:text-neutral-300`}\n >\n {data?.footer}\n </a>\n ) : (\n <a\n rel={'noopener nofollow noreferrer'}\n href={'https://pterodactyl.io'}\n target={'_blank'}\n css={tw`no-underline text-neutral-500 hover:text-neutral-300`}\n >\n Pterodactyl®\n </a>\n )}\n © 2015 - {new Date().getFullYear()}\n </p>\n </ContentContainer>",
|
|
"where": " <ContentContainer css={tw`mb-4`}>\n <p css={tw`text-center text-neutral-500 text-xs`}>\n <a\n rel={'noopener nofollow noreferrer'}\n href={'https://pterodactyl.io'}\n target={'_blank'}\n css={tw`no-underline text-neutral-500 hover:text-neutral-300`}\n >\n Pterodactyl®\n </a>\n © 2015 - {new Date().getFullYear()}\n </p>\n </ContentContainer>"
|
|
},
|
|
{
|
|
"type": "above",
|
|
"theme": "any",
|
|
"add": " )}",
|
|
"where": "</CSSTransition>"
|
|
}
|
|
],
|
|
"./resources/scripts/state/user.ts": [
|
|
{
|
|
"type": "above",
|
|
"theme": "any",
|
|
"add": " cloud: boolean;\n cloud_database: number;\n cloud_allocation: number;\n cloud_backup: number;\n cloud_cpu: number;\n cloud_ram: number;\n cloud_disk: number;\n cloud_users: number;\n cloud_servers: number;\n subcloud_owner: string;\n subcloud: string;",
|
|
"where": "updatedAt: Date;"
|
|
}
|
|
],
|
|
"./routes/api-application.php": [
|
|
{
|
|
"type": "under",
|
|
"theme": "any",
|
|
"add": " Route::post('/{user:id}/suspend', [Application\\Cloud\\UserController::class, 'suspend']);\n Route::delete('/{user:id}/terminate', [Application\\Cloud\\UserController::class, 'terminate']);",
|
|
"where": "Route::post('/', [Application\\Users\\UserController::class, 'store']);"
|
|
}
|
|
],
|
|
"./routes/api-client.php": [
|
|
{
|
|
"type": "under",
|
|
"theme": "any",
|
|
"add": "Route::prefix('/cloud')->group(function () {\n\n Route::get('/infos', [Client\\Cloud\\CloudController::class, 'infos']);\n Route::get('/cloudname', [Client\\Cloud\\CloudController::class, 'cloudname']);\n \n Route::group(['prefix' => '/settings'], function () {\n Route::post('/setcloudname', [Client\\Cloud\\CloudSettingsController::class, 'setcloudname']);\n });\n Route::group(['prefix' => '/users'], function () {\n Route::get('/', [Client\\Cloud\\CloudUserController::class, 'index']);\n Route::get('/search', [Client\\Cloud\\CloudUserController::class, 'search']);\n Route::get('/setowner', [Client\\Cloud\\CloudUserController::class, 'setowner']);\n\n Route::post('/create', [Client\\Cloud\\CloudUserController::class, 'create']);\n Route::post('/edit', [Client\\Cloud\\CloudUserController::class, 'edit']);\n\n Route::delete('/delete', [Client\\Cloud\\CloudUserController::class, 'delete']);\n\n\n });\n Route::group(['prefix' => '/servers'], function () {\n\n Route::get('/search', [Client\\Cloud\\CloudServersController::class, 'search']);\n\n Route::post('/create', [Client\\Cloud\\CloudServersController::class, 'create']);\n Route::post('/edit', [Client\\Cloud\\CloudServersController::class, 'edit']);\n Route::post('/suspend', [Client\\Cloud\\CloudServersController::class, 'suspend']);\n\n Route::delete('/delete', [Client\\Cloud\\CloudServersController::class, 'delete']);\n\n });\n});,",
|
|
"where": "Route::get('/permissions', [Client\\ClientController::class, 'permissions']);"
|
|
}
|
|
],
|
|
"./app/Transformers/Api/Client/UserTransformer.php": [
|
|
{
|
|
"type": "under",
|
|
"theme": "any",
|
|
"add": " 'cloud' => $model->cloud,\n 'cloud_database' => $model->cloud_database,\n 'cloud_allocation' => $model->cloud_allocation,\n 'cloud_backup' => $model->cloud_backup,\n 'cloud_cpu' => $model->cloud_cpu,\n 'cloud_ram' => $model->cloud_ram,\n 'cloud_disk' => $model->cloud_disk,\n 'cloud_users' => $model->cloud_users,\n 'cloud_servers' => $model->cloud_servers,\n 'id' => $model->id,\n 'name_first' => $model->name_first,\n 'name_last' => $model->name_last",
|
|
"where": "'created_at' => $model->created_at->toIso8601String(),"
|
|
}
|
|
],
|
|
"./app/Http/Requests/Admin/UserFormRequest.php": [
|
|
{
|
|
"type": "under",
|
|
"theme": "any",
|
|
"add": " 'cloud',\n 'cloud_database',\n 'cloud_allocation',\n 'cloud_backup',\n 'cloud_cpu',\n 'cloud_ram',\n 'cloud_disk',\n 'cloud_users',\n 'cloud_servers',",
|
|
"where": "'root_admin',"
|
|
}
|
|
],
|
|
"./resources/scripts/api/server/getServer.ts": [
|
|
{
|
|
"type": "under",
|
|
"where": "allocations: Allocation[];",
|
|
"theme": "any",
|
|
"add": " eggId: number;"
|
|
},
|
|
{
|
|
"type": "under",
|
|
"where": "allocations: Allocation[];",
|
|
"theme": "any",
|
|
"add": " nestId: number;"
|
|
},
|
|
{
|
|
"type": "under",
|
|
"theme": "any",
|
|
"where": " allocations: ((data.relationships?.allocations as FractalResponseList | undefined)?.data || []).map(\n rawDataToServerAllocation\n ),\n",
|
|
"add": " nestId: data.nest_id,"
|
|
},
|
|
{
|
|
"type": "under",
|
|
"theme": "any",
|
|
"where": " allocations: ((data.relationships?.allocations as FractalResponseList | undefined)?.data || []).map(\n rawDataToServerAllocation\n ),\n",
|
|
"add": " eggId: data.egg_id,"
|
|
},
|
|
{
|
|
"type": "under",
|
|
"where": "allocations: Allocation[];",
|
|
"theme": "any",
|
|
"add": " owner: string;\n cloud: boolean;\n cloud_owner: string;"
|
|
},
|
|
{
|
|
"type": "under",
|
|
"theme": "any",
|
|
"where": " allocations: ((data.relationships?.allocations as FractalResponseList | undefined)?.data || []).map(\n rawDataToServerAllocation\n ),\n",
|
|
"add": " cloud: data.cloud,\n cloud_owner: data.cloud_owner,\n owner: data.owner_email,\n"
|
|
}
|
|
],
|
|
"./app/Transformers/Api/Client/ServerTransformer.php": [
|
|
{
|
|
"type": "under",
|
|
"theme": "any",
|
|
"where": "'name' => $server->name,",
|
|
"add": " 'nest_id' => $server->nest_id,\n 'egg_id' => $server->egg_id,"
|
|
},
|
|
{
|
|
"type": "under",
|
|
"theme": "any",
|
|
"where": "use Pterodactyl\\Services\\Servers\\StartupCommandService;",
|
|
"add": "use Pterodactyl\\Models\\User;"
|
|
},
|
|
{
|
|
"type": "under",
|
|
"theme": "any",
|
|
"where": "'name' => $server->name,",
|
|
"add": " 'owner_email' => User::where('id', $server->owner_id)->firstOrFail()['email'],\n 'cloud' => $server->cloud,\n 'cloud_owner' => $server->cloud_owner,\n"
|
|
}
|
|
],
|
|
"./resources/views/admin/users/index.blade.php": [
|
|
{
|
|
"type": "under",
|
|
"theme": "any",
|
|
"add": " <td><a href=\"{{ route('admin.users.view', $user->id) }}\">{{ $user->email }}</a> @if($user->root_admin)<i class=\"fa fa-star text-yellow\"></i>@endif @if($user->cloud)<i class=\"fa fa-cloud text-white\"></i>@endif</td>\n",
|
|
"where": "<td><a href=\"{{ route('admin.users.view', $user->id) }}\">{{ $user->email }}</a> @if($user->root_admin)<i class=\"fa fa-star text-yellow\"></i>@endif</td>"
|
|
}
|
|
],
|
|
"./resources/scripts/components/server/users/UsersContainer.tsx": [
|
|
{
|
|
"type": "under",
|
|
"theme": "any",
|
|
"add": " const cloudowner = ServerContext.useStoreState((state) => state.server!.data!.cloud_owner);",
|
|
"where": "const setSubusers = ServerContext.useStoreActions((actions) => actions.subusers.setSubusers);"
|
|
},
|
|
{
|
|
"type": "replace",
|
|
"theme": "any",
|
|
"add": " subusers.map((subuser) => {\n if (cloudowner !== subuser.uuid) return <UserRow key={subuser.uuid} subuser={subuser} />;\n else return <></>;\n })",
|
|
"where": "subusers.map((subuser) => <UserRow key={subuser.uuid} subuser={subuser} />)"
|
|
}
|
|
],
|
|
"./resources/scripts/components/dashboard/ServerRow.tsx": [
|
|
{
|
|
"type": "replace",
|
|
"theme": "any",
|
|
"add": "import { faEthernet, faHdd, faMemory, faMicrochip, faServer, faCloud } from '@fortawesome/free-solid-svg-icons';",
|
|
"where": "import { faEthernet, faHdd, faMemory, faMicrochip, faServer } from '@fortawesome/free-solid-svg-icons';"
|
|
},
|
|
{
|
|
"type": "replace",
|
|
"theme": "any",
|
|
"add": "{server.name} {server.cloud && <FontAwesomeIcon icon={faCloud} />}",
|
|
"where": "{server.name}"
|
|
}
|
|
],
|
|
|
|
"./resources/views/admin/locations/index.blade.php": [
|
|
{
|
|
"type": "replace",
|
|
"theme": "any",
|
|
"add": " <td><a href=\"{{ route('admin.locations.view', $location->id) }}\">{{ $location->short }}</a> {!! $location->cloud ? '<i class=\"fa fa-cloud\"></i> ' : '' !!} </td>\n",
|
|
"where": " <td><a href=\"{{ route('admin.locations.view', $location->id) }}\">{{ $location->short }}</a></td>"
|
|
}
|
|
],
|
|
"./resources/scripts/components/server/files/UploadButton.tsx": [
|
|
{
|
|
"type": "replace",
|
|
"theme": "any",
|
|
"where": "data: ProgressEvent, name: string",
|
|
"add": "data: any, name: string"
|
|
}
|
|
],
|
|
"./resources/scripts/components/server/settings/RenameServerBox.tsx": [
|
|
{
|
|
"type": "replace",
|
|
"theme": "any",
|
|
"where": " description: string;",
|
|
"add": " description: any;"
|
|
}
|
|
]
|
|
}
|