177 lines
7.2 KiB
PHP
177 lines
7.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
require_once dirname(__DIR__, 3) . '/src/App/bootstrap.php';
|
|
|
|
use App\ConfigLoader;
|
|
use App\KeycloakAuth;
|
|
|
|
session_start();
|
|
|
|
$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;
|
|
}
|
|
?><!DOCTYPE html>
|
|
<html lang="de">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>Mining-Checker</title>
|
|
<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>
|
|
|
|
<script src="<?= htmlspecialchars($assetVersion('/assets/apps/mining-checker/app.js'), ENT_QUOTES) ?>"></script>
|
|
</body>
|
|
</html>
|