From eee159c533293a1defcd5bcf40df15f8e5bcb349 Mon Sep 17 00:00:00 2001 From: "2569718930@qq.com" <2569718930@qq.com> Date: Thu, 5 Mar 2026 01:41:14 +0800 Subject: [PATCH] feat: introduce dark theme styling for the web UI and a module for weather data sources. --- src/data_collection/weather_sources.py | 8 ++++-- web/static/style.css | 39 ++++++++++++++++++++------ 2 files changed, 36 insertions(+), 11 deletions(-) diff --git a/src/data_collection/weather_sources.py b/src/data_collection/weather_sources.py index 8f9dcb8a..727392ce 100644 --- a/src/data_collection/weather_sources.py +++ b/src/data_collection/weather_sources.py @@ -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: diff --git a/web/static/style.css b/web/static/style.css index e35bde5e..30cabe7c 100644 --- a/web/static/style.css +++ b/web/static/style.css @@ -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 ── */