monitor/html/mon.html
2025-11-11 10:01:47 +00:00

207 lines
9.2 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<meta http-equiv="Refresh" content="60">
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/png" href="/favicon.png">
<title>FDS Server-Status</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="hamburger" id="hamburger">☰</div>
<div class="nav-menu" id="navMenu">
<span class="close-btn" id="closeBtn">×</span>
<a href="#" id="homeLink">Startseite</a>
<a href="#" id="settingsLink">Einstellungen</a>
</div>
<div id="content">
<h1>Server-Status &Uuml;bersicht</h1>
<table id="serverTable">
<thead>
<tr>
<th>Hostname</th>
<th>IP-Adresse</th>
<th>Status</th>
<th>Letzte Prüfung</th>
</tr>
</thead>
<tbody id="serverData">
<!-- Daten werden per JavaScript eingefügt -->
</tbody>
</table>
</div>
<div id="settingsPage" style="display: none;">
<h1>Einstellungen</h1>
<form class="settings-form" id="timezoneForm">
<label for="timezone">Zeitzone:</label>
<select id="timezone" name="timezone">
<option value="UTC">UTC</option>
<option value="Europe/Berlin">UTC+1 / UTC+2 (Berlin, MEZ/MESZ)</option>
<option value="UTC">UTC (Koordinierte Weltzeit)</option>
<option value="Europe/London">UTC+0 / UTC+1 (London, GMT/BST)</option>
<option value="Europe/Berlin">UTC+1 / UTC+2 (Berlin, MEZ/MESZ)</option>
<option value="Europe/Moscow">UTC+3 (Moskau, MSK)</option>
<option value="Asia/Dubai">UTC+4 (Dubai, GST)</option>
<option value="Asia/Karachi">UTC+5 (Karachi, PKT)</option>
<option value="Asia/Dhaka">UTC+6 (Dhaka, BST)</option>
<option value="Asia/Bangkok">UTC+7 (Bangkok, ICT)</option>
<option value="Asia/Shanghai">UTC+8 (Shanghai, CST)</option>
<option value="Asia/Tokyo">UTC+9 (Tokio, JST)</option>
<option value="Australia/Sydney">UTC+10 / UTC+11 (Sydney, AEST/AEDT)</option>
<option value="Pacific/Auckland">UTC+12 / UTC+13 (Auckland, NZST/NZDT)</option>
<option value="Pacific/Guadalcanal">UTC+11 (Guadalcanal, SBT)</option>
<option value="Asia/Kamchatka">UTC+12 (Kamtschatka, PETT)</option>
<option value="Pacific/Chatham">UTC+12:45 (Chatham, CHAST/CHADT)</option>
<option value="America/New_York">UTC-5 / UTC-4 (New York, EST/EDT)</option>
<option value="America/Chicago">UTC-6 / UTC-5 (Chicago, CST/CDT)</option>
<option value="America/Denver">UTC-7 / UTC-6 (Denver, MST/MDT)</option>
<option value="America/Los_Angeles">UTC-8 / UTC-7 (Los Angeles, PST/PDT)</option>
<option value="America/Anchorage">UTC-9 / UTC-8 (Anchorage, AKST/AKDT)</option>
<option value="Pacific/Honolulu">UTC-10 (Honolulu, HST)</option>
<option value="Pacific/Pago_Pago">UTC-11 (Pago Pago, SST)</option>
<option value="Pacific/Kiritimati">UTC+14 (Kiritimati, LINT)</option>
<option value="Atlantic/Azores">UTC-1 / UTC+0 (Azoren, AZOT/AZOST)</option>
<option value="Atlantic/Cape_Verde">UTC-1 (Kap Verde, CVT)</option>
</select>
<button type="submit">Speichern</button>
</form>
</div>
<script>
// Navigation
document.getElementById('hamburger').addEventListener('click', function() {
document.getElementById('navMenu').style.display = 'block';
});
document.getElementById('closeBtn').addEventListener('click', function() {
document.getElementById('navMenu').style.display = 'none';
});
document.getElementById('homeLink').addEventListener('click', function(e) {
e.preventDefault();
document.getElementById('content').style.display = 'block';
document.getElementById('settingsPage').style.display = 'none';
document.getElementById('navMenu').style.display = 'none';
});
document.getElementById('settingsLink').addEventListener('click', function(e) {
e.preventDefault();
document.getElementById('content').style.display = 'none';
document.getElementById('settingsPage').style.display = 'block';
document.getElementById('navMenu').style.display = 'none';
});
// Timezone Cookie
function getCookie(name) {
const value = `; ${document.cookie}`;
const parts = value.split(`; ${name}=`);
if (parts.length === 2) return parts.pop().split(';').shift();
}
function setCookie(name, value, days = 365) {
const date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
document.cookie = `${name}=${value}; expires=${date.toUTCString()}; path=/`;
}
function loadTimezone() {
const savedTimezone = getCookie('userTimezone');
if (savedTimezone) {
document.getElementById('timezone').value = savedTimezone;
}
}
document.getElementById('timezoneForm').addEventListener('submit', function(e) {
e.preventDefault();
const timezone = document.getElementById('timezone').value;
setCookie('userTimezone', timezone);
alert('Zeitzone gespeichert!');
loadServerData();
});
// Serverdaten laden
function loadServerData() {
fetch('status.txt')
.then(response => response.text())
.then(data => {
const lines = data.split('\n');
const tbody = document.getElementById('serverData');
tbody.innerHTML = '';
const userTimezone = getCookie('userTimezone') || 'UTC';
lines.forEach(line => {
if (line.trim() === '') return;
const [hostname, ip, status, checkdat, checktim] = line.split(' ');
const tr = document.createElement('tr');
// Kombiniere Datum und Uhrzeit zu einem ISO-String
const isoString = `${checkdat}T${checktim}Z`;
const date = new Date(isoString);
// Formatiere das Datum in die gewünschte Zeitzone
const formatter = new Intl.DateTimeFormat('de-DE', {
timeZone: userTimezone,
dateStyle: 'short',
timeStyle: 'medium',
hour12: false
});
const localTimeStr = formatter.format(date);
let dateStr = `${checkdat.replace(/T/, ' ')} ${checktim.replace(/T/, ' ')}`;
if (userTimezone !== 'UTC') {
dateStr += ` (${userTimezone})`;
}
tr.innerHTML = `
<td>${hostname}</td>
<td>${ip}</td>
<td><span class="status ${status.toLowerCase()}">${status}</span></td>
<td class="last-check">${localTimeStr} (${userTimezone}}</td>
`;
tbody.appendChild(tr);
});
})
.catch(error => {
console.error('Fehler beim Laden der status.conf:', error);
document.getElementById('serverData').innerHTML = `
<tr>
<td colspan="4" style="text-align: center; color: red;">
Fehler beim Laden der Serverdaten.
</td>
</tr>
`;
});
}
document.addEventListener('DOMContentLoaded', function() {
loadTimezone();
loadServerData();
});
</script>
<div id="timezonestring"></div>
<div id ="datumuhrzeit"onload="currentTime()"></div>
<script>
function currentTime() {
let date = new Date();
let dd = date.getDate();
let m = date.getMonth() + 1;
let yy = date.getFullYear();
let hh = date.getHours();
let mm = date.getMinutes();
let ss = date.getSeconds();
dd = (dd < 10) ? "0" + dd : dd;
m = (m < 10) ? "0" + m : m;
hh = (hh < 10) ? "0" + hh : hh;
mm = (mm < 10) ? "0" + mm : mm;
ss = (ss < 10) ? "0" + ss : ss;
let time = dd + "." + m + "." + yy + "\u00A0\u00A0\u00A0\u00A0" + hh + ":" + mm + ":" + ss + " Uhr" ;
document.getElementById("datumuhrzeit").innerText = time;
let t = setTimeout(function(){ currentTime() }, 1000);
}
currentTime();
document.addEventListener('DOMContentLoaded', function() {
const timezoneElement = document.getElementById('timezonestring');
const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
timezoneElement.innerText = timezone;
console.log(timezone);
});
</script>
</body>
</html>