asdsad
This commit is contained in:
@@ -10,8 +10,12 @@ use App\KeycloakAuth;
|
||||
session_start();
|
||||
|
||||
$projectRoot = dirname(__DIR__, 3);
|
||||
$keycloakConfig = ConfigLoader::load($projectRoot, 'keycloak');
|
||||
$auth = new KeycloakAuth($keycloakConfig);
|
||||
$auth = new KeycloakAuth(ConfigLoader::load($projectRoot, 'keycloak'));
|
||||
|
||||
if (!$auth->shouldShowDesktop()) {
|
||||
header('Location: /auth/login', true, 302);
|
||||
exit;
|
||||
}
|
||||
|
||||
$assetVersion = static function (string $publicPath) use ($projectRoot): string {
|
||||
$filesystemPath = $projectRoot . '/public' . $publicPath;
|
||||
@@ -25,152 +29,85 @@ $assetVersion = static function (string $publicPath) use ($projectRoot): string
|
||||
return $mtime === false ? $publicPath : $publicPath . '?v=' . $mtime;
|
||||
};
|
||||
|
||||
if (!$auth->shouldShowDesktop()) {
|
||||
header('Location: /auth/login', true, 302);
|
||||
exit;
|
||||
$sections = [
|
||||
['key' => 'overview', 'label' => 'Übersicht'],
|
||||
['key' => 'upload', 'label' => 'Upload'],
|
||||
['key' => 'measurements', 'label' => 'Mining-History'],
|
||||
['key' => 'wallet', 'label' => 'Wallet'],
|
||||
['key' => 'mining', 'label' => 'Miner-Daten'],
|
||||
['key' => 'dashboards', 'label' => 'Dashboards'],
|
||||
];
|
||||
$defaultProjectKey = getenv('MINING_CHECKER_DEFAULT_PROJECT_KEY') ?: 'doge-main';
|
||||
$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="<?= htmlspecialchars($assetVersion('/assets/apps/mining-checker/app.css'), ENT_QUOTES) ?>">
|
||||
</head>
|
||||
<body>
|
||||
<main class="mining-app" id="mining-checker-app">
|
||||
<section class="mining-hero">
|
||||
<div>
|
||||
<p class="mining-kicker">App Modul</p>
|
||||
<h1>Mining-Checker</h1>
|
||||
<p class="mining-copy">Profitabilitaet, Stromkosten, ROI und Messhistorie fuer dein Mining-Setup.</p>
|
||||
</div>
|
||||
<div class="mining-hero-actions">
|
||||
<button type="button" class="preset-button" data-preset="doge">DOGE Basis</button>
|
||||
<button type="button" class="preset-button" data-preset="ltc">LTC Basis</button>
|
||||
<button type="button" class="preset-button" data-preset="custom">Aktuelle Werte behalten</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="mining-layout">
|
||||
<form class="mining-panel mining-form" id="mining-settings-form">
|
||||
<div class="panel-header">
|
||||
<h2>Setup</h2>
|
||||
<p>Alle Werte werden pro Benutzer gespeichert.</p>
|
||||
</div>
|
||||
|
||||
<div class="form-grid">
|
||||
<label>
|
||||
<span>Projektname</span>
|
||||
<input name="project_name" type="text" required>
|
||||
</label>
|
||||
<label>
|
||||
<span>Coin Symbol</span>
|
||||
<input name="coin_symbol" type="text" required>
|
||||
</label>
|
||||
<label>
|
||||
<span>Algorithmus</span>
|
||||
<input name="algorithm" type="text" required>
|
||||
</label>
|
||||
<label>
|
||||
<span>Waehrung</span>
|
||||
<input name="currency" type="text" maxlength="3" required>
|
||||
</label>
|
||||
<label>
|
||||
<span>Hashrate</span>
|
||||
<input name="hashrate" type="number" min="0" step="0.01" required>
|
||||
</label>
|
||||
<label>
|
||||
<span>Hashrate Einheit</span>
|
||||
<select name="hashrate_unit">
|
||||
<option>KH/s</option>
|
||||
<option selected>MH/s</option>
|
||||
<option>GH/s</option>
|
||||
<option>TH/s</option>
|
||||
<option>PH/s</option>
|
||||
</select>
|
||||
</label>
|
||||
<label>
|
||||
<span>Netzwerk Hashrate</span>
|
||||
<input name="network_hashrate" type="number" min="0" step="0.01" required>
|
||||
</label>
|
||||
<label>
|
||||
<span>Netzwerk Einheit</span>
|
||||
<select name="network_hashrate_unit">
|
||||
<option>GH/s</option>
|
||||
<option>TH/s</option>
|
||||
<option selected>PH/s</option>
|
||||
<option>EH/s</option>
|
||||
</select>
|
||||
</label>
|
||||
<label>
|
||||
<span>Block Reward</span>
|
||||
<input name="block_reward" type="number" min="0" step="0.00000001" required>
|
||||
</label>
|
||||
<label>
|
||||
<span>Blockzeit in Sekunden</span>
|
||||
<input name="block_time_seconds" type="number" min="1" step="1" required>
|
||||
</label>
|
||||
<label>
|
||||
<span>Coin Preis</span>
|
||||
<input name="coin_price" type="number" min="0" step="0.00000001" required>
|
||||
</label>
|
||||
<label>
|
||||
<span>Leistungsaufnahme in Watt</span>
|
||||
<input name="power_watts" type="number" min="0" step="1" required>
|
||||
</label>
|
||||
<label>
|
||||
<span>Strompreis pro kWh</span>
|
||||
<input name="electricity_price" type="number" min="0" step="0.0001" required>
|
||||
</label>
|
||||
<label>
|
||||
<span>Pool Fee in %</span>
|
||||
<input name="pool_fee_percent" type="number" min="0" max="100" step="0.01" required>
|
||||
</label>
|
||||
<label>
|
||||
<span>Hardwarekosten</span>
|
||||
<input name="hardware_cost" type="number" min="0" step="0.01" required>
|
||||
</label>
|
||||
<label class="form-span-2">
|
||||
<span>Notizen</span>
|
||||
<textarea name="notes" rows="4" placeholder="Optional: Modell, Pool, Standort, Temperatur, Firmware ..."></textarea>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<button type="submit" class="primary-button">Einstellungen speichern</button>
|
||||
<button type="button" class="secondary-button" id="snapshot-button">Snapshot speichern</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="mining-sidebar">
|
||||
<section class="mining-panel">
|
||||
<div class="panel-header">
|
||||
<h2>Kennzahlen</h2>
|
||||
<p>Direkt aus den aktuellen Werten berechnet.</p>
|
||||
</div>
|
||||
<div class="stats-grid" id="stats-grid"></div>
|
||||
</section>
|
||||
|
||||
<section class="mining-panel">
|
||||
<div class="panel-header">
|
||||
<h2>Snapshot Verlauf</h2>
|
||||
<p>Gespeicherte Stichtage pro Benutzer.</p>
|
||||
</div>
|
||||
<div class="history-list" id="history-list"></div>
|
||||
</section>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
<template id="stat-card-template">
|
||||
<article class="stat-card">
|
||||
<span class="stat-label"></span>
|
||||
<strong class="stat-value"></strong>
|
||||
<small class="stat-meta"></small>
|
||||
</article>
|
||||
</template>
|
||||
<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/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="<?= htmlspecialchars($assetVersion('/assets/apps/mining-checker/app.js'), ENT_QUOTES) ?>"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user