161 lines
8.1 KiB
PHP
161 lines
8.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
$payloadJson = json_encode($desktopPayload, JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT);
|
|
$activeSkin = $desktopPayload['meta']['active_skin'];
|
|
$baseSkinProfile = $desktopPayload['meta']['base_skin_profile'];
|
|
$skinProfile = $desktopPayload['meta']['skin_profile'];
|
|
$wallpaper = $desktopPayload['desktop']['wallpaper'];
|
|
|
|
$assetVersion = static function (string $publicPath): string {
|
|
$filesystemPath = dirname(__DIR__, 2) . '/public' . $publicPath;
|
|
|
|
if (!is_file($filesystemPath)) {
|
|
return $publicPath;
|
|
}
|
|
|
|
$mtime = filemtime($filesystemPath);
|
|
|
|
return $mtime === false ? $publicPath : $publicPath . '?v=' . $mtime;
|
|
};
|
|
|
|
$hasMiningChecker = false;
|
|
foreach ($desktopPayload['apps'] as $desktopApp) {
|
|
if (($desktopApp['app_id'] ?? null) === 'mining-checker') {
|
|
$hasMiningChecker = true;
|
|
break;
|
|
}
|
|
}
|
|
|
|
$renderStartIcon = static function (array $profile): string {
|
|
$style = (string) ($profile['taskbar_icon_style'] ?? 'label');
|
|
|
|
return match ($style) {
|
|
'windows' => '<span class="start-glyph start-glyph-windows" aria-hidden="true"><span></span><span></span><span></span><span></span></span>',
|
|
'apple' => '<span class="start-glyph start-glyph-apple" aria-hidden="true"></span>',
|
|
'linux' => '<span class="start-glyph start-glyph-linux" aria-hidden="true"><span></span><span></span><span></span></span>',
|
|
default => '<span class="start-glyph start-glyph-label" aria-hidden="true">' . htmlspecialchars((string) ($profile['taskbar_icon'] ?? 'OS'), ENT_QUOTES) . '</span>',
|
|
};
|
|
};
|
|
?><!DOCTYPE html>
|
|
<html lang="de">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title><?= htmlspecialchars($desktopPayload['meta']['title'], ENT_QUOTES) ?></title>
|
|
<link rel="stylesheet" href="<?= htmlspecialchars($assetVersion('/assets/desktop/desktop.css'), ENT_QUOTES) ?>">
|
|
<?php if (!empty($baseSkinProfile['css_path'])): ?>
|
|
<link rel="stylesheet" href="<?= htmlspecialchars($assetVersion((string) $baseSkinProfile['css_path']), ENT_QUOTES) ?>">
|
|
<?php endif; ?>
|
|
<?php if (!empty($skinProfile['css_path']) && $skinProfile['css_path'] !== $baseSkinProfile['css_path']): ?>
|
|
<link rel="stylesheet" href="<?= htmlspecialchars($assetVersion((string) $skinProfile['css_path']), ENT_QUOTES) ?>">
|
|
<?php endif; ?>
|
|
</head>
|
|
<body
|
|
data-skin="<?= htmlspecialchars($activeSkin, ENT_QUOTES) ?>"
|
|
data-skin-family="<?= htmlspecialchars((string) ($skinProfile['family'] ?? $activeSkin), ENT_QUOTES) ?>"
|
|
data-taskbar-mode="<?= htmlspecialchars((string) ($skinProfile['taskbar_mode'] ?? 'taskbar'), ENT_QUOTES) ?>"
|
|
data-window-controls="<?= htmlspecialchars((string) ($skinProfile['window_controls'] ?? 'windows'), ENT_QUOTES) ?>"
|
|
style="--wallpaper: <?= htmlspecialchars($wallpaper, ENT_QUOTES) ?>;"
|
|
>
|
|
<div class="desktop-shell">
|
|
<?php if (($skinProfile['top_bar'] ?? false) === true): ?>
|
|
<header class="system-bar">
|
|
<div class="system-bar-left">
|
|
<span class="system-brand"><?= htmlspecialchars((string) ($skinProfile['label'] ?? ''), ENT_QUOTES) ?></span>
|
|
<span class="system-divider"></span>
|
|
<span>Finder</span>
|
|
<span>Ablage</span>
|
|
<span>Bearbeiten</span>
|
|
<span>Fenster</span>
|
|
</div>
|
|
<div class="system-bar-right">
|
|
<div class="tray-skins system-skins" id="tray-skins-top"></div>
|
|
<span class="system-divider"></span>
|
|
<time id="clock-top"></time>
|
|
</div>
|
|
</header>
|
|
<?php endif; ?>
|
|
<main class="desktop-stage">
|
|
<div class="desktop-icons" id="desktop-icons"></div>
|
|
|
|
<div class="widget-zone" id="widget-zone">
|
|
<?php foreach ($desktopPayload['widgets']['active'] as $widget): ?>
|
|
<article class="widget-card">
|
|
<div class="widget-card-header">
|
|
<div>
|
|
<h3><?= htmlspecialchars($widget['title'], ENT_QUOTES) ?></h3>
|
|
<p><?= htmlspecialchars($widget['summary'] ?? '', ENT_QUOTES) ?></p>
|
|
</div>
|
|
<span class="widget-badge"><?= htmlspecialchars($widget['icon'] ?? 'WG', ENT_QUOTES) ?></span>
|
|
</div>
|
|
<p><?= htmlspecialchars($widget['content'] ?? '', ENT_QUOTES) ?></p>
|
|
</article>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
|
|
<div class="window-layer" id="window-layer"></div>
|
|
|
|
<section class="start-menu" id="start-menu" hidden>
|
|
<div class="start-menu-header">
|
|
<div>
|
|
<p class="eyebrow">Startmenue</p>
|
|
<h2>Desktop Aktionen</h2>
|
|
</div>
|
|
</div>
|
|
<div class="start-menu-column">
|
|
<div class="start-menu-block">
|
|
<p class="eyebrow">Schnellaktionen</p>
|
|
<div id="start-menu-actions"></div>
|
|
</div>
|
|
<div class="start-menu-block">
|
|
<p class="eyebrow">Widgets</p>
|
|
<div id="start-menu-widgets"></div>
|
|
</div>
|
|
</div>
|
|
<div class="start-menu-column">
|
|
<div class="start-menu-block">
|
|
<p class="eyebrow">Apps</p>
|
|
<div id="start-menu-apps"></div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<footer class="taskbar">
|
|
<button class="start-button" id="start-button" type="button">
|
|
<span class="start-button-icon"><?= $renderStartIcon($skinProfile) ?></span>
|
|
<span class="start-button-label"><?= htmlspecialchars((string) ($skinProfile['taskbar_label'] ?? 'Menu'), ENT_QUOTES) ?></span>
|
|
</button>
|
|
<div class="taskbar-apps" id="taskbar-apps"></div>
|
|
<div class="tray">
|
|
<?php foreach ($desktopPayload['tray'] as $trayItem): ?>
|
|
<span class="tray-pill" data-tray-id="<?= htmlspecialchars((string) $trayItem['id'], ENT_QUOTES) ?>"><?= htmlspecialchars($trayItem['label'], ENT_QUOTES) ?></span>
|
|
<?php endforeach; ?>
|
|
<?php if (($desktopPayload['session']['authenticated'] ?? false) === true && !empty($desktopPayload['session']['logout_url'])): ?>
|
|
<a class="tray-action" href="<?= htmlspecialchars((string) $desktopPayload['session']['logout_url'], ENT_QUOTES) ?>">Logout</a>
|
|
<?php endif; ?>
|
|
<div class="tray-skins" id="tray-skins"></div>
|
|
<time id="clock"></time>
|
|
</div>
|
|
</footer>
|
|
</main>
|
|
</div>
|
|
|
|
<script id="desktop-payload" type="application/json"><?= $payloadJson ?></script>
|
|
<script src="<?= htmlspecialchars($assetVersion('/assets/desktop/desktop.js'), ENT_QUOTES) ?>"></script>
|
|
<?php if (!empty($baseSkinProfile['js_path'])): ?>
|
|
<script src="<?= htmlspecialchars($assetVersion((string) $baseSkinProfile['js_path']), ENT_QUOTES) ?>"></script>
|
|
<?php endif; ?>
|
|
<?php if (!empty($skinProfile['js_path']) && $skinProfile['js_path'] !== $baseSkinProfile['js_path']): ?>
|
|
<script src="<?= htmlspecialchars($assetVersion((string) $skinProfile['js_path']), ENT_QUOTES) ?>"></script>
|
|
<?php endif; ?>
|
|
<?php if ($hasMiningChecker): ?>
|
|
<link rel="stylesheet" href="<?= htmlspecialchars($assetVersion('/assets/apps/mining-checker/app.css'), ENT_QUOTES) ?>">
|
|
<script crossorigin src="https://unpkg.com/react@18/umd/react.production.min.js"></script>
|
|
<script crossorigin src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js"></script>
|
|
<script src="<?= htmlspecialchars($assetVersion('/assets/apps/mining-checker/app.js'), ENT_QUOTES) ?>"></script>
|
|
<?php endif; ?>
|
|
</body>
|
|
</html>
|