2023-04-05 15:29:58 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Pterodactyl\Http\Controllers\Admin\Extensions\Blueprint;
|
|
|
|
|
|
|
|
use Illuminate\View\View;
|
|
|
|
use Illuminate\View\Factory as ViewFactory;
|
|
|
|
use Prologue\Alerts\AlertsMessageBag;
|
|
|
|
use Illuminate\Contracts\Console\Kernel;
|
|
|
|
use Pterodactyl\Http\Controllers\Controller;
|
|
|
|
use Pterodactyl\Services\Helpers\SoftwareVersionService;
|
|
|
|
use Pterodactyl\Services\Helpers\BlueprintVariableService;
|
2023-04-11 15:54:57 -04:00
|
|
|
use Pterodactyl\Services\Helpers\BlueprintTelemetryService;
|
2023-04-05 15:29:58 -04:00
|
|
|
use Pterodactyl\Contracts\Repository\SettingsRepositoryInterface;
|
|
|
|
use Illuminate\Contracts\Config\Repository as ConfigRepository;
|
|
|
|
use Pterodactyl\Http\Requests\Admin\Extensions\Blueprint\BlueprintSettingsFormRequest;
|
|
|
|
use Illuminate\Http\RedirectResponse;
|
|
|
|
|
|
|
|
class BlueprintExtensionController extends Controller
|
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* BlueprintExtensionController constructor.
|
|
|
|
*/
|
|
|
|
public function __construct(
|
|
|
|
private BlueprintVariableService $bp,
|
2023-04-11 15:54:57 -04:00
|
|
|
private BlueprintTelemetryService $telemetry,
|
2023-04-05 15:29:58 -04:00
|
|
|
|
|
|
|
private SoftwareVersionService $version,
|
|
|
|
private ViewFactory $view,
|
|
|
|
private Kernel $kernel,
|
|
|
|
private AlertsMessageBag $alert,
|
|
|
|
private ConfigRepository $config,
|
|
|
|
private SettingsRepositoryInterface $settings,
|
|
|
|
) {
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the admin index view.
|
|
|
|
*/
|
|
|
|
public function index(): View
|
|
|
|
{
|
2023-04-09 15:15:11 -04:00
|
|
|
if($this->bp->dbGet('developer:cmd') != "") {
|
|
|
|
$this->bp->dbSet('developer:log', shell_exec("cd /var/www/pterodactyl;".$this->bp->dbGet('developer:cmd')));
|
|
|
|
};
|
2023-04-05 15:29:58 -04:00
|
|
|
return $this->view->make(
|
|
|
|
'admin.extensions.blueprint.index', [
|
|
|
|
'version' => $this->version,
|
|
|
|
'bp' => $this->bp,
|
2023-04-11 15:54:57 -04:00
|
|
|
'telemetry' => $this->telemetry,
|
2023-04-05 15:29:58 -04:00
|
|
|
'root' => "/admin/extensions/blueprint",
|
|
|
|
'a' => $this->bp->a(),
|
|
|
|
'b' => $this->bp->b(),
|
|
|
|
'c' => $this->bp->c(),
|
|
|
|
]
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
|
|
|
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
|
|
|
*/
|
|
|
|
public function update(BlueprintSettingsFormRequest $request): RedirectResponse
|
|
|
|
{
|
|
|
|
foreach ($request->normalize() as $key => $value) {
|
|
|
|
$this->settings->set('blueprint::' . $key, $value);
|
|
|
|
}
|
|
|
|
|
|
|
|
return redirect()->route('admin.extensions.blueprint.index');
|
|
|
|
}
|
|
|
|
}
|