2026-10-05 18:10:18 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace Pterodactyl\Services\Extensions;
|
|
|
|
|
|
|
|
|
|
use Illuminate\Support\Facades\File;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The lucide icon names this panel build can render for `nav.icon`. The list is
|
|
|
|
|
* generated with the SDK (npm run sdk:generate) from the bundled lucide release, so
|
|
|
|
|
* a name outside it is valid manifest syntax that renders the default icon here.
|
|
|
|
|
*/
|
|
|
|
|
final class ExtensionIconCatalog
|
|
|
|
|
{
|
|
|
|
|
public const string PATH = 'packages/sdk/icons.json';
|
|
|
|
|
|
|
|
|
|
/**
|
2026-10-07 10:46:54 +01:00
|
|
|
* The icons a manifest declares that this panel does not ship.
|
2026-10-05 18:10:18 -04:00
|
|
|
*
|
|
|
|
|
* @return list<string>
|
|
|
|
|
*/
|
|
|
|
|
public function unknownIcons(ExtensionManifest $manifest): array
|
|
|
|
|
{
|
2026-10-07 10:46:54 +01:00
|
|
|
$declared = array_filter([$manifest->iconName()]);
|
2026-10-05 18:10:18 -04:00
|
|
|
foreach ($manifest->screens as $screen) {
|
|
|
|
|
if (isset($screen['nav']['icon'])) {
|
|
|
|
|
$declared[] = $screen['nav']['icon'];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return array_values(array_unique(array_diff($declared, $this->names())));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** @return list<string> */
|
|
|
|
|
public function names(): array
|
|
|
|
|
{
|
2026-10-11 19:44:06 -04:00
|
|
|
return array_values(array_filter(File::json(base_path(self::PATH)), is_string(...)));
|
2026-10-05 18:10:18 -04:00
|
|
|
}
|
|
|
|
|
}
|