63 lines
1.9 KiB
PHP
63 lines
1.9 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App;
|
|
|
|
use Desktop\AppRegistry;
|
|
use Desktop\DesktopState;
|
|
use Desktop\SkinResolver;
|
|
use Desktop\WidgetRegistry;
|
|
use Desktop\WindowManager;
|
|
|
|
final class App
|
|
{
|
|
public function __construct(
|
|
private readonly string $projectRoot,
|
|
) {
|
|
}
|
|
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function desktopPayload(): array
|
|
{
|
|
$registry = new AppRegistry($this->projectRoot . '/config/apps.php');
|
|
$widgetRegistry = new WidgetRegistry($this->projectRoot . '/config/widgets.php');
|
|
$skins = SkinResolver::all();
|
|
$activeSkin = SkinResolver::resolve($_GET['skin'] ?? null);
|
|
$windows = (new WindowManager($registry))->defaultWindows();
|
|
$activeWidgetIds = DesktopState::defaultWidgetIds();
|
|
|
|
return [
|
|
'meta' => [
|
|
'title' => 'Kusche.Berlin Desktop UI',
|
|
'active_skin' => $activeSkin,
|
|
'available_skins' => $skins,
|
|
],
|
|
'desktop' => [
|
|
'greeting' => 'Neue Desktop-Shell fuer Kusche.Berlin',
|
|
'wallpaper' => SkinResolver::wallpaper($activeSkin),
|
|
'storage_scope' => 'guest',
|
|
'workspace' => DesktopState::defaultWorkspace(),
|
|
'login' => [
|
|
'authenticated' => false,
|
|
'mode' => 'public-home',
|
|
'keycloak_theme_handoff' => '/docs/keycloak-theme-handoff.md',
|
|
],
|
|
],
|
|
'apps' => $registry->all(),
|
|
'windows' => $windows,
|
|
'widgets' => [
|
|
'active' => $widgetRegistry->active($activeWidgetIds),
|
|
'registry' => $widgetRegistry->all(),
|
|
'active_ids' => $activeWidgetIds,
|
|
],
|
|
'tray' => DesktopState::trayItems(),
|
|
'menu' => [
|
|
'quick_actions' => DesktopState::quickActions(),
|
|
],
|
|
];
|
|
}
|
|
}
|