INNER CODE UNIT · Python
_maybe_notify_update
slive777/OpenAver · web/app.py:63
def _maybe_notify_update(result: dict) -> None:
"""同一最新版本只發一次通知,並在設定鎖內保存已通知版本。"""
if not result.get("has_update"):
return
latest = result.get("latest_version")
cfg = load_config()
if latest and latest != cfg.get("general", {}).get("last_notified_update_version", ""):
emit_notification(
"info", "notif.update_available",
message=f"v{latest}", url=result.get("download_url", ""),
)
def _remember(config: dict) -> None:
config.setdefault("general", {})["last_notified_update_version"] = latest
mutate_config(_remember)
async def _startup_update_check() -> None:
"""啟動時背景檢查新版;任何錯誤只記錄,不阻斷啟動。"""