mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-20 00:34:44 +02:00
Small cleanup for new egg features (#1343)
This commit is contained in:
parent
26e20453bf
commit
e38a736b61
@ -8,6 +8,7 @@ use App\Models\Server;
|
|||||||
use App\Models\ServerVariable;
|
use App\Models\ServerVariable;
|
||||||
use App\Repositories\Daemon\DaemonPowerRepository;
|
use App\Repositories\Daemon\DaemonPowerRepository;
|
||||||
use Closure;
|
use Closure;
|
||||||
|
use Exception;
|
||||||
use Filament\Actions\Action;
|
use Filament\Actions\Action;
|
||||||
use Filament\Facades\Filament;
|
use Filament\Facades\Filament;
|
||||||
use Filament\Forms\Components\Placeholder;
|
use Filament\Forms\Components\Placeholder;
|
||||||
@ -27,8 +28,8 @@ class GSLToken extends FeatureProvider
|
|||||||
public function getListeners(): array
|
public function getListeners(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'gsl token expired',
|
'(gsl token expired)',
|
||||||
'account not found',
|
'(account not found)',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,9 +53,8 @@ class GSLToken extends FeatureProvider
|
|||||||
->modalSubmitActionLabel('Update GSL Token')
|
->modalSubmitActionLabel('Update GSL Token')
|
||||||
->disabledForm(fn () => !auth()->user()->can(Permission::ACTION_STARTUP_UPDATE, $server))
|
->disabledForm(fn () => !auth()->user()->can(Permission::ACTION_STARTUP_UPDATE, $server))
|
||||||
->form([
|
->form([
|
||||||
Placeholder::make('java')
|
Placeholder::make('info')
|
||||||
->label('You can either <x-filament::link href="https://steamcommunity.com/dev/managegameservers" target="_blank">generate a new one</x-filament::link> and enter it below or leave the field blank to remove it
|
->label('You can either <x-filament::link href="https://steamcommunity.com/dev/managegameservers" target="_blank">generate a new one</x-filament::link> and enter it below or leave the field blank to remove it completely.'),
|
||||||
completely.'),
|
|
||||||
TextInput::make('gsltoken')
|
TextInput::make('gsltoken')
|
||||||
->label('GSL Token')
|
->label('GSL Token')
|
||||||
->rules([
|
->rules([
|
||||||
@ -102,13 +102,13 @@ class GSLToken extends FeatureProvider
|
|||||||
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('GSL Token updated')
|
->title('GSL Token updated')
|
||||||
->body('Restart the server to use the new token.')
|
->body('Server will restart now.')
|
||||||
->success()
|
->success()
|
||||||
->send();
|
->send();
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $exception) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Error')
|
->title('Could not update GSL Token')
|
||||||
->body($e->getMessage())
|
->body($exception->getMessage())
|
||||||
->danger()
|
->danger()
|
||||||
->send();
|
->send();
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ use App\Facades\Activity;
|
|||||||
use App\Models\Permission;
|
use App\Models\Permission;
|
||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
use App\Repositories\Daemon\DaemonPowerRepository;
|
use App\Repositories\Daemon\DaemonPowerRepository;
|
||||||
|
use Exception;
|
||||||
use Filament\Actions\Action;
|
use Filament\Actions\Action;
|
||||||
use Filament\Facades\Filament;
|
use Filament\Facades\Filament;
|
||||||
use Filament\Forms\Components\Placeholder;
|
use Filament\Forms\Components\Placeholder;
|
||||||
@ -25,10 +26,11 @@ class JavaVersion extends FeatureProvider
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'java.lang.UnsupportedClassVersionError',
|
'java.lang.UnsupportedClassVersionError',
|
||||||
'minecraft 1.17 requires running the server with java 16 or above',
|
|
||||||
'minecraft 1.18 requires running the server with java 17 or above',
|
|
||||||
'unsupported major.minor version',
|
'unsupported major.minor version',
|
||||||
'has been compiled by a more recent version of the java runtime',
|
'has been compiled by a more recent version of the java runtime',
|
||||||
|
'minecraft 1.17 requires running the server with java 16 or above',
|
||||||
|
'minecraft 1.18 requires running the server with java 17 or above',
|
||||||
|
'minecraft 1.19 requires running the server with java 17 or above',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,17 +75,18 @@ class JavaVersion extends FeatureProvider
|
|||||||
->property(['old' => $original, 'new' => $new])
|
->property(['old' => $original, 'new' => $new])
|
||||||
->log();
|
->log();
|
||||||
}
|
}
|
||||||
|
|
||||||
$powerRepository->setServer($server)->send('restart');
|
$powerRepository->setServer($server)->send('restart');
|
||||||
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Docker image updated')
|
->title('Docker image updated')
|
||||||
->body('Restart the server to use the new image.')
|
->body('Server will restart now.')
|
||||||
->success()
|
->success()
|
||||||
->send();
|
->send();
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $exception) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Error')
|
->title('Could not update docker image')
|
||||||
->body($e->getMessage())
|
->body($exception->getMessage())
|
||||||
->danger()
|
->danger()
|
||||||
->send();
|
->send();
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ class MinecraftEula extends FeatureProvider
|
|||||||
public function getListeners(): array
|
public function getListeners(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'You need to agree to the EULA in order to run the server',
|
'you need to agree to the eula in order to run the server',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,31 +38,30 @@ class MinecraftEula extends FeatureProvider
|
|||||||
return Action::make($this->getId())
|
return Action::make($this->getId())
|
||||||
->requiresConfirmation()
|
->requiresConfirmation()
|
||||||
->modalHeading('Minecraft EULA')
|
->modalHeading('Minecraft EULA')
|
||||||
->modalDescription(new HtmlString(Blade::render('By pressing "I Accept" below you are indicating your agreement to the <x-filament::link href="https://minecraft.net/eula" target="_blank">Minecraft EULA </x-filament::link>')))
|
->modalDescription(new HtmlString(Blade::render('By pressing "I Accept" below you are indicating your agreement to the <x-filament::link href="https://minecraft.net/eula" target="_blank">Minecraft EULA </x-filament::link>.')))
|
||||||
->modalSubmitActionLabel('I Accept')
|
->modalSubmitActionLabel('I Accept')
|
||||||
->action(function (DaemonFileRepository $fileRepository, DaemonPowerRepository $powerRepository) {
|
->action(function (DaemonFileRepository $fileRepository, DaemonPowerRepository $powerRepository) {
|
||||||
try {
|
try {
|
||||||
/** @var Server $server */
|
/** @var Server $server */
|
||||||
$server = Filament::getTenant();
|
$server = Filament::getTenant();
|
||||||
$content = $fileRepository->setServer($server)->getContent('eula.txt');
|
|
||||||
$content = preg_replace('/(eula=)false/', '\1true', $content);
|
$fileRepository->setServer($server)->putContent('eula.txt', 'eula=true');
|
||||||
$fileRepository->setServer($server)->putContent('eula.txt', $content);
|
|
||||||
$powerRepository->setServer($server)->send('restart');
|
$powerRepository->setServer($server)->send('restart');
|
||||||
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Docker image updated')
|
->title('Minecraft EULA accepted')
|
||||||
->body('Restart the server.')
|
->body('Server will restart now.')
|
||||||
->success()
|
->success()
|
||||||
->send();
|
->send();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $exception) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Error')
|
->title('Could not accept Minecraft EULA')
|
||||||
->body($e->getMessage())
|
->body($exception->getMessage())
|
||||||
->danger()
|
->danger()
|
||||||
->send();
|
->send();
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function register(Application $app): self
|
public static function register(Application $app): self
|
||||||
|
Loading…
x
Reference in New Issue
Block a user