asdasd
This commit is contained in:
103
custom/apps/mining-checker/pages/index.php
Normal file
103
custom/apps/mining-checker/pages/index.php
Normal file
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
require_once dirname(__DIR__, 3) . '/src/App/bootstrap.php';
|
||||
require_once dirname(__DIR__) . '/bootstrap.php';
|
||||
|
||||
use ModulesCore\ModuleHttp;
|
||||
|
||||
session_start();
|
||||
|
||||
$projectRoot = dirname(__DIR__, 3);
|
||||
ModuleHttp::requireDesktopAccess($projectRoot);
|
||||
|
||||
$design = [];
|
||||
$designRaw = is_file(dirname(__DIR__) . '/design.json') ? file_get_contents(dirname(__DIR__) . '/design.json') : false;
|
||||
if ($designRaw !== false) {
|
||||
$decoded = json_decode($designRaw, true);
|
||||
$design = is_array($decoded) ? $decoded : [];
|
||||
}
|
||||
|
||||
$moduleConfig = require dirname(__DIR__) . '/config/module.php';
|
||||
$defaultProjectKey = (string) ($moduleConfig['default_project_key'] ?? 'doge-main');
|
||||
$assetVersion = static function (string $relativePath): string {
|
||||
$fullPath = dirname(__DIR__) . '/' . ltrim($relativePath, '/');
|
||||
$mtime = is_file($fullPath) ? filemtime($fullPath) : false;
|
||||
|
||||
return $mtime === false ? '0' : (string) $mtime;
|
||||
};
|
||||
$sections = is_array($design['sections'] ?? null) ? $design['sections'] : [];
|
||||
$activeView = trim((string) ($_GET['view'] ?? 'overview'));
|
||||
$sectionKeys = array_values(array_filter(array_map(
|
||||
static fn (mixed $section): string => is_array($section) ? trim((string) ($section['key'] ?? '')) : '',
|
||||
$sections
|
||||
)));
|
||||
|
||||
if ($sectionKeys === []) {
|
||||
$sectionKeys = ['overview'];
|
||||
}
|
||||
|
||||
if (!in_array($activeView, $sectionKeys, true)) {
|
||||
$activeView = $sectionKeys[0];
|
||||
}
|
||||
|
||||
$sectionsJson = json_encode($sections, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
||||
?><!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Mining-Checker</title>
|
||||
<style>
|
||||
:root {
|
||||
color-scheme: light;
|
||||
--surface: rgba(255, 255, 255, 0.92);
|
||||
--line: rgba(148, 163, 184, 0.24);
|
||||
--text: #0f172a;
|
||||
--muted: #475569;
|
||||
--brand-accent: #14b8a6;
|
||||
--brand-accent-3: #0f766e;
|
||||
font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
html,
|
||||
body {
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
background:
|
||||
radial-gradient(circle at top left, rgba(45, 212, 191, 0.12), transparent 24%),
|
||||
linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.mining-module-shell {
|
||||
min-height: 100vh;
|
||||
padding: 18px;
|
||||
}
|
||||
</style>
|
||||
<link rel="stylesheet" href="/module-assets/index.php?module=mining-checker&path=assets/css/app.css&v=<?= htmlspecialchars($assetVersion('assets/css/app.css'), ENT_QUOTES) ?>">
|
||||
</head>
|
||||
<body data-module-debug-enabled="0">
|
||||
<div class="mining-module-shell">
|
||||
<div
|
||||
id="mining-checker-app"
|
||||
data-default-project-key="<?= htmlspecialchars($defaultProjectKey, ENT_QUOTES) ?>"
|
||||
data-api-base="/api/mining-checker/index.php?path=v1"
|
||||
data-active-view="<?= htmlspecialchars($activeView, ENT_QUOTES) ?>"
|
||||
data-sections-json="<?= htmlspecialchars(is_string($sectionsJson) ? $sectionsJson : '[]', ENT_QUOTES) ?>"
|
||||
></div>
|
||||
</div>
|
||||
|
||||
<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="/module-assets/index.php?module=mining-checker&path=assets/js/app.js&v=<?= htmlspecialchars($assetVersion('assets/js/app.js'), ENT_QUOTES) ?>"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user