2023-11-01 09:51:42 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Pterodactyl\Console\Commands\BlueprintFramework;
|
|
|
|
|
|
|
|
use Illuminate\Console\Command;
|
2024-03-10 17:26:41 -04:00
|
|
|
use Pterodactyl\BlueprintFramework\Services\ConfigService\BlueprintConfigService;
|
|
|
|
use Pterodactyl\BlueprintFramework\Services\PlaceholderService\BlueprintPlaceholderService;
|
2023-11-01 09:51:42 -04:00
|
|
|
use Pterodactyl\BlueprintFramework\Libraries\ExtensionLibrary\Admin\BlueprintAdminLibrary as BlueprintExtensionLibrary;
|
|
|
|
use Pterodactyl\Contracts\Repository\SettingsRepositoryInterface;
|
|
|
|
|
|
|
|
class SyncCommand extends Command
|
|
|
|
{
|
2023-11-01 10:24:00 -04:00
|
|
|
protected $description = 'Sync Blueprint database values.';
|
2023-11-01 09:51:42 -04:00
|
|
|
protected $signature = 'bp:sync';
|
|
|
|
|
|
|
|
/**
|
2024-02-16 10:05:42 -05:00
|
|
|
* SyncCommand constructor.
|
2023-11-01 09:51:42 -04:00
|
|
|
*/
|
|
|
|
public function __construct(
|
|
|
|
private BlueprintExtensionLibrary $blueprint,
|
2024-03-10 17:26:41 -04:00
|
|
|
private BlueprintConfigService $ConfigService,
|
|
|
|
private BlueprintPlaceholderService $PlaceholderService,
|
2023-11-01 09:51:42 -04:00
|
|
|
private SettingsRepositoryInterface $settings,
|
|
|
|
) { parent::__construct(); }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle execution of command.
|
|
|
|
*/
|
|
|
|
public function handle()
|
|
|
|
{
|
2023-11-01 09:59:08 -04:00
|
|
|
// TELEMETRY ID
|
2024-03-10 17:26:41 -04:00
|
|
|
if ($this->settings->get('blueprint::panel:id') == "" || $this->PlaceholderService->version() != $this->settings->get('blueprint::version:cache')) {
|
|
|
|
$this->settings->set('blueprint::panel:id', uniqid(rand())."@".$this->PlaceholderService->version());
|
|
|
|
$this->settings->set('blueprint::version:cache', $this->PlaceholderService->version());
|
2023-11-01 09:59:08 -04:00
|
|
|
}
|
2023-11-01 10:24:00 -04:00
|
|
|
|
|
|
|
// TELEMETRY STATUS
|
|
|
|
if ($this->settings->get('blueprint::telemetry') == "") { $this->settings->set('blueprint::telemetry', "true"); }
|
2024-03-10 17:26:41 -04:00
|
|
|
if ($this->settings->get('blueprint::telemetry') == "false") { $this->ConfigService->config('TELEMETRY_ID','KEY_NOT_UPDATED');
|
|
|
|
} else { $this->ConfigService->config('TELEMETRY_ID',$this->settings->get("blueprint::panel:id")); }
|
2023-11-01 09:59:08 -04:00
|
|
|
|
|
|
|
// DEVELOPER MODE
|
2024-03-10 17:26:41 -04:00
|
|
|
$this->ConfigService->config('DEVELOPER', $this->settings->get('blueprint::developer'));
|
2023-11-01 09:51:42 -04:00
|
|
|
}
|
|
|
|
}
|