6 Commits
1.0 ... main

Author SHA1 Message Date
c194a99886 style.css aktualisiert 2025-12-06 15:13:59 +00:00
43699a210f background.js aktualisiert 2025-12-06 15:13:40 +00:00
f78de6f2ff options.js aktualisiert 2025-12-06 15:13:12 +00:00
2a61d6a577 popup.js aktualisiert 2025-12-06 15:12:57 +00:00
0436da7d97 manifest.json aktualisiert 2025-12-06 15:12:43 +00:00
b5f180f16e options.html aktualisiert 2025-12-06 15:12:28 +00:00
6 changed files with 1523 additions and 1247 deletions

View File

@@ -1,165 +1,203 @@
// In Minuten (1 Minute) // In Minuten (1 Minute)
const CHECK_INTERVAL_MINUTES = 1; const CHECK_INTERVAL_MINUTES = 1;
const HISTORY_RETENTION_DAYS = 7; const HISTORY_RETENTION_DAYS = 7;
// Funktion, um einen einzelnen Dienst zu prüfen und die Antwortzeit zu messen // Funktion, um einen einzelnen Dienst zu prüfen und die Antwortzeit zu messen
async function checkService(service) { async function checkService(service) {
const startTime = performance.now(); const startTime = performance.now();
try { try {
const response = await fetch(service.adresse, { method: 'HEAD', mode: 'no-cors', cache: 'no-cache' }); const response = await fetch(service.adresse, { method: 'HEAD', mode: 'no-cors', cache: 'no-cache' });
const endTime = performance.now(); const endTime = performance.now();
const responseTime = Math.round(endTime - startTime); const responseTime = Math.round(endTime - startTime);
return { status: 'online', responseTime }; return { status: 'online', responseTime };
} catch (error) { } catch (error) {
return { status: 'offline', responseTime: null }; return { status: 'offline', responseTime: null };
} }
} }
// Funktion, um Verlaufsdaten zu aktualisieren // Funktion, um Verlaufsdaten zu aktualisieren
async function updateHistory(serviceName, status) { async function updateHistory(serviceName, status) {
const data = await chrome.storage.local.get({ history: {} }); const data = await chrome.storage.local.get({ history: {} });
const history = data.history; const history = data.history;
const now = new Date(); const now = new Date();
const hourKey = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')}-${String(now.getHours()).padStart(2, '0')}`; const hourKey = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')}-${String(now.getHours()).padStart(2, '0')}`;
if (!history[serviceName]) history[serviceName] = {}; if (!history[serviceName]) history[serviceName] = {};
if (!history[serviceName][hourKey]) history[serviceName][hourKey] = { checks: 0, up_checks: 0 }; if (!history[serviceName][hourKey]) history[serviceName][hourKey] = { checks: 0, up_checks: 0 };
history[serviceName][hourKey].checks++; history[serviceName][hourKey].checks++;
if (status === 'online') history[serviceName][hourKey].up_checks++; if (status === 'online') history[serviceName][hourKey].up_checks++;
await chrome.storage.local.set({ history }); await chrome.storage.local.set({ history });
} }
// Funktion, um alte Verlaufsdaten zu löschen // Funktion, um alte Verlaufsdaten zu löschen
async function cleanupHistory() { async function cleanupHistory() {
const data = await chrome.storage.local.get({ history: {} }); const data = await chrome.storage.local.get({ history: {} });
const history = data.history; const history = data.history;
const cutoffDate = new Date(); const cutoffDate = new Date();
cutoffDate.setDate(cutoffDate.getDate() - HISTORY_RETENTION_DAYS); cutoffDate.setDate(cutoffDate.getDate() - HISTORY_RETENTION_DAYS);
const cutoffHourKey = `${cutoffDate.getFullYear()}-${String(cutoffDate.getMonth() + 1).padStart(2, '0')}-${String(cutoffDate.getDate()).padStart(2, '0')}-${String(cutoffDate.getHours()).padStart(2, '0')}`; const cutoffHourKey = `${cutoffDate.getFullYear()}-${String(cutoffDate.getMonth() + 1).padStart(2, '0')}-${String(cutoffDate.getDate()).padStart(2, '0')}-${String(cutoffDate.getHours()).padStart(2, '0')}`;
for (const serviceName in history) { for (const serviceName in history) {
for (const hourKey in history[serviceName]) { for (const hourKey in history[serviceName]) {
if (hourKey < cutoffHourKey) delete history[serviceName][hourKey]; if (hourKey < cutoffHourKey) delete history[serviceName][hourKey];
} }
if (Object.keys(history[serviceName]).length === 0) delete history[serviceName]; if (Object.keys(history[serviceName]).length === 0) delete history[serviceName];
} }
await chrome.storage.local.set({ history }); await chrome.storage.local.set({ history });
} }
// NEU: Funktion zum Senden einer Discord-Benachrichtigung // Funktion zum Senden einer Discord-Benachrichtigung
async function sendDiscordNotification(service, status, responseTime = null) { async function sendDiscordNotification(service, status, responseTime = null) {
const settings = await chrome.storage.sync.get({ discordWebhookUrl: '' }); const settings = await chrome.storage.sync.get({ discordWebhookUrl: '' });
if (!settings.discordWebhookUrl) return; // Kein Webhook konfiguriert if (!settings.discordWebhookUrl) return; // Kein Webhook konfiguriert
const isOnline = status === 'online'; const isOnline = status === 'online';
const embed = { const embed = {
title: `Status-Update: ${service.name}`, title: `Status-Update: ${service.name}`,
url: service.adresse, url: service.adresse,
description: isOnline ? '✅ Der Server ist wieder online.' : '❌ Der Server ist nicht erreichbar.', description: isOnline ? '✅ Der Server ist wieder online.' : '❌ Der Server ist nicht erreichbar.',
color: isOnline ? 0x31A24C : 0xE4606D, // Grün / Rot color: isOnline ? 0x31A24C : 0xE4606D, // Grün / Rot
timestamp: new Date().toISOString(), timestamp: new Date().toISOString(),
fields: [ fields: [
{ name: 'Status', value: status.toUpperCase(), inline: true }, { name: 'Status', value: status.toUpperCase(), inline: true },
{ name: 'Adresse', value: service.adresse, inline: true } { name: 'Adresse', value: service.adresse, inline: true }
] ]
}; };
if (isOnline && responseTime !== null) { if (isOnline && responseTime !== null) {
embed.fields.push({ name: 'Antwortzeit', value: `${responseTime} ms`, inline: true }); embed.fields.push({ name: 'Antwortzeit', value: `${responseTime} ms`, inline: true });
} }
const payload = { const payload = {
username: 'Uptime Monitor', username: 'Uptime Monitor',
embeds: [embed] embeds: [embed]
}; };
try { try {
const response = await fetch(settings.discordWebhookUrl, { const response = await fetch(settings.discordWebhookUrl, {
method: 'POST', method: 'POST',
headers: { 'Content-Type': 'application/json' }, headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload) body: JSON.stringify(payload)
}); });
if (!response.ok) { if (!response.ok) {
console.error('Discord-Webhook fehlgeschlagen:', response.statusText, await response.text()); console.error('Discord-Webhook fehlgeschlagen:', response.statusText, await response.text());
} }
} catch (error) { } catch (error) {
console.error('Fehler beim Senden der Discord-Benachrichtigung:', error); console.error('Fehler beim Senden der Discord-Benachrichtigung:', error);
} }
} }
// MODIFIZIERT: Funktion, um alle Dienste zu prüfen und Benachrichtigungen zu senden // NEU: Funktion zum Senden einer Telegram-Benachrichtigung
async function checkAllServices() { async function sendTelegramNotification(service, status, responseTime = null) {
const data = await chrome.storage.sync.get({ services: [], notifyOnline: false }); const settings = await chrome.storage.sync.get({ telegramBotToken: '', telegramChatId: '' });
const services = data.services; if (!settings.telegramBotToken || !settings.telegramChatId) return; // Nicht konfiguriert
const notifyOnline = data.notifyOnline;
const isOnline = status === 'online';
if (services.length === 0) return; const emoji = isOnline ? '✅' : '❌';
let message = `${emoji} *${service.name}*\nStatus: ${status.toUpperCase()}\nAdresse: ${service.adresse}`;
const lastStatusData = await chrome.storage.local.get({ serviceStatus: {} });
const lastStatus = lastStatusData.serviceStatus; if (isOnline && responseTime !== null) {
message += `\nAntwortzeit: ${responseTime} ms`;
for (const service of services) { }
const currentResult = await checkService(service);
const previousResult = lastStatus[service.name]; const url = `https://api.telegram.org/bot${settings.telegramBotToken}/sendMessage`;
lastStatus[service.name] = currentResult;
const payload = {
// Benachrichtigung für Offline-Wechsel chat_id: settings.telegramChatId,
if (previousResult?.status === 'online' && currentResult.status === 'offline') { text: message,
chrome.notifications.create({ parse_mode: 'Markdown' // Für Markdown-Formatierung
type: 'basic', iconUrl: 'icons/notification_warning.png', };
title: `Server "${service.name}" ist offline`,
message: 'Der Dienst antwortet nicht mehr.', contextMessage: `Adresse: ${service.adresse}`, try {
priority: 1, isClickable: true, const response = await fetch(url, {
buttons: [{ title: 'Anzeigen' }, { title: 'Ignorieren' }] method: 'POST',
}); headers: { 'Content-Type': 'application/json' },
await sendDiscordNotification(service, 'offline'); // NEU body: JSON.stringify(payload)
} });
if (!response.ok) {
// Benachrichtigung für Online-Wechsel (wenn aktiviert) const errorData = await response.json();
if (notifyOnline && previousResult?.status === 'offline' && currentResult.status === 'online') { console.error('Telegram-Bot API fehlgeschlagen:', response.statusText, errorData);
chrome.notifications.create({ }
type: 'basic', iconUrl: 'icons/notification_warning.png', } catch (error) {
title: `Server "${service.name}" ist wieder online!`, console.error('Fehler beim Senden der Telegram-Benachrichtigung:', error);
message: 'Der Dienst ist wieder erreichbar.', contextMessage: `Adresse: ${service.adresse}`, }
priority: 0, isClickable: true, }
buttons: [{ title: 'Anzeigen' }]
}); // MODIFIZIERT: Funktion, um alle Dienste zu prüfen und Benachrichtigungen zu senden
await sendDiscordNotification(service, 'online', currentResult.responseTime); // NEU async function checkAllServices() {
} const data = await chrome.storage.sync.get({ services: [], notifyOnline: false });
const services = data.services;
// Verlaufsdaten aktualisieren const notifyOnline = data.notifyOnline;
await updateHistory(service.name, currentResult.status);
} if (services.length === 0) return;
await chrome.storage.local.set({ serviceStatus: lastStatus }); const lastStatusData = await chrome.storage.local.get({ serviceStatus: {} });
} const lastStatus = lastStatusData.serviceStatus;
// Alarm und Setup-Logik for (const service of services) {
async function setupAlarm() { const currentResult = await checkService(service);
const data = await chrome.storage.sync.get({ checkInterval: 1 }); const previousResult = lastStatus[service.name];
const intervalMinutes = data.checkInterval; lastStatus[service.name] = currentResult;
await chrome.alarms.clear('uptimeCheck');
chrome.alarms.create('uptimeCheck', { periodInMinutes: intervalMinutes }); // Benachrichtigung für Offline-Wechsel
} if (previousResult?.status === 'online' && currentResult.status === 'offline') {
chrome.notifications.create({
chrome.runtime.onInstalled.addListener(() => { setupAlarm(); }); type: 'basic',
chrome.runtime.onStartup.addListener(() => { setupAlarm(); }); iconUrl: 'icons/notification_warning.png',
chrome.alarms.onAlarm.addListener((alarm) => { if (alarm.name === 'uptimeCheck') checkAllServices(); }); title: `Server "${service.name}" ist offline`,
message: 'Der Dienst antwortet nicht mehr.',
// Nachrichtensystem für Einstellungen contextMessage: `Adresse: ${service.adresse}`,
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => { priority: 1,
if (message.type === 'updateInterval') { setupAlarm().then(() => sendResponse({ status: 'ok' })); return true; } isClickable: true
if (message.type === 'cleanupHistory') { cleanupHistory().then(() => sendResponse({ status: 'ok' })); return true; } });
}); await sendDiscordNotification(service, 'offline');
await sendTelegramNotification(service, 'offline'); // NEU
// Benachrichtigungs-Listener }
chrome.notifications.onButtonClicked.addListener((notificationId, buttonIndex) => {
if (buttonIndex === 0) chrome.action.openPopup(); // Benachrichtigung für Online-Wechsel (wenn aktiviert)
chrome.notifications.clear(notificationId); if (notifyOnline && previousResult?.status === 'offline' && currentResult.status === 'online') {
}); chrome.notifications.create({
chrome.notifications.onClicked.addListener((notificationId) => { type: 'basic',
chrome.action.openPopup(); iconUrl: 'icons/notification_warning.png',
chrome.notifications.clear(notificationId); title: `Server "${service.name}" ist wieder online!`,
message: 'Der Dienst ist wieder erreichbar.',
contextMessage: `Adresse: ${service.adresse}`,
priority: 0,
isClickable: true
});
await sendDiscordNotification(service, 'online', currentResult.responseTime);
await sendTelegramNotification(service, 'online', currentResult.responseTime);
}
// Verlaufsdaten aktualisieren
await updateHistory(service.name, currentResult.status);
}
await chrome.storage.local.set({ serviceStatus: lastStatus });
}
// Alarm und Setup-Logik
async function setupAlarm() {
const data = await chrome.storage.sync.get({ checkInterval: 1 });
const intervalMinutes = data.checkInterval;
await chrome.alarms.clear('uptimeCheck');
chrome.alarms.create('uptimeCheck', { periodInMinutes: intervalMinutes });
}
chrome.runtime.onInstalled.addListener(() => { setupAlarm(); });
chrome.runtime.onStartup.addListener(() => { setupAlarm(); });
chrome.alarms.onAlarm.addListener((alarm) => { if (alarm.name === 'uptimeCheck') checkAllServices(); });
// Nachrichtensystem für Einstellungen
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
if (message.type === 'updateInterval') { setupAlarm().then(() => sendResponse({ status: 'ok' })); return true; }
if (message.type === 'cleanupHistory') { cleanupHistory().then(() => sendResponse({ status: 'ok' })); return true; }
});
// Benachrichtigungs-Listener
chrome.notifications.onClicked.addListener((notificationId) => {
chrome.action.openPopup();
chrome.notifications.clear(notificationId);
}); });

View File

@@ -1,31 +1,32 @@
{ {
"manifest_version": 3, "manifest_version": 3,
"name": "Uptime Monitor", "name": "Uptime Monitor",
"version": "1.0", "version": "1.1",
"description": "Überwacht Dienste und benachrichtigt mich, wenn sie offline gehen.", "description": "Überwacht Dienste und benachrichtigt mich, wenn sie offline gehen.",
"permissions": [ "permissions": [
"storage", "storage",
"notifications", "notifications",
"alarms" "alarms",
], "tabs"
"host_permissions": [ ],
"<all_urls>" "host_permissions": [
], "<all_urls>"
"background": { ],
"service_worker": "background.js" "background": {
}, "service_worker": "background.js"
"action": { },
"default_popup": "popup.html", "action": {
"default_icon": { "default_popup": "popup.html",
"16": "icons/icon16.PNG", "default_icon": {
"48": "icons/icon48.PNG", "16": "icons/icon16.PNG",
"128": "icons/icon128.PNG" "48": "icons/icon48.PNG",
} "128": "icons/icon128.PNG"
}, }
"options_page": "options.html", },
"icons": { "options_page": "options.html",
"16": "icons/icon16.PNG", "icons": {
"48": "icons/icon48.PNG", "16": "icons/icon16.PNG",
"128": "icons/icon128.PNG" "48": "icons/icon48.PNG",
} "128": "icons/icon128.PNG"
}
} }

View File

@@ -1,145 +1,187 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="de"> <html lang="de">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Einstellungen - Uptime Monitor</title> <title>Einstellungen - Uptime Monitor</title>
<link rel="stylesheet" href="style.css"> <link rel="stylesheet" href="style.css">
<script src="lib/chart.js"></script> <script src="lib/chart.js"></script>
</head> </head>
<body class="options-page"> <body class="options-page">
<div class="options-grid-container"> <div class="options-grid-container">
<main class="main-settings-area"> <main class="main-settings-area">
<!-- Tab-Navigation --> <!-- Tab-Navigation -->
<div class="tab-nav"> <div class="tab-nav">
<button class="tab-btn active" data-tab="manage">Dienste verwalten</button> <button class="tab-btn active" data-tab="manage">Dienste verwalten</button>
<button class="tab-btn" data-tab="stats">Statistik & Übersicht</button> <button class="tab-btn" data-tab="stats">Statistik & Übersicht</button>
</div> </div>
<!-- Tab 1: Dienste verwalten --> <!-- Tab 1: Dienste verwalten -->
<div class="tab-panel active" id="manage-panel"> <div class="tab-panel active" id="manage-panel">
<div class="manage-grid"> <div class="manage-grid">
<aside class="widget-area-left"> <aside class="widget-area-left">
<div class="card"> <div class="card">
<h2>Anleitung</h2> <h2>Anleitung</h2>
<ol> <ol>
<li><strong>Hinzufügen:</strong> Nutze das Formular, um neue Dienste hinzuzufügen.</li> <li><strong>Hinzufügen:</strong> Nutze das Formular, um neue Dienste hinzuzufügen.</li>
<li><strong>Überwachung:</strong> Passe die Intervalle und Benachrichtigungen an.</li> <li><strong>Überwachung:</strong> Passe die Intervalle und Benachrichtigungen an.</li>
<li><strong>Popup-Auswahl:</strong> Wähle unten bis zu 8 Server aus, die schnell im Popup angezeigt werden sollen.</li> <li><strong>Popup-Auswahl:</strong> Wähle unten bis zu 8 Server aus, die schnell im Popup angezeigt werden sollen.</li>
<li><strong>Discord:</strong> Aktiviere optionale Benachrichtigungen für deinen Discord-Server.</li> <li><strong>Benachrichtigungen:</strong> Aktiviere optionale Benachrichtigungen für Discord und Telegram.</li>
<li><strong>Statistik:</strong> Wechsle zum Tab "Statistik & Übersicht" um die Liste zu sehen.</li> <li><strong>Statistik:</strong> Wechsle zum Tab "Statistik & Übersicht" um die Liste zu sehen.</li>
<li><strong>Backup:</strong> Nutze Import/Export, um Dienste zu sichern.</li> <li><strong>Backup:</strong> Nutze Import/Export, um Dienste zu sichern.</li>
</ol> </ol>
</div> </div>
</aside> </aside>
<!-- Mittlere Spalte: Formulare und Aktionen --> <!-- Mittlere Spalte: Formulare und Aktionen -->
<section class="form-section"> <section class="form-section">
<div class="card"> <div class="card">
<h1>Neuen Dienst hinzufügen</h1> <h1>Neuen Dienst hinzufügen</h1>
<form id="add-service-form"> <form id="add-service-form">
<div class="form-group"><label for="service-name">Name</label><input type="text" id="service-name" placeholder="z.B. Mein Server" required></div> <div class="form-group"><label for="service-name">Name</label><input type="text" id="service-name" placeholder="z.B. Mein Server" required></div>
<div class="form-group"> <div class="form-group">
<label for="service-domain">Adresse</label> <label for="service-domain">Adresse</label>
<div class="input-group"> <div class="input-group">
<select id="service-protocol"><option value="https://">https://</option><option value="http://">http://</option></select> <select id="service-protocol"><option value="https://">https://</option><option value="http://">http://</option></select>
<input type="text" id="service-domain" placeholder="example.com" required> <input type="text" id="service-domain" placeholder="example.com" required>
</div> </div>
</div> </div>
<button type="submit" class="btn btn-primary">Dienst hinzufügen</button> <button type="submit" class="btn btn-primary">Dienst hinzufügen</button>
</form> </form>
</div> </div>
<!-- NEU: Bereich für die Popup-Auswahl --> <!-- NEU: Bereich für die Popup-Auswahl -->
<div class="card"> <div class="card">
<h2>Server für Popup auswählen (max. 8)</h2> <h2>Server für Popup auswählen (max. 8)</h2>
<p>Wenn Sie mehr als 8 Server haben, wählen Sie hier aus, welche im Popup angezeigt werden sollen. Ansonsten werden alle Server angezeigt.</p> <p>Wenn Sie mehr als 8 Server haben, wählen Sie hier aus, welche im Popup angezeigt werden sollen. Ansonsten werden alle Server angezeigt.</p>
<div id="popup-selection-container"> <div id="popup-selection-container">
<div class="selection-info" id="selection-info">Keine Server ausgewählt (die ersten 8 werden angezeigt)</div> <div class="selection-info" id="selection-info">Keine Server ausgewählt (die ersten 8 werden angezeigt)</div>
<div id="popup-server-list" class="popup-server-list"></div> <div id="popup-server-list" class="popup-server-list"></div>
</div> </div>
</div> </div>
<div class="card"> <div class="card">
<h2>Überwachungseinstellungen</h2> <h2>Überwachungseinstellungen</h2>
<div class="form-group"> <div class="form-group">
<label for="check-interval">Prüfungsintervall:</label> <label for="check-interval">Prüfungsintervall:</label>
<select id="check-interval"> <select id="check-interval">
<option value="0.1667">Alle 10 Sekunden</option> <option value="0.1667">Alle 10 Sekunden</option>
<option value="0.5">Alle 30 Sekunden</option> <option value="0.5">Alle 30 Sekunden</option>
<option value="1">Jede Minute</option> <option value="1">Jede Minute</option>
<option value="5">Alle 5 Minuten</option> <option value="5">Alle 5 Minuten</option>
<option value="10">Alle 10 Minuten</option> <option value="10">Alle 10 Minuten</option>
<option value="15">Alle 15 Minuten</option> <option value="15">Alle 15 Minuten</option>
<option value="30">Alle 30 Minuten</option> <option value="30">Alle 30 Minuten</option>
<option value="60">Jede Stunde</option> <option value="60">Jede Stunde</option>
</select> </select>
</div> </div>
<div class="form-group checkbox-group"> <div class="form-group checkbox-group">
<input type="checkbox" id="notify-online"> <input type="checkbox" id="notify-online">
<label for="notify-online">Auch benachrichtigen, wenn ein Dienst wieder online ist.</label> <label for="notify-online">Auch benachrichtigen, wenn ein Dienst wieder online ist.</label>
</div> </div>
</div> </div>
<!-- NEU: Discord-Benachrichtigungen --> <!-- Discord-Benachrichtigungen -->
<div class="card"> <div class="card">
<h2>Discord-Benachrichtigungen</h2> <h2>Discord-Benachrichtigungen</h2>
<p>Senden Sie Status-Updates an einen Discord-Kanal über einen Webhook. Dies ist optional.</p> <p>Senden Sie Status-Updates an einen Discord-Kanal über einen Webhook. Dies ist optional.</p>
<div class="form-group"> <div class="form-group">
<label for="discord-webhook-url">Discord Webhook URL</label> <label for="discord-webhook-url">Discord Webhook URL</label>
<input type="url" id="discord-webhook-url" placeholder="https://discord.com/api/webhooks/..."> <input type="url" id="discord-webhook-url" placeholder="https://discord.com/api/webhooks/...">
<small>Erstelle einen Webhook in deinen Discord-Servereinstellungen (Kanal > Integrationen > Webhooks) und füge die vollständige URL hier ein. Lasse das Feld leer, um die Funktion zu deaktivieren.</small> <small>Erstelle einen Webhook in deinen Discord-Servereinstellungen (Kanal > Integrationen > Webhooks) und füge die vollständige URL hier ein. Lasse das Feld leer, um die Funktion zu deaktivieren.</small>
</div> </div>
</div> </div>
<div class="card"> <!-- NEU: Telegram-Benachrichtigungen -->
<h2>Daten-Management</h2> <div class="card">
<div class="form-actions"> <h2>Telegram-Benachrichtigungen</h2>
<button id="export-services" class="btn btn-secondary">Dienste exportieren</button> <p>Senden Sie Status-Updates an einen Telegram-Chat über einen Bot. Dies ist optional.</p>
<button id="import-services" class="btn btn-secondary">Dienste importieren</button> <div class="form-group">
<input type="file" id="import-file" accept=".json" style="display: none;"> <label for="telegram-bot-token">Telegram Bot Token</label>
</div> <input type="text" id="telegram-bot-token" placeholder="1234567890:ABCdefGHIjklMNOpqrsTUVwxyz">
</div> </div>
</section> <div class="form-group">
<label for="telegram-chat-id">Telegram Chat ID</label>
<aside class="widget-area-right"> <input type="text" id="telegram-chat-id" placeholder="123456789">
<div class="widget-card"> </div>
<h2>Changelog</h2> <small>
<ul> <strong>Anleitung:</strong><br>
<li><strong>Version 1.0</strong> - Erstellung der Chrome Erweiterung.</li> 1. Spreche mit dem <a href="https://t.me/botfather" target="_blank">@BotFather</a> auf Telegram, um einen neuen Bot zu erstellen und den Token zu erhalten.<br>
</ul> 2. Spreche mit deinem neuen Bot und sende ihm eine Nachricht.<br>
</div> 3. Rufe <code>https://api.telegram.org/bot&lt;DEIN_TOKEN&gt;/getUpdates</code> auf, um deine Chat ID zu finden.
</aside> </small>
</div> </div>
</div>
<div class="card">
<!-- Tab 2: Statistik & Übersicht (unverändert) --> <h2>Daten-Management</h2>
<div class="tab-panel" id="stats-panel"> <div class="form-actions">
<div class="stats-grid"> <button id="export-services" class="btn btn-secondary">Dienste exportieren</button>
<!-- Linke Seite: Serverliste + Suche --> <button id="import-services" class="btn btn-secondary">Dienste importieren</button>
<div class="card stats-list-card"> <input type="file" id="import-file" accept=".json" style="display: none;">
<div style="display:flex; justify-content:space-between; align-items:center; gap:12px; margin-bottom:12px;"> </div>
<h2 style="margin:0;">Serverliste</h2> </div>
<input id="services-search" placeholder="Suche Server..." style="padding:8px;border-radius:8px;border:1px solid var(--border-color);width:160px;"> </section>
</div>
<p class="info-text">Klicke auf einen Dienstnamen, um seine Statistik rechts anzuzeigen. Benutze die Icons zum Bearbeiten / Löschen.</p> <aside class="widget-area-right">
<ul id="services-list-stat" class="services-stat-list" aria-live="polite"></ul> <div class="widget-card">
<div id="empty-state" class="empty-state" style="display: none;"> <h2>Changelog</h2>
<p>Keine Dienste konfiguriert.</p> <ul>
</div> <li><strong>Version 1.0</strong> - Erstellung der Chrome Erweiterung.</li>
</div> <li><strong>Version 1.1</strong> - Verschiedene BUG-Fix, Telegram Benachrichtigung hinzugefügt</li>
</ul>
<!-- Rechte Seite: Uptime-Statistik --> </div>
<div class="widget-card stats-chart-card">
<h2>Uptime-Statistik</h2> <!-- ANGEPASST: Widget für Gitea Repositories -->
<div id="stats-card"> <div class="widget-card" id="gitea-repos-widget">
<p id="no-service-selected">Wähle einen Dienst aus der Liste aus, um seine Statistik zu sehen.</p> <h2>Projekt-Repositories</h2>
<canvas id="uptimeChart" style="display: none;"></canvas> <div id="gitea-repos-loading">Lade Repositories...</div>
</div> <ul id="gitea-repos-list" style="display: none;"></ul>
</div> <div id="gitea-repos-error" style="display: none; color: var(--error-color, #d9534f);">Fehler beim Laden der Repositories.</div>
</div> </div>
</div>
</main> <!-- NEU: Widget für Discord Support -->
</div> <div class="widget-card">
<script src="options.js"></script> <h2>Discord Support</h2>
</body> <p>Brauchst du Hilfe oder hast eine Frage? Tritt unserem Discord-Server bei und werde Teil der Community!</p>
<a href="https://discord.com/invite/FdRs4BRd8D" target="_blank" class="discord-link">
<!-- Discord SVG Icon -->
<svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor">
<path d="M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515.074.074 0 0 0-.032.074c-.217.124-.456.214-.69.29-.023.015-.041.032-.064.05-.05.063-.09.11-.09.175v.002c-.004.09-.012.19-.025.293a17.433 17.433 0 0 0-2.513.339 19.792 19.792 0 0 0-8.315 0c-.833-.22-1.7-.339-2.513-.339a13.65 13.65 0 0 0-.025-.293v-.002c0-.064-.04-.112-.09-.175-.023-.018-.041-.035-.064-.05-.234-.076-.473-.166-.69-.29a.074.074 0 0 0-.032-.074 19.736 19.736 0 0 0-4.885 1.515A19.78 19.78 0 0 0 3.676 18.26c.124.265.224.541.299.823a.074.074 0 0 1 .04.087 19.724 19.724 0 0 0 5.897 3.027.074.074 0 0 1 .084.028c.03.012.064.012.094 0a19.832 19.832 0 0 0 5.896-3.027.074.074 0 0 1 .04-.087c.075-.282.175-.558.299-.823A19.724 19.724 0 0 0 20.317 4.37zM8.02 15.33c-1.182 0-2.157-1.085-2.157-2.419 0-1.333.975-2.418 2.157-2.418 1.183 0 2.157 1.085 2.157 2.418 0 1.334-.975 2.419-2.157 2.419zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.975-2.418 2.157-2.418 1.183 0 2.157 1.085 2.157 2.418 0 1.334-.975 2.419-2.157 2.419z"/>
</svg>
<span>Jetzt beitreten</span>
</a>
</div>
</aside>
</div>
</div>
<!-- Tab 2: Statistik & Übersicht (unverändert) -->
<div class="tab-panel" id="stats-panel">
<div class="stats-grid">
<!-- Linke Seite: Serverliste + Suche -->
<div class="card stats-list-card">
<div style="display:flex; justify-content:space-between; align-items:center; gap:12px; margin-bottom:12px;">
<h2 style="margin:0;">Serverliste</h2>
<input id="services-search" placeholder="Suche Server..." style="padding:8px;border-radius:8px;border:1px solid var(--border-color);width:160px;">
</div>
<p class="info-text">Klicke auf einen Dienstnamen, um seine Statistik rechts anzuzeigen. Benutze die Icons zum Bearbeiten / Löschen.</p>
<ul id="services-list-stat" class="services-stat-list" aria-live="polite"></ul>
<div id="empty-state" class="empty-state" style="display: none;">
<p>Keine Dienste konfiguriert.</p>
</div>
</div>
<!-- Rechte Seite: Uptime-Statistik -->
<div class="widget-card stats-chart-card">
<h2>Uptime-Statistik</h2>
<div id="stats-card">
<p id="no-service-selected">Wähle einen Dienst aus der Liste aus, um seine Statistik zu sehen.</p>
<canvas id="uptimeChart" style="display: none;"></canvas>
</div>
</div>
</div>
</div>
</main>
</div>
<script src="options.js"></script>
</body>
</html> </html>

View File

@@ -1,382 +1,501 @@
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('DOMContentLoaded', function() {
const serviceForm = document.getElementById('add-service-form'); const serviceForm = document.getElementById('add-service-form');
const intervalSelect = document.getElementById('check-interval'); const intervalSelect = document.getElementById('check-interval');
const notifyOnlineCheckbox = document.getElementById('notify-online'); const notifyOnlineCheckbox = document.getElementById('notify-online');
const exportBtn = document.getElementById('export-services'); const exportBtn = document.getElementById('export-services');
const importBtn = document.getElementById('import-services'); const importBtn = document.getElementById('import-services');
const importFileInput = document.getElementById('import-file'); const importFileInput = document.getElementById('import-file');
const servicesListStat = document.getElementById('services-list-stat'); const servicesListStat = document.getElementById('services-list-stat');
const emptyState = document.getElementById('empty-state'); const emptyState = document.getElementById('empty-state');
const searchInput = document.getElementById('services-search'); const searchInput = document.getElementById('services-search');
const MAX_POPUP_SERVERS = 8; const MAX_POPUP_SERVERS = 8;
let currentChart = null; let currentChart = null;
// NEU: Discord Webhook Input // NEU: Discord Webhook Input
const discordWebhookInput = document.getElementById('discord-webhook-url'); const discordWebhookInput = document.getElementById('discord-webhook-url');
// NEU: Telegram Inputs
// --- Tab-Logik --- const telegramBotTokenInput = document.getElementById('telegram-bot-token');
const tabButtons = document.querySelectorAll('.tab-btn'); const telegramChatIdInput = document.getElementById('telegram-chat-id');
const tabPanels = document.querySelectorAll('.tab-panel');
tabButtons.forEach(button => { // --- Tab-Logik ---
button.addEventListener('click', () => { const tabButtons = document.querySelectorAll('.tab-btn');
const targetTab = button.getAttribute('data-tab'); const tabPanels = document.querySelectorAll('.tab-panel');
tabButtons.forEach(btn => btn.classList.remove('active')); tabButtons.forEach(button => {
tabPanels.forEach(panel => panel.classList.remove('active')); button.addEventListener('click', () => {
button.classList.add('active'); const targetTab = button.getAttribute('data-tab');
document.getElementById(`${targetTab}-panel`).classList.add('active'); tabButtons.forEach(btn => btn.classList.remove('active'));
}); tabPanels.forEach(panel => panel.classList.remove('active'));
}); button.classList.add('active');
document.getElementById(`${targetTab}-panel`).classList.add('active');
// --- Utilities --- });
function getAllData(callback) { });
chrome.storage.sync.get({ services: [], popupServers: [] }, function(syncData) {
chrome.storage.local.get({ serviceStatus: {}, history: {} }, function(localData) { // --- Utilities ---
callback(syncData.services || [], syncData.popupServers || [], localData.serviceStatus || {}, localData.history || {}); function getAllData(callback) {
}); chrome.storage.sync.get({ services: [], popupServers: [] }, function(syncData) {
}); chrome.storage.local.get({ serviceStatus: {}, history: {} }, function(localData) {
} callback(syncData.services || [], syncData.popupServers || [], localData.serviceStatus || {}, localData.history || {});
});
// --- NEU: Popup-Server-Auswahl rendern --- });
function renderPopupServerSelection(allServices) { }
const container = document.getElementById('popup-server-list');
const infoElement = document.getElementById('selection-info'); // --- NEU: Popup-Server-Auswahl rendern ---
container.innerHTML = ''; // Leeren function renderPopupServerSelection(allServices) {
const container = document.getElementById('popup-server-list');
if (allServices.length === 0) { const infoElement = document.getElementById('selection-info');
infoElement.textContent = 'Bitte fügen Sie zuerst Server hinzu.'; container.innerHTML = ''; // Leeren
return;
} if (allServices.length === 0) {
infoElement.textContent = 'Bitte fügen Sie zuerst Server hinzu.';
chrome.storage.sync.get({ popupServers: [] }, (data) => { return;
const selectedServers = data.popupServers || []; }
// Info-Text aktualisieren chrome.storage.sync.get({ popupServers: [] }, (data) => {
infoElement.textContent = `${selectedServers.length} von ${MAX_POPUP_SERVERS} Servern für das Popup ausgewählt.`; const selectedServers = data.popupServers || [];
allServices.forEach(service => { // Info-Text aktualisieren
const serverItem = document.createElement('div'); infoElement.textContent = `${selectedServers.length} von ${MAX_POPUP_SERVERS} Servern für das Popup ausgewählt.`;
serverItem.className = 'popup-server-item';
allServices.forEach(service => {
const isSelected = selectedServers.some(s => s.name === service.name && s.adresse === service.adresse); const serverItem = document.createElement('div');
serverItem.className = 'popup-server-item';
serverItem.innerHTML = `
<input type="checkbox" id="popup-server-${service.name.replace(/\s+/g, '-')}" ${isSelected ? 'checked' : ''}> const isSelected = selectedServers.some(s => s.name === service.name && s.adresse === service.adresse);
<div class="server-info">
<div class="server-name">${escapeHtml(service.name)}</div> serverItem.innerHTML = `
<div class="server-address">${escapeHtml(service.adresse || '')}</div> <input type="checkbox" id="popup-server-${service.name.replace(/\s+/g, '-')}" ${isSelected ? 'checked' : ''}>
</div> <div class="server-info">
`; <div class="server-name">${escapeHtml(service.name)}</div>
<div class="server-address">${escapeHtml(service.adresse || '')}</div>
const checkbox = serverItem.querySelector('input[type="checkbox"]'); </div>
checkbox.addEventListener('change', () => { `;
updatePopupServerSelection(service, checkbox.checked, allServices);
}); const checkbox = serverItem.querySelector('input[type="checkbox"]');
checkbox.addEventListener('change', () => {
container.appendChild(serverItem); updatePopupServerSelection(service, checkbox.checked, allServices);
}); });
});
} container.appendChild(serverItem);
});
// --- NEU: Auswahl aktualisieren --- });
function updatePopupServerSelection(service, isSelected, allServices) { }
chrome.storage.sync.get({ popupServers: [] }, (data) => {
let selectedServers = data.popupServers || []; // --- NEU: Auswahl aktualisieren ---
function updatePopupServerSelection(service, isSelected, allServices) {
if (isSelected) { chrome.storage.sync.get({ popupServers: [] }, (data) => {
// Verhindere, dass mehr als MAX_POPUP_SERVERS ausgewählt werden let selectedServers = data.popupServers || [];
if (selectedServers.length >= MAX_POPUP_SERVERS) {
alert(`Sie können maximal ${MAX_POPUP_SERVERS} Server auswählen.`); if (isSelected) {
checkbox.checked = false; // Haken entfernen // Verhindere, dass mehr als MAX_POPUP_SERVERS ausgewählt werden
return; if (selectedServers.length >= MAX_POPUP_SERVERS) {
} alert(`Sie können maximal ${MAX_POPUP_SERVERS} Server auswählen.`);
selectedServers.push(service); // Finde die Checkbox und setze den Haken zurück
} else { const checkboxId = `popup-server-${service.name.replace(/\s+/g, '-')}`;
selectedServers = selectedServers.filter(s => !(s.name === service.name && s.adresse === service.adresse)); const checkbox = document.getElementById(checkboxId);
} if(checkbox) checkbox.checked = false;
return;
chrome.storage.sync.set({ popupServers: selectedServers }, () => { }
// Info-Text und Checkboxen aktualisieren selectedServers.push(service);
renderPopupServerSelection(allServices); } else {
}); selectedServers = selectedServers.filter(s => !(s.name === service.name && s.adresse === service.adresse));
}); }
}
chrome.storage.sync.set({ popupServers: selectedServers }, () => {
// Info-Text und Checkboxen aktualisieren
// --- Services rendern --- renderPopupServerSelection(allServices);
function renderServices(filter = '') { });
getAllData((services, popupServers, statuses, history) => { });
servicesListStat.innerHTML = ''; }
const filtered = services.filter(s => s.name.toLowerCase().includes(filter.toLowerCase()));
if (filtered.length === 0) {
emptyState.style.display = services.length === 0 ? 'block' : 'none'; // --- Services rendern ---
if (services.length === 0) return; function renderServices(filter = '') {
} else { getAllData((services, popupServers, statuses, history) => {
emptyState.style.display = 'none'; servicesListStat.innerHTML = '';
} const filtered = services.filter(s => s.name.toLowerCase().includes(filter.toLowerCase()));
if (filtered.length === 0) {
filtered.forEach((service, index) => { emptyState.style.display = services.length === 0 ? 'block' : 'none';
const statusObj = statuses[service.name] || {}; if (services.length === 0) return;
const st = statusObj.status || 'unknown'; } else {
const resp = typeof statusObj.responseTime === 'number' ? `${statusObj.responseTime} ms` : ''; emptyState.style.display = 'none';
}
const li = document.createElement('li');
li.className = 'service-stat-item'; filtered.forEach((service, index) => {
li.dataset.index = index; const statusObj = statuses[service.name] || {};
const st = statusObj.status || 'unknown';
li.innerHTML = ` const resp = typeof statusObj.responseTime === 'number' ? `${statusObj.responseTime} ms` : '';
<div class="service-left">
<div class="service-name" role="button" tabindex="0">${escapeHtml(service.name)}</div> const li = document.createElement('li');
<div class="service-sub">${escapeHtml(service.adresse || '')}</div> li.className = 'service-stat-item';
</div> li.dataset.index = index;
<div class="service-right">
<div class="service-meta"> li.innerHTML = `
<span class="status-dot small ${st}" title="Status: ${st}"></span> <div class="service-left">
<span class="response-time">${resp}</span> <div class="service-name" role="button" tabindex="0">${escapeHtml(service.name)}</div>
</div> <div class="service-sub">${escapeHtml(service.adresse || '')}</div>
<div class="service-actions"> </div>
<button class="icon-btn edit" aria-label="Bearbeiten ${escapeHtml(service.name)}" title="Bearbeiten"> <div class="service-right">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <div class="service-meta">
<path d="M12 20h9"></path> <span class="status-dot small ${st}" title="Status: ${st}"></span>
<path d="M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4 12.5-12.5z"></path> <span class="response-time">${resp}</span>
</svg> </div>
</button> <div class="service-actions">
<button class="icon-btn delete" aria-label="Löschen ${escapeHtml(service.name)}" title="Löschen"> <button class="icon-btn edit" aria-label="Bearbeiten ${escapeHtml(service.name)}" title="Bearbeiten">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<polyline points="3 6 5 6 21 6"></polyline> <path d="M12 20h9"></path>
<path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"></path> <path d="M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4 12.5-12.5z"></path>
</svg> </svg>
</button> </button>
</div> <button class="icon-btn delete" aria-label="Löschen ${escapeHtml(service.name)}" title="Löschen">
</div> <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
`; <polyline points="3 6 5 6 21 6"></polyline>
<path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"></path>
li.querySelector('.service-name').addEventListener('click', () => { </svg>
showStatsForService(service); </button>
highlightSelection(li); </div>
}); </div>
`;
li.querySelector('.service-name').addEventListener('keydown', (e) => {
if (e.key === 'Enter' || e.key === ' ') { li.querySelector('.service-name').addEventListener('click', () => {
e.preventDefault(); showStatsForService(service);
li.querySelector('.service-name').click(); highlightSelection(li);
} });
});
li.querySelector('.service-name').addEventListener('keydown', (e) => {
li.querySelector('.icon-btn.edit').addEventListener('click', (e) => { if (e.key === 'Enter' || e.key === ' ') {
e.stopPropagation(); e.preventDefault();
enterEditMode(li, service, services); li.querySelector('.service-name').click();
}); }
});
li.querySelector('.icon-btn.delete').addEventListener('click', (e) => {
e.stopPropagation(); li.querySelector('.icon-btn.edit').addEventListener('click', (e) => {
if (confirm(`Server "${service.name}" wirklich löschen?`)) { e.stopPropagation();
services.splice(index, 1); enterEditMode(li, service, services);
chrome.storage.sync.set({ services }, () => { });
renderServices(searchInput.value.trim());
renderPopupServerSelection(services); // Auch die Auswahl neu rendern li.querySelector('.icon-btn.delete').addEventListener('click', (e) => {
}); e.stopPropagation();
} if (confirm(`Server "${service.name}" wirklich löschen?`)) {
}); services.splice(index, 1);
chrome.storage.sync.set({ services }, () => {
servicesListStat.appendChild(li); renderServices(searchInput.value.trim());
}); renderPopupServerSelection(services); // Auch die Auswahl neu rendern
}); });
} }
});
function highlightSelection(itemEl) {
document.querySelectorAll('.service-stat-item').forEach(it => it.classList.remove('selected')); servicesListStat.appendChild(li);
itemEl.classList.add('selected'); });
} });
}
function enterEditMode(li, service, allServices) {
li.classList.add('editing'); function highlightSelection(itemEl) {
li.innerHTML = ` document.querySelectorAll('.service-stat-item').forEach(it => it.classList.remove('selected'));
<div class="edit-left"> itemEl.classList.add('selected');
<input class="edit-name" value="${escapeAttr(service.name)}" /> }
<input class="edit-adresse" value="${escapeAttr(service.adresse || '')}" />
</div> function enterEditMode(li, service, allServices) {
<div class="edit-actions"> li.classList.add('editing');
<button class="btn-save" title="Speichern">Speichern</button> li.innerHTML = `
<button class="btn-cancel" title="Abbrechen">Abbrechen</button> <div class="edit-left">
</div> <input class="edit-name" value="${escapeAttr(service.name)}" />
`; <input class="edit-adresse" value="${escapeAttr(service.adresse || '')}" />
</div>
const saveBtn = li.querySelector('.btn-save'); <div class="edit-actions">
const cancelBtn = li.querySelector('.btn-cancel'); <button class="btn-save" title="Speichern">Speichern</button>
<button class="btn-cancel" title="Abbrechen">Abbrechen</button>
cancelBtn.addEventListener('click', (ev) => { </div>
ev.stopPropagation(); `;
renderServices(searchInput.value.trim());
}); const saveBtn = li.querySelector('.btn-save');
const cancelBtn = li.querySelector('.btn-cancel');
saveBtn.addEventListener('click', (ev) => {
ev.stopPropagation(); cancelBtn.addEventListener('click', (ev) => {
const newName = li.querySelector('.edit-name').value.trim(); ev.stopPropagation();
const newAdresse = li.querySelector('.edit-adresse').value.trim(); renderServices(searchInput.value.trim());
if (!newName || !newAdresse) { alert('Name und Adresse dürfen nicht leer sein.'); return; } });
chrome.storage.sync.get({ services: [] }, function(data) { saveBtn.addEventListener('click', (ev) => {
const services = data.services || []; ev.stopPropagation();
const idx = services.findIndex(s => s.name === service.name && (s.adresse || '') === (service.adresse || '')); const newName = li.querySelector('.edit-name').value.trim();
if (idx === -1) { const newAdresse = li.querySelector('.edit-adresse').value.trim();
alert('Fehler: Dienst nicht gefunden.'); if (!newName || !newAdresse) { alert('Name und Adresse dürfen nicht leer sein.'); return; }
renderServices(searchInput.value.trim());
return; chrome.storage.sync.get({ services: [] }, function(data) {
} const services = data.services || [];
services[idx].name = newName; const idx = services.findIndex(s => s.name === service.name && (s.adresse || '') === (service.adresse || ''));
services[idx].adresse = newAdresse; if (idx === -1) {
chrome.storage.sync.set({ services }, () => { alert('Fehler: Dienst nicht gefunden.');
renderServices(searchInput.value.trim()); renderServices(searchInput.value.trim());
renderPopupServerSelection(services); // Auch die Auswahl neu rendern return;
}); }
}); services[idx].name = newName;
}); services[idx].adresse = newAdresse;
} chrome.storage.sync.set({ services }, () => {
renderServices(searchInput.value.trim());
// --- Add service --- renderPopupServerSelection(services); // Auch die Auswahl neu rendern
function addService(name, adresse) { });
if (!name || !adresse) return; });
chrome.storage.sync.get({ services: [] }, function(data) { });
const newService = { name, adresse }; }
const updatedServices = [...data.services, newService];
chrome.storage.sync.set({ services: updatedServices }, () => { // --- Add service ---
renderServices(searchInput.value.trim()); function addService(name, adresse) {
renderPopupServerSelection(updatedServices); // Auch die Auswahl neu rendern if (!name || !adresse) return;
}); chrome.storage.sync.get({ services: [] }, function(data) {
}); const newService = { name, adresse };
} const updatedServices = [...data.services, newService];
chrome.storage.sync.set({ services: updatedServices }, () => {
serviceForm.addEventListener('submit', function(event) { renderServices(searchInput.value.trim());
event.preventDefault(); renderPopupServerSelection(updatedServices); // Auch die Auswahl neu rendern
const nameInput = document.getElementById('service-name'); });
const protocolSelect = document.getElementById('service-protocol'); });
const domainInput = document.getElementById('service-domain'); }
const fullAdresse = protocolSelect.value + domainInput.value.trim();
addService(nameInput.value.trim(), fullAdresse); serviceForm.addEventListener('submit', function(event) {
serviceForm.reset(); event.preventDefault();
nameInput.focus(); const nameInput = document.getElementById('service-name');
}); const protocolSelect = document.getElementById('service-protocol');
const domainInput = document.getElementById('service-domain');
// --- Settings load/save --- const fullAdresse = protocolSelect.value + domainInput.value.trim();
function loadSettings() { addService(nameInput.value.trim(), fullAdresse);
// NEU: discordWebhookUrl zu den abgerufenen Daten hinzufügen serviceForm.reset();
chrome.storage.sync.get({ checkInterval: 1, notifyOnline: false, discordWebhookUrl: '' }, function(data) { nameInput.focus();
intervalSelect.value = data.checkInterval; });
notifyOnlineCheckbox.checked = data.notifyOnline;
discordWebhookInput.value = data.discordWebhookUrl || ''; // NEU // --- Settings load/save ---
}); function loadSettings() {
} // NEU: discordWebhookUrl, telegramBotToken und telegramChatId zu den abgerufenen Daten hinzufügen
intervalSelect.addEventListener('change', () => { chrome.storage.sync.get({ checkInterval: 1, notifyOnline: false, discordWebhookUrl: '', telegramBotToken: '', telegramChatId: '' }, function(data) {
const newInterval = parseFloat(intervalSelect.value); intervalSelect.value = data.checkInterval;
chrome.storage.sync.set({ checkInterval: newInterval }, () => { chrome.runtime.sendMessage({ type: 'updateInterval' }); }); notifyOnlineCheckbox.checked = data.notifyOnline;
}); discordWebhookInput.value = data.discordWebhookUrl || '';
notifyOnlineCheckbox.addEventListener('change', () => { chrome.storage.sync.set({ notifyOnline: notifyOnlineCheckbox.checked }); }); telegramBotTokenInput.value = data.telegramBotToken || '';
telegramChatIdInput.value = data.telegramChatId || '';
// NEU: Event Listener für Discord Webhook URL });
discordWebhookInput.addEventListener('change', () => { }
chrome.storage.sync.set({ discordWebhookUrl: discordWebhookInput.value.trim() }); intervalSelect.addEventListener('change', () => {
}); const newInterval = parseFloat(intervalSelect.value);
chrome.storage.sync.set({ checkInterval: newInterval }, () => { chrome.runtime.sendMessage({ type: 'updateInterval' }); });
// --- Import/Export --- });
exportBtn.addEventListener('click', () => { notifyOnlineCheckbox.addEventListener('change', () => { chrome.storage.sync.set({ notifyOnline: notifyOnlineCheckbox.checked }); });
chrome.storage.sync.get({ services: [] }, (data) => {
const dataStr = JSON.stringify(data.services, null, 2); // NEU: Event Listener für Discord Webhook URL
const blob = new Blob([dataStr], { type: 'application/json' }); discordWebhookInput.addEventListener('change', () => {
const url = URL.createObjectURL(blob); const a = document.createElement('a'); chrome.storage.sync.set({ discordWebhookUrl: discordWebhookInput.value.trim() });
a.href = url; a.download = 'uptime-services.json'; });
document.body.appendChild(a); a.click();
document.body.removeChild(a); URL.revokeObjectURL(url); // NEU: Event Listener für Telegram
}); telegramBotTokenInput.addEventListener('change', () => {
}); chrome.storage.sync.set({ telegramBotToken: telegramBotTokenInput.value.trim() });
importBtn.addEventListener('click', () => importFileInput.click()); });
importFileInput.addEventListener('change', (event) => { telegramChatIdInput.addEventListener('change', () => {
const file = event.target.files[0]; if (!file) return; chrome.storage.sync.set({ telegramChatId: telegramChatIdInput.value.trim() });
const reader = new FileReader(); });
reader.onload = (e) => {
try { const importedServices = JSON.parse(e.target.result);
if (Array.isArray(importedServices)) { // --- ERWEITERTES Import/Export ---
chrome.storage.sync.set({ services: importedServices }, () => { exportBtn.addEventListener('click', () => {
renderServices(searchInput.value.trim()); // Rufe alle relevanten Daten aus dem Speicher ab, inklusive der neuen Telegram-Einstellungen
renderPopupServerSelection(importedServices); // Auch die Auswahl neu rendern chrome.storage.sync.get({
}); services: [],
} popupServers: [],
else { alert('Ungültiges Dateiformat.'); } checkInterval: 1,
} catch (error) { alert('Fehler beim Lesen der Datei.'); } notifyOnline: false,
}; discordWebhookUrl: '',
reader.readAsText(file); telegramBotToken: '',
}); telegramChatId: ''
}, (data) => {
// --- Statistik-Anzeige --- // Erstelle einen String aus den Daten für die JSON-Datei
function showStatsForService(service) { const dataStr = JSON.stringify(data, null, 2);
if (!service) return; const blob = new Blob([dataStr], { type: 'application/json' });
document.getElementById('no-service-selected').style.display = 'none'; const url = URL.createObjectURL(blob);
const chartCanvas = document.getElementById('uptimeChart'); const a = document.createElement('a');
chartCanvas.style.display = 'block'; a.href = url;
a.download = 'uptime-monitor-backup.json'; // Passenderer Dateiname
chrome.storage.local.get({ history: {} }, (data) => { document.body.appendChild(a);
const history = data.history[service.name] || {}; a.click();
const labels = Object.keys(history).sort().slice(-48); document.body.removeChild(a);
const uptimeData = labels.map(label => { URL.revokeObjectURL(url);
const h = history[label]; });
return h.checks > 0 ? (h.up_checks / h.checks * 100).toFixed(2) : 0; });
});
importBtn.addEventListener('click', () => importFileInput.click());
if (currentChart) currentChart.destroy(); importFileInput.addEventListener('change', (event) => {
const ctx = chartCanvas.getContext('2d'); const file = event.target.files[0];
if (!file) return;
if (labels.length === 0) {
ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height); const reader = new FileReader();
ctx.font = "16px -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto"; reader.onload = (e) => {
ctx.fillStyle = getComputedStyle(document.documentElement).getPropertyValue('--text-secondary'); try {
ctx.textAlign = 'center'; const importedData = JSON.parse(e.target.result);
ctx.fillText('Noch keine Daten verfügbar.', ctx.canvas.width / 2, ctx.canvas.height / 2);
return; // Prüfe, ob die importierten Daten ein Objekt sind
} if (typeof importedData === 'object' && importedData !== null) {
// Setze alle importierten Daten auf einmal
const formattedLabels = labels.map(l => { chrome.storage.sync.set(importedData, () => {
const parts = l.split(' '); alert('Backup erfolgreich wiederhergestellt! Die Seite wird neu geladen, um alle Änderungen zu übernehmen.');
return parts.length === 2 ? parts[1] : l; // Nach dem Import ist es am sichersten, die Seite neu zu laden
}); location.reload();
});
currentChart = new Chart(ctx, { } else {
type: 'line', alert('Ungültiges Dateiformat. Die Datei muss eine gültige Backup-Datei sein.');
data: { }
labels: formattedLabels, } catch (error) {
datasets: [{ console.error('Fehler beim Verarbeiten der Import-Datei:', error);
label: `Uptime für ${service.name} (%)`, alert('Fehler beim Lesen der Datei. Bitte stellen Sie sicher, dass es sich um eine gültige JSON-Datei handelt.');
data: uptimeData, }
borderColor: 'var(--accent-color)', };
backgroundColor: 'rgba(24, 119, 242, 0.1)', reader.readAsText(file);
fill: true, });
tension: 0.3
}]
}, // --- Statistik-Anzeige ---
options: { function showStatsForService(service) {
responsive: true, if (!service) return;
maintainAspectRatio: false, document.getElementById('no-service-selected').style.display = 'none';
scales: { const chartCanvas = document.getElementById('uptimeChart');
y: { beginAtZero: true, max: 100, ticks: { callback: value => value + '%' } } chartCanvas.style.display = 'block';
},
plugins: { legend: { display: false } } chrome.storage.local.get({ history: {} }, (data) => {
} const history = data.history[service.name] || {};
}); const labels = Object.keys(history).sort().slice(-48);
}); const uptimeData = labels.map(label => {
} const h = history[label];
return h.checks > 0 ? (h.up_checks / h.checks * 100).toFixed(2) : 0;
// --- Search --- });
searchInput.addEventListener('input', () => {
renderServices(searchInput.value.trim()); if (currentChart) currentChart.destroy();
}); const ctx = chartCanvas.getContext('2d');
// --- Helpers --- if (labels.length === 0) {
function escapeHtml(str) { if (!str) return ''; return String(str).replace(/[&<>"']/g, s => ({'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;',"'":'&#39;'}[s])); } ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
function escapeAttr(s) { return (s||'').replace(/"/g, '&quot;'); } ctx.font = "16px -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto";
ctx.fillStyle = getComputedStyle(document.documentElement).getPropertyValue('--text-secondary');
// --- Init --- ctx.textAlign = 'center';
loadSettings(); ctx.fillText('Noch keine Daten verfügbar.', ctx.canvas.width / 2, ctx.canvas.height / 2);
renderServices(); return;
// Initiales Rendern der Popup-Auswahl }
chrome.storage.sync.get({ services: [] }, (data) => {
renderPopupServerSelection(data.services || []); const formattedLabels = labels.map(l => {
}); const parts = l.split(' ');
return parts.length === 2 ? parts[1] : l;
});
currentChart = new Chart(ctx, {
type: 'line',
data: {
labels: formattedLabels,
datasets: [{
label: `Uptime für ${service.name} (%)`,
data: uptimeData,
borderColor: 'var(--accent-color)',
backgroundColor: 'rgba(24, 119, 242, 0.1)',
fill: true,
tension: 0.3
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
scales: {
y: { beginAtZero: true, max: 100, ticks: { callback: value => value + '%' } }
},
plugins: { legend: { display: false } }
}
});
});
}
// --- Search ---
searchInput.addEventListener('input', () => {
renderServices(searchInput.value.trim());
});
// --- Helpers ---
function escapeHtml(str) { if (!str) return ''; return String(str).replace(/[&<>"']/g, s => ({'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;',"'":'&#39;'}[s])); }
function escapeAttr(s) { return (s||'').replace(/"/g, '&quot;'); }
// --- Init ---
loadSettings();
renderServices();
// Initiales Rendern der Popup-Auswahl
chrome.storage.sync.get({ services: [] }, (data) => {
renderPopupServerSelection(data.services || []);
});
// --- ROBUSTE: Gitea Repository Widget ---
// Führt mehrere Suchen durch und kombiniert die Ergebnisse.
function fetchAndDisplayGiteaRepos() {
const list = document.getElementById('gitea-repos-list');
const loadingIndicator = document.getElementById('gitea-repos-loading');
const errorIndicator = document.getElementById('gitea-repos-error');
const searchKeywords = ["Gitea", "Themes", "Server", "Minecraft", "Webseite", "Wordpress", "Plugin", "chrome-erweiterung"];
loadingIndicator.style.display = 'block';
list.style.display = 'none';
errorIndicator.style.display = 'none';
// Erstelle eine Liste von Promises, eine für jede Suchanfrage
const searchPromises = searchKeywords.map(keyword => {
const apiUrl = `https://git.viper.ipv64.net/api/v1/repos/search?q=${encodeURIComponent(keyword)}&limit=50&sort=updated&order=desc`;
return fetch(apiUrl).then(response => {
if (!response.ok) {
// Wenn eine Anfrage fehlschlägt, geben wir ein leeres Array zurück, um die anderen nicht zu blockieren
console.warn(`Suche nach "${keyword}" fehlgeschlagen:`, response.status);
return { data: [] }; // Gib eine leere Antwort-Struktur zurück
}
return response.json();
});
});
// Führe alle Suchanfragen parallel aus
Promise.all(searchPromises)
.then(results => {
// Kombiniere alle Ergebnisse aus den einzelnen Suchen
const allRepos = results.flatMap(result => result.data || []);
// Entferne Duplikate anhand der einzigartigen ID des Repositories
const uniqueReposMap = new Map();
allRepos.forEach(repo => {
uniqueReposMap.set(repo.id, repo);
});
const uniqueRepos = Array.from(uniqueReposMap.values());
// Sortiere die kombinierten Repositories nach dem letzten Update-Datum
uniqueRepos.sort((a, b) => new Date(b.updated_at) - new Date(a.updated_at));
// Begrenze die Ergebnisse auf die 5 neuesten
const finalRepos = uniqueRepos.slice(0, 5);
loadingIndicator.style.display = 'none';
list.innerHTML = '';
if (finalRepos.length > 0) {
list.style.display = 'block';
finalRepos.forEach(repo => {
const li = document.createElement('li');
const link = document.createElement('a');
link.href = repo.html_url;
link.textContent = repo.name;
link.target = '_blank';
link.rel = 'noopener noreferrer';
li.appendChild(link);
list.appendChild(li);
});
} else {
list.style.display = 'block';
list.innerHTML = '<li>Keine passenden Repositories gefunden.</li>';
}
})
.catch(error => {
console.error('Fehler beim Abrufen der Gitea Repositories:', error);
loadingIndicator.style.display = 'none';
errorIndicator.style.display = 'block';
});
}
// Rufe die neue Funktion auf, wenn die Seite geladen wird.
fetchAndDisplayGiteaRepos();
}); });

209
popup.js
View File

@@ -1,100 +1,111 @@
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
const list = document.getElementById('service-list'); const list = document.getElementById('service-list');
const empty = document.getElementById('empty-state'); const empty = document.getElementById('empty-state');
const dot = document.getElementById('status-dot'); const dot = document.getElementById('status-dot');
const settingsBtn = document.getElementById('settings-btn'); const settingsBtn = document.getElementById('settings-btn');
const icons = { const icons = {
online: `<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3"><polyline points="20 6 9 17 4 12"></polyline></svg>`, online: `<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3"><polyline points="20 6 9 17 4 12"></polyline></svg>`,
offline: `<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>`, offline: `<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>`,
unknown: `<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="16" x2="12.01" y2="16"></line></svg>` unknown: `<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="16" x2="12.01" y2="16"></line></svg>`
}; };
function render() { function render() {
// Lade alle Server und die spezielle Auswahl für das Popup // Lade alle Server und die spezielle Auswahl für das Popup
chrome.storage.sync.get({services: [], popupServers: []}, (data) => { chrome.storage.sync.get({services: [], popupServers: []}, (data) => {
chrome.storage.local.get({serviceStatus: {}}, (local) => { chrome.storage.local.get({serviceStatus: {}}, (local) => {
const allServices = data.services; const allServices = data.services;
const popupSelection = data.popupServers; const popupSelection = data.popupServers;
const statuses = local.serviceStatus; const statuses = local.serviceStatus;
list.innerHTML = ''; list.innerHTML = '';
list.appendChild(empty); list.appendChild(empty);
if (allServices.length === 0) { if (allServices.length === 0) {
dot.className = 'status-dot red'; dot.className = 'status-dot red';
empty.style.display = 'flex'; empty.style.display = 'flex';
list.classList.remove('few-servers'); // Klasse entfernen list.classList.remove('few-servers'); // Klasse entfernen
return; return;
} }
let displayServers = []; let displayServers = [];
// Logik zur Bestimmung der anzuzeigenden Server // Logik zur Bestimmung der anzuzeigenden Server
if (allServices.length <= 8) { if (allServices.length <= 8) {
// Weniger als 8 Server: Alle anzeigen, Layout anpassen // Weniger als 8 Server: Alle anzeigen, Layout anpassen
displayServers = allServices; displayServers = allServices;
list.classList.add('few-servers'); list.classList.add('few-servers');
} else { } else {
// Mehr als 8 Server: Festes 2-Spalten-Layout // Mehr als 8 Server: Festes 2-Spalten-Layout
list.classList.remove('few-servers'); list.classList.remove('few-servers');
if (popupSelection.length > 0) { if (popupSelection.length > 0) {
// Wenn eine Auswahl existiert, diese anzeigen // Wenn eine Auswahl existiert, diese anzeigen
displayServers = popupSelection; displayServers = popupSelection;
} else { } else {
// Ansonsten die ersten 8 als Fallback // Ansonsten die ersten 8 als Fallback
displayServers = allServices.slice(0, 8); displayServers = allServices.slice(0, 8);
} }
} }
const onlineCount = displayServers.filter(s => statuses[s.name]?.status === 'online').length; const onlineCount = displayServers.filter(s => statuses[s.name]?.status === 'online').length;
if (onlineCount === displayServers.length) dot.className = 'status-dot green pulse'; if (onlineCount === displayServers.length) dot.className = 'status-dot green pulse';
else if (onlineCount === 0) dot.className = 'status-dot red'; else if (onlineCount === 0) dot.className = 'status-dot red';
else dot.className = 'status-dot orange'; else dot.className = 'status-dot orange';
empty.style.display = 'none'; empty.style.display = 'none';
displayServers.forEach(s => { displayServers.forEach(s => {
const st = statuses[s.name] || {status: 'unknown', responseTime: null}; const st = statuses[s.name] || {status: 'unknown', responseTime: null};
const card = document.createElement('div'); const card = document.createElement('div');
card.className = 'service-card'; card.className = 'service-card';
card.innerHTML = ` // === NEU ===
<div class="service-info"> // Macht die Karte klickbar und öffnet die URL
<h2>${s.name}</h2> card.style.cursor = 'pointer'; // Visueller Hinweis für den Benutzer
<p>${s.adresse || ''}</p> card.addEventListener('click', () => {
</div> // Öffnet die URL des Dienstes in einem neuen Tab
<div class="status-badge ${st.status}"> if (s.adresse) {
${ chrome.tabs.create({ url: s.adresse });
st.status === 'online' }
? icons.online + 'Online' + (st.responseTime ? ` · ${st.responseTime} ms` : '') });
: st.status === 'offline' // === ENDE DER ÄNDERUNG ===
? icons.offline + 'Offline'
: icons.unknown + 'Prüfung…' card.innerHTML = `
} <div class="service-info">
</div> <h2>${s.name}</h2>
`; <p>${s.adresse || ''}</p>
</div>
list.appendChild(card); <div class="status-badge ${st.status}">
}); ${
}); st.status === 'online'
}); ? icons.online + 'Online' + (st.responseTime ? ` · ${st.responseTime} ms` : '')
} : st.status === 'offline'
? icons.offline + 'Offline'
// Event Listener für Zahnrad-Button : icons.unknown + 'Prüfung…'
if (settingsBtn) { }
settingsBtn.addEventListener('click', () => { </div>
chrome.runtime.openOptionsPage(() => { `;
if (chrome.runtime.lastError) {
console.error(chrome.runtime.lastError); list.appendChild(card);
window.open('options.html', '_blank'); // Fallback });
} });
}); });
}); }
}
// Event Listener für Zahnrad-Button
render(); if (settingsBtn) {
chrome.storage.onChanged.addListener(render); settingsBtn.addEventListener('click', () => {
chrome.runtime.openOptionsPage(() => {
if (chrome.runtime.lastError) {
console.error(chrome.runtime.lastError);
window.open('options.html', '_blank'); // Fallback
}
});
});
}
render();
chrome.storage.onChanged.addListener(render);
}); });

923
style.css
View File

@@ -1,429 +1,494 @@
/* ============================================= */ /* ============================================= */
/* UPTIME MONITOR STYLE.CSS 2025 */ /* UPTIME MONITOR STYLE.CSS 2025 */
/* Modern Popup Kompakt & Clean */ /* Modern Popup Kompakt & Clean */
/* Optionspage bleibt unverändert */ /* Optionspage bleibt unverändert */
/* ============================================= */ /* ============================================= */
/* === Farbvariablen === */ /* === Farbvariablen === */
:root { :root {
--bg-color: #f0f2f5; --bg-color: #f0f2f5;
--card-bg: #ffffff; --card-bg: #ffffff;
--text-color: #1c1e21; --text-color: #1c1e21;
--text-secondary: #65676b; --text-secondary: #65676b;
--border-color: #dddfe2; --border-color: #dddfe2;
--shadow-color: rgba(0, 0, 0, 0.08); --shadow-color: rgba(0, 0, 0, 0.08);
--accent-color: #1877f2; --accent-color: #1877f2;
--online-color: #31a24c; --online-color: #31a24c;
--offline-color: #e4606d; --offline-color: #e4606d;
--unknown-color: #8e8e93; --unknown-color: #8e8e93;
} }
@media (prefers-color-scheme: dark) { @media (prefers-color-scheme: dark) {
:root { :root {
--bg-color: #18191a; --bg-color: #18191a;
--card-bg: #242526; --card-bg: #242526;
--text-color: #e4e6eb; --text-color: #e4e6eb;
--text-secondary: #b0b3b8; --text-secondary: #b0b3b8;
--border-color: #3e4042; --border-color: #3e4042;
--shadow-color: rgba(0, 0, 0, 0.3); --shadow-color: rgba(0, 0, 0, 0.3);
--accent-color: #2d88ff; --accent-color: #2d88ff;
} }
} }
/* === Resets === */ /* === Resets === */
*, *::before, *::after { box-sizing: border-box; } *, *::before, *::after { box-sizing: border-box; }
body { body {
margin: 0; margin: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
background: var(--bg-color); background: var(--bg-color);
color: var(--text-color); color: var(--text-color);
font-size: 15px; font-size: 15px;
line-height: 1.5; line-height: 1.5;
} }
/* ==================== POPUP Rahmen & Glas ==================== */ /* ==================== POPUP Rahmen & Glas ==================== */
.popup-body { margin: 0; padding: 0; background: transparent; } .popup-body { margin: 0; padding: 0; background: transparent; }
.popup { .popup {
width: 450px; width: 450px;
height: 540px; /* Feste Höhe hinzugefügt */ height: 540px; /* Feste Höhe hinzugefügt */
display: flex; display: flex;
flex-direction: column; /* Layout für Header und Content-Bereich */ flex-direction: column; /* Layout für Header und Content-Bereich */
background: var(--bg-color); background: var(--bg-color);
border-radius: 20px; border-radius: 20px;
overflow: hidden; overflow: hidden;
box-shadow: 0 20px 50px rgba(0,0,0,0.25); box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
backdrop-filter: blur(20px); backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
position: relative; position: relative;
outline: 2px solid rgba(255,255,255,0.28); outline: 2px solid rgba(255, 255, 255, 0.28);
outline-offset: -2px; outline-offset: -2px;
} }
.popup::before { .popup::before {
content: ''; content: '';
position: absolute; position: absolute;
inset: 0; inset: 0;
border-radius: 20px; border-radius: 20px;
padding: 1px; padding: 1px;
background: linear-gradient(135deg, rgba(255,255,255,0.4), rgba(255,255,255,0.15) 40%, transparent); background: linear-gradient(135deg, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.15) 40%, transparent);
-webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0); -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
-webkit-mask-composite: destination-out; -webkit-mask-composite: destination-out;
mask-composite: exclude; mask-composite: exclude;
pointer-events: none; pointer-events: none;
z-index: 10; z-index: 10;
} }
.header { .header {
flex-shrink: 0; /* Verhindert, dass der Header schrumpft */ flex-shrink: 0; /* Verhindert, dass der Header schrumpft */
padding: 20px 24px 16px; padding: 20px 24px 16px;
text-align: center; text-align: center;
background: linear-gradient(135deg, rgba(255,255,255,0.9), rgba(255,255,255,0.7)); background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.7));
border-bottom: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color);
z-index: 2; z-index: 2;
position: relative; position: relative;
} }
@media (prefers-color-scheme: dark) { @media (prefers-color-scheme: dark) {
.header { background: linear-gradient(135deg, rgba(36,37,38,0.95), rgba(30,31,32,0.85)); } .header { background: linear-gradient(135deg, rgba(36, 37, 38, 0.95), rgba(30, 31, 32, 0.85)); }
} }
.header h1 { .header h1 {
margin: 0; margin: 0;
font-size: 19px; font-size: 19px;
font-weight: 700; font-weight: 700;
position: relative; position: relative;
} }
/* Header Status Dot nur im Header */ /* Header Status Dot nur im Header */
.header .status-dot { .header .status-dot {
position: absolute; position: absolute;
top: 50%; top: 50%;
right: 22px; right: 22px;
width: 13px; width: 13px;
height: 13px; height: 13px;
border-radius: 50%; border-radius: 50%;
background: var(--unknown-color); background: var(--unknown-color);
transform: translateY(-50%); transform: translateY(-50%);
z-index: 4; z-index: 4;
pointer-events: none; pointer-events: none;
box-shadow: none; box-shadow: none;
} }
/* Zahnrad-Button im Header */ /* Zahnrad-Button im Header */
.icon-btn#settings-btn { .icon-btn#settings-btn {
position: absolute; position: absolute;
left: 20px; left: 20px;
top: 50%; top: 50%;
transform: translateY(-50%); transform: translateY(-50%);
width: 28px; width: 28px;
height: 28px; height: 28px;
padding: 0; padding: 0;
border: none; border: none;
background: transparent; background: transparent;
cursor: pointer; cursor: pointer;
color: var(--text-secondary); color: var(--text-secondary);
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
z-index: 3; z-index: 3;
} }
.icon-btn#settings-btn svg { .icon-btn#settings-btn svg {
width: 20px; width: 20px;
height: 20px; height: 20px;
pointer-events: none; pointer-events: none;
} }
.icon-btn#settings-btn:hover { .icon-btn#settings-btn:hover {
background: rgba(24,119,242,0.08); background: rgba(24, 119, 242, 0.08);
color: var(--accent-color); color: var(--accent-color);
border-radius: 6px; border-radius: 6px;
} }
/* ==================== STATUS DOTS für Server ==================== */ /* ==================== STATUS DOTS für Server ==================== */
.status-dot.small { .status-dot.small {
width: 10px; width: 10px;
height: 10px; height: 10px;
border-radius: 50%; border-radius: 50%;
display: inline-block; display: inline-block;
margin-right: 8px; margin-right: 8px;
} }
.status-dot.small.online { background: var(--online-color); box-shadow: 0 0 6px rgba(49,162,76,0.25); } .status-dot.small.online { background: var(--online-color); box-shadow: 0 0 6px rgba(49, 162, 76, 0.25); }
.status-dot.small.offline { background: var(--offline-color); box-shadow: 0 0 6px rgba(228,96,109,0.25); } .status-dot.small.offline { background: var(--offline-color); box-shadow: 0 0 6px rgba(228, 96, 109, 0.25); }
.status-dot.small.unknown { background: var(--unknown-color); box-shadow: none; opacity:0.8; } .status-dot.small.unknown { background: var(--unknown-color); box-shadow: none; opacity: 0.8; }
.status-dot.green.pulse { background: #31a24c; animation: pulse-green 2s infinite; } .status-dot.green.pulse { background: #31a24c; animation: pulse-green 2s infinite; }
.status-dot.orange { background: #ff9f0a; animation: pulse-orange 2.5s infinite; } .status-dot.orange { background: #ff9f0a; animation: pulse-orange 2.5s infinite; }
.status-dot.red { background: #e4606d; animation: pulse-red 2s infinite; } .status-dot.red { background: #e4606d; animation: pulse-red 2s infinite; }
@keyframes pulse-green { 0% { box-shadow: 0 0 0 0 rgba(49,162,76,0.7); } 70% { box-shadow: 0 0 0 12px rgba(49,162,76,0); } 100% { box-shadow: 0 0 0 0 rgba(49,162,76,0); } } @keyframes pulse-green { 0% { box-shadow: 0 0 0 0 rgba(49, 162, 76, 0.7); } 70% { box-shadow: 0 0 0 12px rgba(49, 162, 76, 0); } 100% { box-shadow: 0 0 0 0 rgba(49, 162, 76, 0); } }
@keyframes pulse-orange { 0% { box-shadow: 0 0 0 0 rgba(255,159,10,0.7); } 70% { box-shadow: 0 0 0 12px rgba(255,159,10,0); } 100% { box-shadow: 0 0 0 0 rgba(255,159,10,0); } } @keyframes pulse-orange { 0% { box-shadow: 0 0 0 0 rgba(255, 159, 10, 0.7); } 70% { box-shadow: 0 0 0 12px rgba(255, 159, 10, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 159, 10, 0); } }
@keyframes pulse-red { 0% { box-shadow: 0 0 0 0 rgba(228,96,109,0.7); } 70% { box-shadow: 0 0 0 12px rgba(228,96,109,0); } 100% { box-shadow: 0 0 0 0 rgba(228,96,109,0); } } @keyframes pulse-red { 0% { box-shadow: 0 0 0 0 rgba(228, 96, 109, 0.7); } 70% { box-shadow: 0 0 0 12px rgba(228, 96, 109, 0); } 100% { box-shadow: 0 0 0 0 rgba(228, 96, 109, 0); } }
/* ==================== POPUP-SERVICE-LISTE GRID ==================== */ /* ==================== POPUP-SERVICE-LISTE GRID ==================== */
.services { .services {
flex-grow: 1; /* Füllt den verfügbaren Platz im Flexbox-Container */ flex-grow: 1; /* Füllt den verfügbaren Platz im Flexbox-Container */
padding: 14px 14px 18px; padding: 14px 14px 18px;
display: grid; display: grid;
grid-template-columns: repeat(2, 1fr); grid-template-columns: repeat(2, 1fr);
gap: 12px; gap: 12px;
overflow: hidden; /* Kein Scrollen */ overflow: hidden; /* Kein Scrollen */
} }
/* Modifikator-Klasse für 8 oder weniger Server */ /* Modifikator-Klasse für 8 oder weniger Server */
.services.few-servers { .services.few-servers {
grid-template-columns: 1fr; /* Wechsel zu einer Spalte */ grid-template-columns: 1fr; /* Wechsel zu einer Spalte */
} }
/* Kompakte kleine Kacheln */ /* Kompakte kleine Kacheln */
.service-card { .service-card {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 6px; gap: 6px;
padding: 12px 14px; padding: 12px 14px;
background: var(--card-bg); background: var(--card-bg);
border-radius: 14px; border-radius: 14px;
border: 1px solid var(--border-color); border: 1px solid var(--border-color);
transition: all 0.25s ease; transition: all 0.25s ease;
} }
.service-card:hover { .service-card:hover {
transform: translateY(-3px); transform: translateY(-3px);
box-shadow: 0 10px 25px rgba(0,0,0,0.15); box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
border-color: transparent; border-color: transparent;
} }
/* Titel + Untertitel */ /* Titel + Untertitel */
.service-info h2 { margin: 0; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .service-info h2 { margin: 0; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.service-info p { margin: 0; font-size: 12px; opacity: 0.8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .service-info p { margin: 0; font-size: 12px; opacity: 0.8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Status Badge */ /* Status Badge */
.status-badge { .status-badge {
padding: 4px 10px; padding: 4px 10px;
border-radius: 20px; border-radius: 20px;
font-size: 12px; font-size: 12px;
font-weight: 600; font-weight: 600;
text-align: center; text-align: center;
align-self: flex-start; align-self: flex-start;
} }
.status-badge.online { background: rgba(49,162,76,0.15); color: #31a24c; } .status-badge.online { background: rgba(49, 162, 76, 0.15); color: #31a24c; }
.status-badge.offline { background: rgba(228,96,109,0.15); color: #e4606d; } .status-badge.offline { background: rgba(228, 96, 109, 0.15); color: #e4606d; }
.status-badge.unknown { background: rgba(142,142,147,0.15); color: #8e8e93; } .status-badge.unknown { background: rgba(142, 142, 147, 0.15); color: #8e8e93; }
/* Mini Response-Time */ /* Mini Response-Time */
.service-card .response-time { font-size: 11px; opacity: 0.65; } .service-card .response-time { font-size: 11px; opacity: 0.65; }
/* ==================== EMPTY STATE ==================== */ /* ==================== EMPTY STATE ==================== */
.empty-state { .empty-state {
text-align: center; text-align: center;
padding: 60px 20px; padding: 60px 20px;
color: var(--text-secondary); color: var(--text-secondary);
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
.empty-icon { .empty-icon {
width: 80px; width: 80px;
height: 80px; height: 80px;
margin-bottom: 20px; margin-bottom: 20px;
background: var(--border-color); background: var(--border-color);
border-radius: 20px; border-radius: 20px;
opacity: 0.2; opacity: 0.2;
} }
/* ==================== NEU: POPUP SERVER SELECTION ==================== */ /* ==================== NEU: POPUP SERVER SELECTION ==================== */
.popup-server-list { .popup-server-list {
display: grid; display: grid;
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
gap: 10px; gap: 10px;
margin-top: 15px; margin-top: 15px;
max-height: 300px; /* ANGEPASST: Feste Höhe für eigenen Scrollbalk */
overflow-y: auto; height: 300px;
padding-right: 5px; overflow-y: auto;
} padding-right: 5px;
}
.popup-server-item {
display: flex; .popup-server-item {
align-items: center; display: flex;
padding: 10px; align-items: center;
border: 1px solid var(--border-color); padding: 10px;
border-radius: 8px; border: 1px solid var(--border-color);
background: var(--card-bg); border-radius: 8px;
transition: all 0.2s ease; background: var(--card-bg);
} transition: all 0.2s ease;
}
.popup-server-item:hover {
background: rgba(24,119,242,0.05); .popup-server-item:hover {
border-color: var(--accent-color); background: rgba(24, 119, 242, 0.05);
} border-color: var(--accent-color);
}
.popup-server-item input[type="checkbox"] {
margin-right: 10px; .popup-server-item input[type="checkbox"] {
width: 18px; margin-right: 10px;
height: 18px; width: 18px;
accent-color: var(--accent-color); height: 18px;
cursor: pointer; accent-color: var(--accent-color);
} cursor: pointer;
}
.popup-server-item .server-info {
flex: 1; .popup-server-item .server-info {
cursor: pointer; flex: 1;
} cursor: pointer;
}
.popup-server-item .server-name {
font-weight: 600; .popup-server-item .server-name {
margin-bottom: 3px; font-weight: 600;
white-space: nowrap; margin-bottom: 3px;
overflow: hidden; white-space: nowrap;
text-overflow: ellipsis; overflow: hidden;
} text-overflow: ellipsis;
}
.popup-server-item .server-address {
font-size: 12px; .popup-server-item .server-address {
color: var(--text-secondary); font-size: 12px;
white-space: nowrap; color: var(--text-secondary);
overflow: hidden; white-space: nowrap;
text-overflow: ellipsis; overflow: hidden;
} text-overflow: ellipsis;
}
.selection-info {
padding: 8px 12px; .selection-info {
background: rgba(24,119,242,0.1); padding: 8px 12px;
border-radius: 8px; background: rgba(24, 119, 242, 0.1);
margin-bottom: 10px; border-radius: 8px;
font-weight: 500; margin-bottom: 10px;
color: var(--accent-color); font-weight: 500;
} color: var(--accent-color);
}
/* ==================== FOOTER ==================== */
.footer { /* ==================== FOOTER ==================== */
padding: 16px 24px 20px; .footer {
text-align: center; padding: 16px 24px 20px;
background: var(--card-bg); text-align: center;
border-top: 1px solid var(--border-color); background: var(--card-bg);
} border-top: 1px solid var(--border-color);
}
.footer a {
color: var(--accent-color); .footer a {
font-weight: 600; color: var(--accent-color);
font-size: 15px; font-weight: 600;
padding: 10px 20px; font-size: 15px;
border-radius: 12px; padding: 10px 20px;
} border-radius: 12px;
}
.footer a:hover { background: rgba(24,119,242,0.1); }
.footer a:hover { background: rgba(24, 119, 242, 0.1); }
/* ==================== OPTIONS PAGE ==================== */
.options-page { background: var(--bg-color); color: var(--text-color); padding: 20px; min-height: 100vh; } /* ==================== OPTIONS PAGE ==================== */
.options-grid-container { max-width: 1400px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; } .options-page { background: var(--bg-color); color: var(--text-color); padding: 20px; min-height: 100vh; }
.options-grid-container { max-width: 1400px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
.card, .widget-card {
background: var(--card-bg); .card, .widget-card {
border-radius: 12px; background: var(--card-bg);
padding: 24px; border-radius: 12px;
box-shadow: 0 4px 12px var(--shadow-color); padding: 24px;
border: 1px solid var(--border-color); box-shadow: 0 4px 12px var(--shadow-color);
} border: 1px solid var(--border-color);
}
.card h1, .card h2, .widget-card h2 {
margin: 0 0 20px 0; .card h1, .card h2, .widget-card h2 {
font-size: 20px; margin: 0 0 20px 0;
font-weight: 600; font-size: 20px;
color: var(--text-color); font-weight: 600;
} color: var(--text-color);
}
.tab-nav {
display: flex; .tab-nav {
background: var(--card-bg); display: flex;
border-radius: 12px; background: var(--card-bg);
padding: 4px; border-radius: 12px;
margin-bottom: 20px; padding: 4px;
border: 1px solid var(--border-color); margin-bottom: 20px;
} border: 1px solid var(--border-color);
}
.tab-btn { flex: 1; padding: 12px 20px; background: none; color: var(--text-secondary); border: none; border-radius: 8px; cursor: pointer;}
.tab-btn.active { background: var(--accent-color); color: white; } .tab-btn { flex: 1; padding: 12px 20px; background: none; color: var(--text-secondary); border: none; border-radius: 8px; cursor: pointer; }
.tab-btn.active { background: var(--accent-color); color: white; }
.tab-panel { display: none; }
.tab-panel.active { display: block; } .tab-panel { display: none; }
.tab-panel.active { display: block; }
#manage-panel .manage-grid { display: grid; grid-template-columns: 1fr 3.8fr 1fr; gap: 28px; }
@media (max-width: 1100px) { #manage-panel .manage-grid { grid-template-columns: 1fr; } }
#manage-panel .manage-grid { display: grid; grid-template-columns: 1fr 3.5fr 1.2fr; gap: 28px; }
.stats-grid { display: grid; grid-template-columns: 1fr 1.9fr; gap: 28px; } @media (max-width: 1100px) { #manage-panel .manage-grid { grid-template-columns: 1fr; } }
@media (max-width: 900px) { .stats-grid { grid-template-columns: 1fr; } }
.form-section { display: flex; flex-direction: column; gap: 20px; } .stats-grid {
.form-group { margin-bottom: 16px; } display: grid;
label { display: block; margin-bottom: 6px; color: var(--text-secondary); } grid-template-columns: 1fr 800px;
input, select { width: 100%; padding: 12px 16px; border: 1px solid var(--border-color); border-radius: 8px; } gap: 28px;
}
.input-group { display: flex; gap: 8px; } @media (max-width: 800px) {
#service-protocol { width: 130px; } .stats-grid {
grid-template-columns: 1fr;
.btn { padding: 12px 20px; border-radius: 8px; font-size: 15px; cursor: pointer; border: none;} }
.btn-primary { background: var(--accent-color); color: white; } }
.btn-primary:hover { background: #166fe5; }
.btn-secondary { background: #eee; color: #333; } /* ANGEPASST: Feste Größe für Chart-Karte */
.btn-secondary:hover { background: #ddd; } .stats-chart-card {
display: flex;
.checkbox-group { display: flex; align-items: center; gap: 12px; margin: 12px 0; } flex-direction: column;
.checkbox-group input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent-color); } padding: 16px;
border-radius: 10px;
.service-item { padding: 16px; border: 1px solid var(--border-color); border-radius: 8px; margin-bottom: 12px; } background: var(--card-bg);
.service-item:hover { box-shadow: 0 2px 8px var(--shadow-color); } width: 800px;
height: 500px;
.response-time { font-size: 12px; opacity: 0.7; } overflow-y: auto;
}
/* =========================== */
/* Styles für die verbesserte Serverliste (Stats-Tab) */ #uptimeChart { width: 100% !important; height: 100% !important; display: block; }
/* =========================== */
.services-stat-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; } .form-section { display: flex; flex-direction: column; gap: 20px; }
.form-group { margin-bottom: 16px; }
.service-stat-item {
display: flex; label { display: block; margin-bottom: 6px; color: var(--text-secondary); }
justify-content: space-between; input, select { width: 100%; padding: 12px 16px; border: 1px solid var(--border-color); border-radius: 8px; }
align-items: center;
gap: 12px; .input-group { display: flex; gap: 8px; }
padding: 12px; #service-protocol { width: 130px; }
border-radius: 12px;
border: 1px solid var(--border-color); .btn { padding: 12px 20px; border-radius: 8px; font-size: 15px; cursor: pointer; border: none; }
background: var(--card-bg); .btn-primary { background: var(--accent-color); color: white; }
transition: box-shadow .12s, transform .12s; .btn-primary:hover { background: #166fe5; }
} .btn-secondary { background: #eee; color: #333; }
.btn-secondary:hover { background: #ddd; }
.service-stat-item:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,0.06); }
.service-stat-item.selected { outline: 2px solid rgba(24,119,242,0.12); box-shadow: 0 8px 22px rgba(24,119,242,0.06); } .checkbox-group { display: flex; align-items: center; gap: 12px; margin: 12px 0; }
.checkbox-group input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent-color); }
.service-left { display: flex; flex-direction: column; min-width: 0; gap: 4px; }
.service-name { font-weight: 600; font-size: 14px; color: var(--text-color); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .service-item { padding: 16px; border: 1px solid var(--border-color); border-radius: 8px; margin-bottom: 12px; }
.service-sub { font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .service-item:hover { box-shadow: 0 2px 8px var(--shadow-color); }
.service-right { display: flex; align-items: center; gap: 12px; } .response-time { font-size: 12px; opacity: 0.7; }
.service-meta { display:flex; align-items:center; gap:8px; font-size:12px; color:var(--text-secondary); } /* =========================== */
/* Styles für die verbesserte Serverliste (Stats-Tab) */
/* icon buttons */ /* =========================== */
.icon-btn { display: inline-flex; align-items: center; justify-content: center; padding:6px; border-radius:8px; border: none; background: transparent; cursor: pointer; transition: background .12s, color .12s; color: var(--text-secondary); } .services-stat-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.icon-btn:hover { background: rgba(24,119,242,0.06); color: var(--accent-color); }
.icon-btn.delete:hover { background: rgba(228,96,109,0.06); color: var(--offline-color); } .service-stat-item {
display: flex;
/* edit inline */ justify-content: space-between;
.service-stat-item.editing { padding: 8px; } align-items: center;
.edit-left { display:flex; flex-direction:column; gap:8px; width:100%; } gap: 12px;
.edit-left input { padding:8px 10px; border-radius:8px; border:1px solid var(--border-color); background:var(--card-bg); } padding: 12px;
.edit-actions { display:flex; gap:8px; align-items:center; } border-radius: 12px;
.btn-save, .btn-cancel { padding:6px 10px; border-radius:8px; border:none; cursor:pointer; font-weight:600; } border: 1px solid var(--border-color);
.btn-save { background:var(--accent-color); color:white; } background: var(--card-bg);
.btn-cancel { background:#eee; color:#333; } transition: box-shadow .12s, transform .12s;
}
/* Stats-Tab: Chart größer */
.stats-chart-card { display: flex; flex-direction: column; padding: 16px; border-radius: 12px; background: var(--card-bg); flex: 2; min-height: 500px; } .service-stat-item:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06); }
#uptimeChart { width: 100% !important; height: 100% !important; display: block; } .service-stat-item.selected { outline: 2px solid rgba(24, 119, 242, 0.12); box-shadow: 0 8px 22px rgba(24, 119, 242, 0.06); }
.service-left { display: flex; flex-direction: column; min-width: 0; gap: 4px; }
.service-name { font-weight: 600; font-size: 14px; color: var(--text-color); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.service-sub { font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.service-right { display: flex; align-items: center; gap: 12px; }
.service-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-secondary); }
/* icon buttons */
.icon-btn { display: inline-flex; align-items: center; justify-content: center; padding: 6px; border-radius: 8px; border: none; background: transparent; cursor: pointer; transition: background .12s, color .12s; color: var(--text-secondary); }
.icon-btn:hover { background: rgba(24, 119, 242, 0.06); color: var(--accent-color); }
.icon-btn.delete:hover { background: rgba(228, 96, 109, 0.06); color: var(--offline-color); }
/* edit inline */
.service-stat-item.editing { padding: 8px; }
.edit-left { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.edit-left input { padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border-color); background: var(--card-bg); }
.edit-actions { display: flex; gap: 8px; align-items: center; }
.btn-save, .btn-cancel { padding: 6px 10px; border-radius: 8px; border: none; cursor: pointer; font-weight: 600; }
.btn-save { background: var(--accent-color); color: white; }
.btn-cancel { background: #eee; color: #333; }
/* ============================================= */
/* ABSTAND FÜR WIDGETS IN DER SEITENLEISTE */
/* ============================================= */
/* Fügt einen Abstand zwischen den Widgets in der rechten Seitenleiste hinzu */
.widget-area-right .widget-card + .widget-card {
margin-top: 20px;
}
/* ============================================= */
/* GITEA REPOSITORY WIDGET LINKS */
/* ============================================= */
#gitea-repos-list a {
color: white;
}
/* ============================================= */
/* DISCORD SUPPORT WIDGET BUTTON */
/* ============================================= */
.discord-link {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 8px;
width: 100%;
padding: 12px 16px;
margin-top: 16px;
background-color: #5865F2;
color: white;
text-decoration: none;
border-radius: 8px;
font-weight: 600;
transition: background-color 0.2s ease;
}
.discord-link:hover {
background-color: #4752C4;
}