Remove all auto-update functionality (commands, services, widgets, blades, translations)

This commit is contained in:
root
2026-06-03 22:54:39 +02:00
parent 1f9af5279a
commit 1f04979ffe
106 changed files with 29572 additions and 41008 deletions
@@ -5,7 +5,6 @@ declare(strict_types=1);
namespace App\Filament\Pages\Monitoring;
use App\Actions\Commandocentrum\EmulatorControlAction;
use App\Actions\Commandocentrum\NitroControlAction;
use App\Enums\AlertSeverity;
use App\Models\Miscellaneous\WebsitePermission;
use App\Models\StaffActivity;
@@ -16,7 +15,6 @@ use App\Services\Diagnostics\DiagnosticRunner;
use App\Services\GitHubService;
use App\Services\RconService;
use App\Services\SettingsService;
use App\Services\UpdateHistoryService;
use BackedEnum;
use Exception;
use Filament\Actions\Action;
@@ -106,21 +104,6 @@ final class Commandocentrum extends Page implements HasForms
'emulator_database_username' => $this->getSetting('emulator_database_username', ''),
'emulator_database_password' => $this->getSetting('emulator_database_password', ''),
'emulator_version' => $this->getSetting('emulator_version', 'Onbekend'),
'auto_update_enabled' => $this->getSettingBool('auto_update_enabled'),
'auto_update_schedule' => $this->getSetting('auto_update_schedule', '03:00'),
'auto_update_days' => $this->getSetting('auto_update_days', '0,6'),
'nitro_client_path' => $this->getSetting('nitro_client_path', $paths['nitro_client_path']),
'nitro_renderer_path' => $this->getSetting('nitro_renderer_path', $paths['nitro_renderer_path']),
'nitro_build_path' => $this->getSetting('nitro_build_path', $paths['nitro_build_path']),
'nitro_webroot' => $this->getSetting('nitro_webroot', $paths['nitro_webroot']),
'gamedata_path' => $this->getSetting('gamedata_path', $paths['gamedata_path']),
'nitro_github_branch' => $this->getSetting('nitro_github_branch', 'main'),
'nitro_github_url' => $this->getSetting('nitro_github_url', ''),
'nitro_site_url' => $this->getSetting('nitro_site_url', $this->getCurrentSiteUrl()),
'nitro_auto_update_configs' => $this->getSettingBool('nitro_auto_update_configs'),
'nitro_auto_update_enabled' => $this->getSettingBool('nitro_auto_update_enabled'),
'nitro_auto_update_schedule' => $this->getSetting('nitro_auto_update_schedule', '03:00'),
'nitro_auto_update_days' => $this->getSetting('nitro_auto_update_days', '0,6'),
'hotel_alert_message' => '',
];
}
@@ -233,92 +216,6 @@ final class Commandocentrum extends Page implements HasForms
->content(fn () => $this->renderEmulatorInfoView()),
]),
Section::make(__('commandocentrum.emulator_updates'))
->description(__('commandocentrum.emulator_updates_desc'))
->icon('heroicon-o-arrow-down-circle')
->afterHeader([
Action::make('check_updates')
->label(__('commandocentrum.check_updates'))
->color('info')
->action('checkEmulatorUpdates'),
Action::make('build_emulator')
->label('🔨 ' . __('commandocentrum.build'))
->color('success')
->action('buildEmulator'),
Action::make('run_sql')
->label(__('commandocentrum.sql_updates'))
->color('purple')
->action('runSqlUpdates'),
Action::make('save_emulator')
->label(__('commandocentrum.save'))
->color('primary')
->action('saveEmulator'),
])
->schema([
Placeholder::make('emulator_settings')
->label('')
->content(fn () => $this->renderEmulatorSettingsView()),
]),
Section::make(__('commandocentrum.emulator_backups'))
->description(__('commandocentrum.emulator_backups_desc'))
->icon('heroicon-s-archive-box')
->schema([
Placeholder::make('backups_list')
->label('')
->content(fn () => $this->renderBackupsListView()),
]),
Section::make(__('commandocentrum.nitro_client'))
->description(__('commandocentrum.nitro_client_desc'))
->icon('heroicon-o-cloud-arrow-down')
->afterHeader([
Action::make('detect_paths')
->label('🔍 ' . __('commandocentrum.auto_detect'))
->color('success')
->action('detectAndSavePaths'),
Action::make('check_nitro')
->label(__('commandocentrum.check'))
->color('info')
->action('checkNitroUpdates'),
Action::make('build_nitro')
->label(__('commandocentrum.build'))
->color('pink')
->action('buildNitro'),
Action::make('generate_configs')
->label(__('commandocentrum.generate_configs'))
->color('indigo')
->action('generateNitroConfigs'),
Action::make('save_nitro')
->label(__('commandocentrum.save'))
->color('primary')
->action('saveNitro'),
])
->schema([
Placeholder::make('nitro_settings')
->label('')
->content(fn () => $this->renderNitroSettingsView()),
]),
Section::make(__('commandocentrum.auto_updates'))
->description(__('commandocentrum.auto_updates_desc'))
->icon('heroicon-o-clock')
->columns(2)
->afterHeader([
Action::make('save_auto')
->label(__('commandocentrum.save'))
->color('primary')
->action('saveAutoUpdate'),
])
->schema([
Toggle::make('auto_update_enabled')
->label(__('commandocentrum.enable_auto_updates')),
TextInput::make('auto_update_schedule')
->label(__('commandocentrum.schedule')),
TextInput::make('auto_update_days')
->label(__('commandocentrum.days')),
]),
Section::make(__('commandocentrum.clothing_sync'))
->description(__('commandocentrum.clothing_sync_desc'))
->icon('heroicon-o-user')
@@ -367,15 +264,6 @@ final class Commandocentrum extends Page implements HasForms
->helperText(__('commandocentrum.discord_ranks_helper')),
]),
Section::make(__('commandocentrum.update_history'))
->description(__('commandocentrum.update_history_desc'))
->icon('heroicon-o-clock')
->schema([
Placeholder::make('history')
->label('')
->content(fn () => $this->renderUpdateHistoryView()),
]),
Section::make(__('commandocentrum.social_login'))
->description(__('commandocentrum.social_login_desc'))
->icon('heroicon-o-user-circle')
@@ -491,100 +379,6 @@ final class Commandocentrum extends Page implements HasForms
]);
}
private function renderEmulatorSettingsView(): View
{
return view('filament.components.commandocentrum.emulator-settings', [
'emulatorBranchesHtml' => $this->getEmulatorBranchesHtml(),
'emulatorStatusHtml' => $this->renderEmulatorStatusView()->render(),
]);
}
private function renderEmulatorStatusView(): View
{
$serviceName = $this->getSetting('emulator_service_name', 'arcturus');
$jarPath = $this->getSetting('emulator_jar_path', '/var/www/Emulator');
$sourcePath = $this->getSetting('emulator_source_path', '/var/www/emulator-source');
$githubUrl = $this->getSetting('emulator_github_url', '');
$branch = $this->getSetting('emulator_github_branch', 'main');
$jarExists = $this->fileExists($jarPath);
$sourceExists = $this->fileExists($sourcePath);
$sourceCommit = $this->getGitCommit($sourcePath);
$remoteVersion = $githubUrl !== '' && $githubUrl !== '0' ? $this->getRemoteCommit($githubUrl, $branch) : 'N/A';
$canBuild = false;
$checkDirs = [
$sourcePath,
$sourcePath . '/Emulator',
$sourcePath . '/Emulator/Emulator',
$sourcePath . '/emulator',
$sourcePath . '/emulator/emulator',
];
foreach ($checkDirs as $dir) {
$check = $this->runCommand('test -f ' . escapeshellarg($dir . '/pom.xml') . ' && echo yes');
if ($check && trim($check) === 'yes') {
$canBuild = true;
break;
}
}
return view('filament.components.commandocentrum.emulator-status', [
'emulatorOnline' => $this->getEmulatorStatusText() === 'Online',
'jarExists' => $jarExists,
'serviceName' => $serviceName,
'sourceCommit' => $sourceCommit,
'remoteVersion' => $remoteVersion,
'canBuild' => $canBuild,
'jarPath' => $jarPath,
'sourcePath' => $sourcePath,
]);
}
private function renderNitroSettingsView(): View
{
return view('filament.components.commandocentrum.nitro-settings', [
'nitroBranchesHtml' => $this->getNitroBranchesHtml(),
'nitroStatusHtml' => $this->renderNitroStatusView()->render(),
]);
}
private function renderNitroStatusView(): View
{
$clientPath = $this->getSetting('nitro_client_path', '/var/www/nitro-client');
$rendererPath = $this->getSetting('nitro_renderer_path', '/var/www/nitro-renderer');
$webroot = $this->getSetting('nitro_webroot', '/var/www/Client');
$clientGithubUrl = $this->getSetting('nitro_github_url', '');
$rendererGithubUrl = $this->getSetting('nitro_renderer_github_url', 'https://github.com/duckietm/Nitro_Render_V3');
$clientCommit = $this->getGitCommit($clientPath);
$rendererCommit = $this->getGitCommit($rendererPath);
$clientRemote = $clientGithubUrl !== '' && $clientGithubUrl !== '0' ? $this->getRemoteCommit($clientGithubUrl, $this->getSetting('nitro_github_branch', 'main')) : 'N/A';
$rendererRemote = $rendererGithubUrl !== '' && $rendererGithubUrl !== '0' ? $this->getRemoteCommit($rendererGithubUrl, $this->getSetting('nitro_renderer_github_branch', 'main')) : 'N/A';
return view('filament.components.commandocentrum.nitro-status', [
'clientExists' => $this->checkPathExists($clientPath),
'rendererExists' => $this->checkPathExists($rendererPath),
'webrootExists' => $this->checkPathExists($webroot),
'clientCommit' => $clientCommit,
'rendererCommit' => $rendererCommit,
'clientRemote' => $clientRemote,
'rendererRemote' => $rendererRemote,
]);
}
private function renderBackupsListView(): View
{
try {
$backups = app(EmulatorControlAction::class)->getBackups();
} catch (Exception) {
$backups = [];
}
return view('filament.components.commandocentrum.backups-list', [
'backups' => $backups,
]);
}
private function renderClothingStatusView(): View
{
try {
@@ -614,19 +408,6 @@ final class Commandocentrum extends Page implements HasForms
]);
}
private function renderUpdateHistoryView(): View
{
try {
$history = app(UpdateHistoryService::class)->getRecent(10);
} catch (Exception) {
$history = [];
}
return view('filament.components.commandocentrum.update-history', [
'history' => $history,
]);
}
private function getSetting(string $key, string $default = ''): string
{
try {
@@ -878,33 +659,6 @@ final class Commandocentrum extends Page implements HasForms
}
}
public function checkEmulatorUpdates(): void
{
$result = app(EmulatorControlAction::class)->update();
$this->notify($result['success'] ?? false ? __('commandocentrum.success') : __('commandocentrum.error'), $result['message'] ?? $result['error'] ?? __('commandocentrum.unknown'), ($result['success'] ?? false) ? 'success' : 'danger');
Cache::forget('all_updates_check');
$this->fillForm();
}
public function buildEmulator(): void
{
$result = app(EmulatorControlAction::class)->build();
$this->notify($result['success'] ?? false ? __('commandocentrum.success') : __('commandocentrum.error'), $result['message'] ?? $result['error'] ?? __('commandocentrum.unknown'), ($result['success'] ?? false) ? 'success' : 'danger');
}
public function runSqlUpdates(): void
{
$result = app(EmulatorControlAction::class)->runSqlUpdates();
$this->notify($result['success'] ?? false ? __('commandocentrum.success') : __('commandocentrum.error'), $result['message'] ?? __('commandocentrum.unknown'), ($result['success'] ?? false) ? 'success' : 'danger');
}
public function restoreBackup(string $backupName): void
{
$result = app(EmulatorControlAction::class)->restoreBackup($backupName);
$this->notify($result['success'] ? __('commandocentrum.success') : __('commandocentrum.error'), $result['message'] ?? $result['error'] ?? __('commandocentrum.unknown'), $result['success'] ? 'success' : 'danger');
$this->fillForm();
}
public function saveEmulator(): void
{
try {
@@ -924,38 +678,6 @@ final class Commandocentrum extends Page implements HasForms
}
}
public function checkNitroUpdates(): void
{
$clientPath = $this->getSetting('nitro_client_path', '/var/www/nitro-client');
$rendererPath = $this->getSetting('nitro_renderer_path', '/var/www/nitro-renderer');
$branch = $this->getSetting('nitro_github_branch', 'main');
$result = app(NitroControlAction::class)->pullUpdates($clientPath, $rendererPath, $branch);
$this->notify(__('commandocentrum.success'), $result['message'], 'success');
$this->fillForm();
}
public function buildNitro(): void
{
$clientPath = $this->getSetting('nitro_client_path', '/var/www/nitro-client');
$rendererPath = $this->getSetting('nitro_renderer_path', '/var/www/nitro-renderer');
$branch = $this->getSetting('nitro_github_branch', 'main');
$result = app(NitroControlAction::class)->build($clientPath, $rendererPath, $branch);
$this->notify($result['success'] ? __('commandocentrum.success') : __('commandocentrum.warning'), $result['message'], $result['success'] ? 'success' : 'warning');
}
public function generateNitroConfigs(): void
{
$siteUrl = $this->getSetting('nitro_site_url', $this->getCurrentSiteUrl());
$webroot = $this->getSetting('nitro_webroot', '/var/www/Client');
$gamedataPath = $this->getSetting('gamedata_path', '/var/www/Gamedata');
$result = app(NitroControlAction::class)->generateConfigs($siteUrl, $webroot, $gamedataPath);
$this->notify($result['success'] ? __('commandocentrum.success') : __('commandocentrum.error'), $result['message'], $result['success'] ? 'success' : 'danger');
$this->fillForm();
}
public function syncClothing(): void
{
try {
@@ -972,58 +694,6 @@ final class Commandocentrum extends Page implements HasForms
}
}
public function detectAndSavePaths(): void
{
try {
$paths = $this->autoDetectPaths();
$settings = app(SettingsService::class);
$settings->set('nitro_client_path', $paths['nitro_client_path']);
$settings->set('nitro_renderer_path', $paths['nitro_renderer_path']);
$settings->set('nitro_build_path', $paths['nitro_build_path']);
$settings->set('nitro_webroot', $paths['nitro_webroot']);
$settings->set('gamedata_path', $paths['gamedata_path']);
$settings->set('emulator_jar_path', $paths['emulator_jar_path']);
$settings->set('emulator_source_path', $paths['emulator_source_path']);
$this->fillForm();
$this->notify(__('commandocentrum.success'), __('commandocentrum.paths_detected'), 'success');
} catch (Exception $e) {
$this->notify(__('commandocentrum.error'), $e->getMessage(), 'danger');
}
}
public function saveNitro(): void
{
try {
$settings = app(SettingsService::class);
$settings->set('nitro_client_path', $this->data['nitro_client_path'] ?? '/var/www/atomcms/nitro-client');
$settings->set('nitro_renderer_path', $this->data['nitro_renderer_path'] ?? '/var/www/atomcms/nitro-renderer');
$settings->set('nitro_build_path', $this->data['nitro_build_path'] ?? '/var/www/atomcms/nitro-client/dist');
$settings->set('nitro_webroot', $this->data['nitro_webroot'] ?? '/var/www/Client');
$settings->set('gamedata_path', $this->data['gamedata_path'] ?? '/var/www/Gamedata');
$settings->set('nitro_github_url', $this->data['nitro_github_url'] ?? '');
$settings->set('nitro_github_branch', $this->data['nitro_github_branch'] ?? 'main');
$settings->set('nitro_site_url', $this->data['nitro_site_url'] ?? '');
$this->notify(__('commandocentrum.success'), __('commandocentrum.nitro_settings_saved'), 'success');
} catch (Exception $e) {
$this->notify(__('commandocentrum.error'), $e->getMessage(), 'danger');
}
}
public function saveAutoUpdate(): void
{
try {
$settings = app(SettingsService::class);
$settings->set('auto_update_enabled', ($this->data['auto_update_enabled'] ?? false) ? '1' : '0');
$settings->set('auto_update_schedule', $this->data['auto_update_schedule'] ?? '03:00');
$settings->set('auto_update_days', $this->data['auto_update_days'] ?? '0,6');
$this->notify(__('commandocentrum.success'), __('commandocentrum.auto_update_saved'), 'success');
} catch (Exception $e) {
$this->notify(__('commandocentrum.error'), $e->getMessage(), 'danger');
}
}
public function saveAlerts(): void
{
try {