- LicenseService.php: activate/validate/deactivate + 7-day grace period - ValidateLicense.php: mvc:validate Artisan command (daily cron) - Updated controller.php: license activation/deactivation in update handler - Updated view.blade.php: order ID input, status indicator (green/yellow/red), grace/expired banners, dynamic pro-tier field gating, update-available card Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
48 lines
1.4 KiB
PHP
48 lines
1.4 KiB
PHP
<?php
|
|
|
|
/**
|
|
* MVC License Validation — daily phone-home cron command.
|
|
*
|
|
* USAGE:
|
|
* php artisan mvc:validate
|
|
*
|
|
* CRON SCHEDULE:
|
|
* 0 4 * * * cd /var/www/pterodactyl && php artisan mvc:validate >> /dev/null 2>&1
|
|
*
|
|
* Calls Arbiter /api/mvc/validate to confirm license is still active.
|
|
* On failure, enters 7-day grace period. After grace expires, marks expired.
|
|
*/
|
|
|
|
namespace Pterodactyl\Console\Commands;
|
|
|
|
use Illuminate\Console\Command;
|
|
use Pterodactyl\Services\LicenseService;
|
|
|
|
class ValidateLicense extends Command
|
|
{
|
|
protected $signature = 'mvc:validate';
|
|
protected $description = 'Validate ModpackChecker license (daily phone-home)';
|
|
|
|
public function __construct(private LicenseService $licenseService)
|
|
{
|
|
parent::__construct();
|
|
}
|
|
|
|
public function handle(): int
|
|
{
|
|
$this->info('Validating ModpackChecker license...');
|
|
|
|
$result = $this->licenseService->validate();
|
|
|
|
match ($result['status']) {
|
|
'active' => $this->info("✅ License active — tier: {$result['tier']}"),
|
|
'grace' => $this->warn("⚠️ Grace period — expires: {$result['expires']}"),
|
|
'expired' => $this->error("❌ License expired"),
|
|
'inactive' => $this->line("No license configured"),
|
|
default => $this->line("Status: {$result['status']}"),
|
|
};
|
|
|
|
return 0;
|
|
}
|
|
}
|