mirror of
https://github.com/MrUnknownDE/utools.git
synced 2026-04-09 01:43:48 +02:00
259 lines
12 KiB
HTML
259 lines
12 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="de">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>IP Subnetz Rechner - uTools</title> <!-- Titel angepasst -->
|
|
<!-- Tailwind CSS Play CDN -->
|
|
<script src="https://cdn.tailwindcss.com"></script>
|
|
<!-- Eigene Styles (für Navigation etc., wie in index.html) -->
|
|
<style>
|
|
/* Navigations-Styling */
|
|
nav ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 1rem; } /* flex-wrap hinzugefügt */
|
|
nav a { color: #c4b5fd; /* purple-300 */ text-decoration: none; white-space: nowrap; } /* nowrap hinzugefügt */
|
|
nav a:hover { color: #a78bfa; /* purple-400 */ text-decoration: underline; }
|
|
header { background-color: #374151; /* gray-700 */ padding: 1rem; margin-bottom: 1.5rem; border-radius: 0.5rem; /* rounded-lg */ display: flex; flex-direction: column; align-items: center; gap: 0.5rem; } /* Flex direction geändert */
|
|
@media (min-width: 768px) { /* md breakpoint */
|
|
header { flex-direction: row; justify-content: space-between; }
|
|
}
|
|
header h1 { font-size: 1.5rem; /* text-2xl */ font-weight: bold; color: #e5e7eb; /* gray-200 */ }
|
|
|
|
/* Styling für Formular und Ergebnisse */
|
|
label { display: block; margin-bottom: 0.5rem; font-weight: 600; color: #d1d5db; /* gray-300 */ }
|
|
input[type="text"] {
|
|
width: 100%;
|
|
padding: 0.75rem;
|
|
margin-bottom: 1rem;
|
|
background-color: #4b5563; /* gray-600 */
|
|
border: 1px solid #6b7280; /* gray-500 */
|
|
border-radius: 0.375rem; /* rounded-md */
|
|
color: #e5e7eb; /* gray-200 */
|
|
font-family: monospace;
|
|
}
|
|
input[type="text"]:focus {
|
|
outline: none;
|
|
border-color: #a78bfa; /* purple-400 */
|
|
box-shadow: 0 0 0 2px rgba(167, 139, 250, 0.5);
|
|
}
|
|
button[type="submit"] {
|
|
background-color: #8b5cf6; /* purple-500 */
|
|
color: white;
|
|
padding: 0.75rem 1.5rem;
|
|
border: none;
|
|
border-radius: 0.375rem; /* rounded-md */
|
|
font-weight: 600;
|
|
cursor: pointer;
|
|
transition: background-color 0.2s;
|
|
}
|
|
button[type="submit"]:hover {
|
|
background-color: #7c3aed; /* purple-600 */
|
|
}
|
|
#results, #examples {
|
|
margin-top: 2rem;
|
|
padding: 1.5rem;
|
|
background-color: #374151; /* gray-700 */
|
|
border-radius: 0.5rem; /* rounded-lg */
|
|
}
|
|
#results h3, #examples h3 {
|
|
font-size: 1.25rem; /* text-xl */
|
|
font-weight: 600;
|
|
color: #c4b5fd; /* purple-300 */
|
|
margin-bottom: 1rem;
|
|
border-bottom: 1px solid #6b7280; /* gray-500 */
|
|
padding-bottom: 0.5rem;
|
|
}
|
|
#results p {
|
|
margin-bottom: 0.75rem;
|
|
color: #d1d5db; /* gray-300 */
|
|
}
|
|
#results p strong {
|
|
color: #e5e7eb; /* gray-200 */
|
|
min-width: 150px; /* Für bessere Ausrichtung */
|
|
display: inline-block;
|
|
}
|
|
#results span {
|
|
font-family: monospace;
|
|
color: #a78bfa; /* purple-400 */
|
|
}
|
|
/* Styling für Beispiel-Tabelle */
|
|
#examples table {
|
|
width: 100%;
|
|
border-collapse: collapse;
|
|
margin-top: 1rem;
|
|
}
|
|
#examples th, #examples td {
|
|
padding: 0.75rem;
|
|
text-align: left;
|
|
border-bottom: 1px solid #4b5563; /* gray-600 */
|
|
color: #d1d5db; /* gray-300 */
|
|
}
|
|
#examples th {
|
|
color: #e5e7eb; /* gray-200 */
|
|
font-weight: 600;
|
|
}
|
|
#examples td code {
|
|
font-family: monospace;
|
|
background-color: #4b5563; /* gray-600 */
|
|
padding: 0.2rem 0.4rem;
|
|
border-radius: 0.25rem;
|
|
color: #c4b5fd; /* purple-300 */
|
|
}
|
|
#examples .example-link {
|
|
color: #a78bfa; /* purple-400 */
|
|
cursor: pointer;
|
|
text-decoration: underline;
|
|
}
|
|
#examples .example-link:hover {
|
|
color: #c4b5fd; /* purple-300 */
|
|
}
|
|
.hidden { display: none; }
|
|
|
|
</style>
|
|
</head>
|
|
<body class="bg-gray-900 text-gray-200 font-sans p-4 md:p-8">
|
|
|
|
<header>
|
|
<h1>uTools Network Suite</h1> <!-- Titel angepasst -->
|
|
<nav>
|
|
<ul>
|
|
<li><a href="index.html">IP Info & Tools</a></li> <!-- Angepasst -->
|
|
<li><a href="subnet-calculator.html">Subnetz Rechner</a></li>
|
|
<li><a href="dns-lookup.html">DNS Lookup</a></li> <!-- Neu -->
|
|
<li><a href="whois-lookup.html">WHOIS Lookup</a></li> <!-- Neu -->
|
|
</ul>
|
|
</nav>
|
|
</header>
|
|
|
|
<div class="container mx-auto max-w-4xl bg-gray-800 rounded-lg shadow-xl p-6">
|
|
|
|
<h2 class="text-2xl font-bold mb-6 text-purple-400 text-center">IP Subnetz Rechner</h2>
|
|
|
|
<form id="subnet-form" class="mb-6">
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4">
|
|
<div>
|
|
<label for="ip-address">IP Adresse:</label>
|
|
<input type="text" id="ip-address" name="ip-address" placeholder="z.B. 192.168.1.1" required
|
|
class="w-full px-3 py-2 bg-gray-700 border border-gray-600 rounded text-gray-200 focus:outline-none focus:ring-2 focus:ring-purple-500 focus:border-transparent font-mono">
|
|
</div>
|
|
<div>
|
|
<label for="cidr">CIDR / Subnetzmaske:</label>
|
|
<input type="text" id="cidr" name="cidr" placeholder="z.B. 24 oder 255.255.255.0" required
|
|
class="w-full px-3 py-2 bg-gray-700 border border-gray-600 rounded text-gray-200 focus:outline-none focus:ring-2 focus:ring-purple-500 focus:border-transparent font-mono">
|
|
</div>
|
|
</div>
|
|
|
|
<button type="submit"
|
|
class="bg-purple-600 hover:bg-purple-700 text-white font-bold py-2 px-4 rounded transition duration-150 ease-in-out">
|
|
Berechnen
|
|
</button>
|
|
</form>
|
|
|
|
<div id="results" class="bg-gray-700 rounded p-6 hidden"> <!-- Ergebnisse initial verstecken -->
|
|
<h3 class="text-xl font-semibold text-purple-300 border-b border-purple-500 pb-2 mb-4">Ergebnisse:</h3>
|
|
<div class="space-y-2 text-sm">
|
|
<p><strong>Netzwerkadresse:</strong> <span id="network-address" class="font-mono text-purple-400">-</span></p>
|
|
<p><strong>Broadcast-Adresse:</strong> <span id="broadcast-address" class="font-mono text-purple-400">-</span></p>
|
|
<p><strong>Subnetzmaske:</strong> <span id="subnet-mask" class="font-mono text-purple-400">-</span></p>
|
|
<p><strong>Anzahl der Hosts:</strong> <span id="host-count" class="font-mono text-purple-400">-</span></p>
|
|
<p><strong>Erste Host-Adresse:</strong> <span id="first-host" class="font-mono text-purple-400">-</span></p>
|
|
<p><strong>Letzte Host-Adresse:</strong> <span id="last-host" class="font-mono text-purple-400">-</span></p>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Beispiel-Subnetze -->
|
|
<div id="examples" class="bg-gray-700 rounded p-6 mt-8">
|
|
<h3 class="text-xl font-semibold text-purple-300 border-b border-purple-500 pb-2 mb-4">Beispiel-Subnetze (Private Adressbereiche)</h3>
|
|
<div class="overflow-x-auto">
|
|
<table class="min-w-full text-sm">
|
|
<thead>
|
|
<tr>
|
|
<th>Bereich</th>
|
|
<th>CIDR</th>
|
|
<th>Subnetzmaske</th>
|
|
<th>Beschreibung</th>
|
|
<th>Aktion</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y divide-gray-600">
|
|
<tr>
|
|
<td><code>192.168.0.0 - 192.168.255.255</code></td>
|
|
<td><code>/16</code> (Gesamt)</td>
|
|
<td><code>255.255.0.0</code></td>
|
|
<td>Klasse C (oft als /24 genutzt)</td>
|
|
<td><span class="example-link" data-ip="192.168.1.1" data-cidr="24">Beispiel /24</span></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>172.16.0.0 - 172.31.255.255</code></td>
|
|
<td><code>/12</code> (Gesamt)</td>
|
|
<td><code>255.240.0.0</code></td>
|
|
<td>Klasse B</td>
|
|
<td><span class="example-link" data-ip="172.16.10.5" data-cidr="16">Beispiel /16</span></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>10.0.0.0 - 10.255.255.255</code></td>
|
|
<td><code>/8</code> (Gesamt)</td>
|
|
<td><code>255.0.0.0</code></td>
|
|
<td>Klasse A</td>
|
|
<td><span class="example-link" data-ip="10.0.50.100" data-cidr="8">Beispiel /8</span></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<p class="mt-4 text-xs text-gray-400">Klicken Sie auf "Beispiel", um die Felder oben auszufüllen und die Berechnung zu starten.</p>
|
|
</div>
|
|
|
|
<!-- Globaler Fehlerbereich -->
|
|
<div id="global-error" class="mt-6 p-4 bg-red-800 text-red-100 rounded hidden"></div>
|
|
|
|
</div>
|
|
|
|
<footer class="mt-8 pt-4 border-t border-gray-600 text-center text-xs text-gray-500">
|
|
<p>© 2025 <a href="https://johanneskr.de" class="text-purple-400 hover:underline">Johannes Krüger</a></p>
|
|
<p>Version: <span id="commit-sha" class="font-mono">loading...</span></p> <!-- Footer mit Version hinzugefügt -->
|
|
</footer>
|
|
|
|
<!-- Nur das Skript für den Rechner laden -->
|
|
<script src="subnet-calculator.js"></script>
|
|
<script>
|
|
// Kleine Ergänzung, um die Beispiel-Links klickbar zu machen und Version zu laden
|
|
document.addEventListener('DOMContentLoaded', () => {
|
|
// Beispiel-Links
|
|
document.querySelectorAll('.example-link').forEach(link => {
|
|
link.addEventListener('click', (event) => {
|
|
const ip = event.target.getAttribute('data-ip');
|
|
const cidr = event.target.getAttribute('data-cidr');
|
|
document.getElementById('ip-address').value = ip;
|
|
document.getElementById('cidr').value = cidr;
|
|
// Berechnung direkt auslösen
|
|
document.getElementById('subnet-form').dispatchEvent(new Event('submit', { bubbles: true, cancelable: true }));
|
|
window.scrollTo({ top: 0, behavior: 'smooth' }); // Nach oben scrollen
|
|
});
|
|
});
|
|
|
|
// Version laden (gemeinsame Funktion)
|
|
const commitShaEl = document.getElementById('commit-sha');
|
|
const globalErrorEl = document.getElementById('global-error');
|
|
const API_BASE_URL = '/api'; // Muss hier definiert sein, wenn nicht global
|
|
|
|
async function fetchVersionInfo() {
|
|
try {
|
|
const response = await fetch(`${API_BASE_URL}/version`);
|
|
if (!response.ok) throw new Error(`Network response: ${response.statusText} (${response.status})`);
|
|
const data = await response.json();
|
|
if (commitShaEl) {
|
|
commitShaEl.textContent = data.commitSha || 'unknown';
|
|
}
|
|
} catch (error) {
|
|
console.error('Failed to fetch version info:', error);
|
|
if (commitShaEl) commitShaEl.textContent = 'error';
|
|
if (globalErrorEl) { // Zeige Fehler global an, wenn Element existiert
|
|
globalErrorEl.textContent = `Error loading version: ${error.message}`;
|
|
globalErrorEl.classList.remove('hidden');
|
|
}
|
|
}
|
|
}
|
|
fetchVersionInfo();
|
|
});
|
|
</script>
|
|
</body>
|
|
</html> |