feat: introduce dark theme styling for the web UI and a module for weather data sources.

This commit is contained in:
2569718930@qq.com
2026-03-05 01:41:14 +08:00
parent 620a3f49a3
commit eee159c533
2 changed files with 36 additions and 11 deletions
+6 -2
View File
@@ -707,8 +707,12 @@ class WeatherDataCollector:
ids_str = ",".join(icaos)
# AviationWeather API 支持批量请求 IDs
url = f"https://aviationweather.gov/api/data/metar?ids={ids_str}&format=json"
resp = self.session.get(url, timeout=self.timeout)
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
}
resp = self.session.get(url, headers=headers, timeout=self.timeout)
if resp.status_code != 200:
logger.warning(f"METAR cluster fetch HTTP {resp.status_code} for {icaos}")
return []
data = resp.json()
@@ -1377,7 +1381,7 @@ class WeatherDataCollector:
# 后面可以扩展更多土耳其城市,只需在这里添加映射
turkish_provinces = {
"ankara": ("17130", "Ankara"), # (主测站ID, 省份名用于周边)
# "istanbul": ("17060", "Istanbul"),
"istanbul": ("17060", "Istanbul"),
}
if city_lower in turkish_provinces:
+30 -9
View File
@@ -825,16 +825,37 @@ body {
/* ── Nearby Markers ── */
.nearby-marker {
background: rgba(30, 41, 59, 0.85); /* 暗夜蓝透明背景 */
color: #94a3b8; /* 灰白字体 */
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 12px;
padding: 2px 6px;
font-size: 11px; /* 比主站小 */
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
background: rgba(15, 23, 42, 0.85); /* 深蓝玻璃背景 */
color: var(--accent-cyan); /* 亮青色 */
border: 1px solid rgba(34, 211, 238, 0.3); /* 青色边框 */
border-radius: 6px;
padding: 3px 8px;
font-size: 11px;
font-weight: 500;
box-shadow:
0 0 15px rgba(34, 211, 238, 0.1),
0 4px 6px rgba(0, 0, 0, 0.3);
white-space: nowrap;
backdrop-filter: blur(4px); /* 玻璃质感 */
pointer-events: none; /* Make them click-through to avoid interfering with map clicking unless tooltipped */
backdrop-filter: blur(8px);
pointer-events: none;
animation: markerFadeIn 0.5s ease-out;
}
.nearby-temp {
font-weight: 700;
color: #fff;
margin: 0 2px;
}
@keyframes markerFadeIn {
from {
opacity: 0;
transform: translateY(5px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
/* ── Custom Map Markers ── */