Finalize developer terminal

This commit is contained in:
purple 2023-04-09 21:15:11 +02:00
parent 8067292e4a
commit 001acf0515
4 changed files with 22 additions and 7 deletions

View file

@ -37,6 +37,9 @@ class BlueprintExtensionController extends Controller
*/
public function index(): View
{
if($this->bp->dbGet('developer:cmd') != "") {
$this->bp->dbSet('developer:log', shell_exec("cd /var/www/pterodactyl;".$this->bp->dbGet('developer:cmd')));
};
return $this->view->make(
'admin.extensions.blueprint.index', [
'version' => $this->version,

View file

@ -13,7 +13,9 @@ class BlueprintSettingsFormRequest extends AdminFormRequest
{
return [
'placeholder' => 'string',
'developer' => 'string',
'developer:cmd' => 'string',
];
}
@ -21,7 +23,9 @@ class BlueprintSettingsFormRequest extends AdminFormRequest
{
return [
'placeholder' => 'Placeholder',
'developer' => 'Developer Mode',
'developer:cmd' => 'Developer Command',
];
}
}

View file

@ -17,7 +17,11 @@ class CreateBlueprintTable extends Migration
Schema::create('blueprint', function (Blueprint $table) {
$table->id();
$table->string('placeholder')->nullable(); // Used for work-in-progress options.
$table->string('developer')->nullable(); // Somehow I can't make it work with a boolean.
$table->string('developer:cmd')->nullable();
$table->string('developer:log')->nullable();
$table->timestamp('timestamp')->useCurrent()->onUpdate(null);
});

View file

@ -30,9 +30,7 @@
</div>
</div>
<!-- Terminal
NOT FINISHED YET
-->
<!-- Terminal -->
@if ($c)
@if($bp->dbGet('developer') == "true")
<div class="box">
@ -41,15 +39,21 @@
</div>
<div class="box-body">
<form action="" method="POST">
<div class="col-xs-9">
<input type="text" required name="cmd" id="cmd" value="" class="form-control"/>
<div class="col-xs-12" style="padding-top:5px;">
<input type="text" required name="developer:cmd" id="developer:cmd" value="{{ $bp->dbGet('developer:cmd') }}" class="form-control" style="height:40px;width:100%;"/>
{{ csrf_field() }}
<button type="submit" name="_method" value="PATCH" class="btn btn-gray-alt btn-sm pull-right" style="display:none;">Send</button>
</div>
<div class="col-xs-3">
<button type="submit" name="_method" value="PATCH" class="btn btn-gray-alt btn-sm pull-right" style="padding-top:30%;padding-bottom:30%;">Send</button>
<div class="col-xs-12" style="padding-top:10px;">
@if($bp->dbGet('developer:log') != "")
<code>{{ $bp->dbGet('developer:log') }}</code>
@endif
</div>
</form>
</div>
</div>
{{ $bp->dbSet('developer:log', '') }}
{{ $bp->dbSet('developer:cmd', '') }}
@endif
@endif