Add optional weather API key support

This commit is contained in:
2026-01-22 23:00:41 +01:00
parent 144c813acf
commit 20c0569731
2 changed files with 90 additions and 18 deletions
+12 -1
View File
@@ -1271,7 +1271,7 @@ class AdminManager {
// Weather Settings
$output .= '<div class="settings-group">';
$output .= '<h4>🌤️ Wetter-Widget <span style="font-size:12px; color:#4CAF50;">(Open-Meteo - 100% kostenlos!)</span></h4>';
$output .= '<h4>🌤️ Wetter-Widget <span style="font-size:12px; color:#4CAF50;">(Open-Meteo kostenlos, OpenWeatherMap optional)</span></h4>';
$output .= '<div class="setting-row">';
$output .= '<span class="setting-label">Wetter-Widget anzeigen</span>';
@@ -1283,6 +1283,13 @@ class AdminManager {
$output .= '</div>';
$output .= '</div>';
$output .= '<div class="setting-row">';
$output .= '<span class="setting-label">API Key (OpenWeatherMap, optional)</span>';
$output .= '<div class="setting-input">';
$output .= '<input type="text" id="setting-weather-api-key" class="text-input" placeholder="OWM API Key" value="' . htmlspecialchars($settingsManager->get('weather.api_key')) . '">';
$output .= '</div>';
$output .= '</div>';
$output .= '<div class="setting-row">';
$output .= '<span class="setting-label">Standort (Stadt,Land)</span>';
$output .= '<div class="setting-input">';
@@ -3578,6 +3585,10 @@ const AdminSettings = {
this.updateSetting('weather.enabled', e.target.checked);
});
document.getElementById('setting-weather-api-key')?.addEventListener('change', (e) => {
this.updateSetting('weather.api_key', e.target.value);
});
document.getElementById('setting-weather-location')?.addEventListener('change', (e) => {
this.updateSetting('weather.location', e.target.value);
});