Work In Progress

This commit is contained in:
Vehikl 2025-01-02 17:07:15 -05:00
parent 760649a67d
commit 93fd41d983
3 changed files with 67 additions and 1 deletions

16
app/Features/Feature.php Normal file
View File

@ -0,0 +1,16 @@
<?php
namespace App\Features;
use Filament\Actions\Action;
abstract class Feature
{
/** you need to agree to the eula in order to run the server */
abstract public function listeners(): array;
/** eula */
abstract public function featureName(): string;
abstract public function action(): Action;
}

View File

@ -0,0 +1,44 @@
<?php
namespace App\Features;
use App\Repositories\Daemon\DaemonFileRepository;
use Filament\Actions\Action;
use Filament\Forms\Components\Placeholder;
use Filament\Notifications\Notification;
class MinecraftEula extends Feature
{
public function listeners(): array
{
return [
'you need to agree to the eula in order to run the server',
];
}
public function featureName(): string
{
return 'eula';
}
public function action(): Action
{
return Action::make('eula')
->form([
Placeholder::make('eula')
->label('By pressing I Accept below you are indicating your agreement to the Minecraft® EULA.'),
])
->action(function (DaemonFileRepository $fileRepository) {
try {
$fileRepository->putContent('eula.txt', 'eula=true');
} catch (\Exception $e) {
Notification::make()
->title('Error')
->body($e->getMessage())
->danger()
->send();
}
}
);
}
}

View File

@ -99,8 +99,14 @@
const TERMINAL_PRELUDE = '\u001b[1m\u001b[33mpelican@' + '{{ \Filament\Facades\Filament::getTenant()->name }}' + ' ~ \u001b[0m';
const handleConsoleOutput = (line, prelude = false) =>
const handleConsoleOutput = (line, prelude = false) => {
terminal.writeln((prelude ? TERMINAL_PRELUDE : '') + line.replace(/(?:\r\n|\r|\n)$/im, '') + '\u001b[0m');
checkListeners(line);
}
const checkListeners = (line) => {
}
const handleTransferStatus = (status) =>
status === 'failure' && terminal.writeln(TERMINAL_PRELUDE + 'Transfer has failed.\u001b[0m');