From 22b414f69e1a17acb34ad416fd15226fdb14d7ea Mon Sep 17 00:00:00 2001 From: "2569718930@qq.com" <2569718930@qq.com> Date: Thu, 14 May 2026 00:10:43 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9B=91=E6=8E=A7=E9=A1=B5=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E7=94=A8=E6=88=B7=E6=9C=AC=E5=9C=B0=E6=97=B6?= =?UTF-8?q?=E9=97=B4=EF=BC=88JS=20toLocaleTimeString=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/monitor_routes.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/web/monitor_routes.py b/web/monitor_routes.py index c728f01d..e2513e23 100644 --- a/web/monitor_routes.py +++ b/web/monitor_routes.py @@ -115,7 +115,7 @@ def _build_cards() -> tuple: logger.exception("monitor: failed city {}", cfg["key"]) cards.sort(key=lambda c: (c["ct"] is not None, c["ct"] or -999), reverse=True) - return cards, datetime.now(timezone.utc).strftime("%H:%M:%S UTC") + return cards, datetime.now(timezone.utc).isoformat() def _render(cards, gts): """Build card grid HTML.""" @@ -157,7 +157,7 @@ def _render(cards, gts): return f'''
-{gts} +{gts[11:19] if len(gts) > 19 else gts} {chr(10).join(cards_html)}
Refreshing…
''' @@ -226,7 +226,7 @@ body{background:#0f1117;color:#c8cdd4;font-family:-apple-system,BlinkMacSystemFo - %s + %s @@ -239,7 +239,7 @@ function toggleNotify(){NF=!NF;localStorage.setItem('monitor_notify',NF?'on':'of function U(){var i=document.getElementById('notify-icon');var b=document.getElementById('notify-toggle');if(NF){i.textContent='🔔';b.classList.remove('muted')}else{i.textContent='🔕';b.classList.add('muted')}} function N(en,t){if(!NF||Notification.permission!=='granted')return;var k=en+'|'+t;var d=new Date().toDateString();if(NH._day!==d)NH={_day:d};if(NH[k])return;NH[k]=true;localStorage.setItem('monitor_notified_highs',JSON.stringify(NH));new Notification('🔴 New High — '+en,{body:t+'°C\\nNew daily high.',tag:k,requireInteraction:true})} U(); -(function(){let p={};document.body.addEventListener('htmx:afterSwap',function(e){if(e.detail.target.id!=='card-grid')return;document.querySelectorAll('.card').forEach(function(c){var n=c.querySelector('.city-name').textContent;var v=c.querySelector('.temp-value').textContent;var o=p[n];p[n]=v;if(o&&o!==v&&v!=='--'){c.style.transition='none';c.style.boxShadow='0 0 14px rgba(52,211,153,0.40)';requestAnimationFrame(function(){c.style.transition='box-shadow 2s ease-out';c.style.boxShadow=''})}if(c.dataset.newHigh==='true')N(n,v)})})})(); +(function(){let p={};document.body.addEventListener('htmx:afterSwap',function(e){if(e.detail.target.id!=='card-grid')return;document.querySelectorAll('.card').forEach(function(c){var n=c.querySelector('.city-name').textContent;var v=c.querySelector('.temp-value').textContent;var o=p[n];p[n]=v;if(o&&o!==v&&v!=='--'){c.style.transition='none';c.style.boxShadow='0 0 14px rgba(52,211,153,0.40)';requestAnimationFrame(function(){c.style.transition='box-shadow 2s ease-out';c.style.boxShadow=''})}if(c.dataset.newHigh==='true')N(n,v)})});var el=document.getElementById('update-time');if(el)el.textContent=new Date().toLocaleTimeString();})(); """ @@ -248,7 +248,7 @@ U(); @router.get("/m", response_class=HTMLResponse) async def monitor_page(request: Request): cards, gts = _build_cards() - return HTMLResponse(PAGE_HTML % (gts, _render(cards, gts))) + return HTMLResponse(PAGE_HTML % _render(cards, gts)) @router.get("/m/cards", response_class=HTMLResponse) async def monitor_cards(request: Request):