ssdfdsf
This commit is contained in:
@@ -8,6 +8,18 @@ $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;
|
||||
};
|
||||
|
||||
$renderStartIcon = static function (array $profile): string {
|
||||
$style = (string) ($profile['taskbar_icon_style'] ?? 'label');
|
||||
|
||||
@@ -24,12 +36,12 @@ $renderStartIcon = static function (array $profile): string {
|
||||
<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="/assets/desktop/desktop.css">
|
||||
<link rel="stylesheet" href="<?= htmlspecialchars($assetVersion('/assets/desktop/desktop.css'), ENT_QUOTES) ?>">
|
||||
<?php if (!empty($baseSkinProfile['css_path'])): ?>
|
||||
<link rel="stylesheet" href="<?= htmlspecialchars((string) $baseSkinProfile['css_path'], ENT_QUOTES) ?>">
|
||||
<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((string) $skinProfile['css_path'], ENT_QUOTES) ?>">
|
||||
<link rel="stylesheet" href="<?= htmlspecialchars($assetVersion((string) $skinProfile['css_path']), ENT_QUOTES) ?>">
|
||||
<?php endif; ?>
|
||||
</head>
|
||||
<body
|
||||
@@ -123,12 +135,12 @@ $renderStartIcon = static function (array $profile): string {
|
||||
</div>
|
||||
|
||||
<script id="desktop-payload" type="application/json"><?= $payloadJson ?></script>
|
||||
<script src="/assets/desktop/desktop.js"></script>
|
||||
<script src="<?= htmlspecialchars($assetVersion('/assets/desktop/desktop.js'), ENT_QUOTES) ?>"></script>
|
||||
<?php if (!empty($baseSkinProfile['js_path'])): ?>
|
||||
<script src="<?= htmlspecialchars((string) $baseSkinProfile['js_path'], ENT_QUOTES) ?>"></script>
|
||||
<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((string) $skinProfile['js_path'], ENT_QUOTES) ?>"></script>
|
||||
<script src="<?= htmlspecialchars($assetVersion((string) $skinProfile['js_path']), ENT_QUOTES) ?>"></script>
|
||||
<?php endif; ?>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -13,6 +13,18 @@ $projectRoot = dirname(__DIR__, 3);
|
||||
$keycloakConfig = ConfigLoader::load($projectRoot, 'keycloak');
|
||||
$auth = new KeycloakAuth($keycloakConfig);
|
||||
|
||||
$assetVersion = static function (string $publicPath) use ($projectRoot): string {
|
||||
$filesystemPath = $projectRoot . '/public' . $publicPath;
|
||||
|
||||
if (!is_file($filesystemPath)) {
|
||||
return $publicPath;
|
||||
}
|
||||
|
||||
$mtime = filemtime($filesystemPath);
|
||||
|
||||
return $mtime === false ? $publicPath : $publicPath . '?v=' . $mtime;
|
||||
};
|
||||
|
||||
if (!$auth->shouldShowDesktop()) {
|
||||
header('Location: /auth/login', true, 302);
|
||||
exit;
|
||||
@@ -23,7 +35,7 @@ if (!$auth->shouldShowDesktop()) {
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Mining-Checker</title>
|
||||
<link rel="stylesheet" href="/assets/apps/mining-checker/app.css">
|
||||
<link rel="stylesheet" href="<?= htmlspecialchars($assetVersion('/assets/apps/mining-checker/app.css'), ENT_QUOTES) ?>">
|
||||
</head>
|
||||
<body>
|
||||
<main class="mining-app" id="mining-checker-app">
|
||||
@@ -159,6 +171,6 @@ if (!$auth->shouldShowDesktop()) {
|
||||
</article>
|
||||
</template>
|
||||
|
||||
<script src="/assets/apps/mining-checker/app.js"></script>
|
||||
<script src="<?= htmlspecialchars($assetVersion('/assets/apps/mining-checker/app.js'), ENT_QUOTES) ?>"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -41,6 +41,7 @@ final class AppIconResolver
|
||||
'workspace-manager' => '/assets/desktop/skin-icons/windows/workspace-manager.ico',
|
||||
'admin-apps' => '/assets/desktop/skin-icons/windows/admin-apps.ico',
|
||||
'desktop-login' => '/assets/desktop/skin-icons/windows/desktop-login.ico',
|
||||
'mining-checker' => '/assets/desktop/skin-icons/windows/admin-apps.ico',
|
||||
],
|
||||
'apple' => [
|
||||
'welcome-center' => '/assets/desktop/skin-icons/apple/welcome-center.svg',
|
||||
@@ -48,6 +49,7 @@ final class AppIconResolver
|
||||
'workspace-manager' => '/assets/desktop/skin-icons/apple/workspace-manager.svg',
|
||||
'admin-apps' => '/assets/desktop/skin-icons/apple/admin-apps.svg',
|
||||
'desktop-login' => '/assets/desktop/skin-icons/apple/desktop-login.svg',
|
||||
'mining-checker' => '/assets/desktop/skin-icons/apple/admin-apps.svg',
|
||||
],
|
||||
'linux' => [
|
||||
'welcome-center' => '/assets/desktop/skin-icons/linux/welcome-center.svg',
|
||||
@@ -55,6 +57,7 @@ final class AppIconResolver
|
||||
'workspace-manager' => '/assets/desktop/skin-icons/linux/workspace-manager.svg',
|
||||
'admin-apps' => '/assets/desktop/skin-icons/linux/admin-apps.svg',
|
||||
'desktop-login' => '/assets/desktop/skin-icons/linux/desktop-login.svg',
|
||||
'mining-checker' => '/assets/desktop/skin-icons/linux/admin-apps.svg',
|
||||
],
|
||||
default => [],
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user