From 6c6602278d9436841ffd9733aa53288c105d7bc7 Mon Sep 17 00:00:00 2001 From: engelgardt Date: Sun, 17 May 2026 21:39:16 +0300 Subject: [PATCH] v1.1.3: quiet update hint in header, bump source version --- CHANGELOG.md | 11 ++++++++++- src/dhcpsrv/__init__.py | 2 +- src/dhcpsrv/app.py | 15 ++++++++++++--- src/dhcpsrv/update_check.py | 29 ++++++++++------------------- 4 files changed, 33 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 839828b..7de108d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and ## [Unreleased] +## [1.1.3] - 2026-05-17 +### Changed +- Update check no longer interrupts startup with an interactive prompt. If a newer release is available, the header line now shows a quiet `update available (vX.Y.Z)` hint right-aligned in dim grey — no key press required. +### Fixed +- Bumped `__version__` from `1.1.1` to `1.1.3` after the v1.1.2 release packaged a binary that still self-reported as v1.1.1 (the source constant was not bumped before tagging). The source is now once again the single source of truth. + ## [1.1.2] - 2026-05-17 ### Changed - Dropped the `made by engelgardt` line from the startup banner too — author credit lives in the README only. @@ -34,6 +40,9 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and - Scrollback cleared on startup so mouse-wheel doesn't expose pre-launch text. - MIT licensed. -[Unreleased]: https://github.com/Engelgardt23/dhcpsrv/compare/v1.1.0...HEAD +[Unreleased]: https://github.com/Engelgardt23/dhcpsrv/compare/v1.1.3...HEAD +[1.1.3]: https://github.com/Engelgardt23/dhcpsrv/compare/v1.1.2...v1.1.3 +[1.1.2]: https://github.com/Engelgardt23/dhcpsrv/compare/v1.1.1...v1.1.2 +[1.1.1]: https://github.com/Engelgardt23/dhcpsrv/compare/v1.1.0...v1.1.1 [1.1.0]: https://github.com/Engelgardt23/dhcpsrv/compare/v1.0.0...v1.1.0 [1.0.0]: https://github.com/Engelgardt23/dhcpsrv/releases/tag/v1.0.0 diff --git a/src/dhcpsrv/__init__.py b/src/dhcpsrv/__init__.py index f4abf74..30816bd 100644 --- a/src/dhcpsrv/__init__.py +++ b/src/dhcpsrv/__init__.py @@ -6,5 +6,5 @@ The single source of truth for the project version. Bump this before tagging a release; CI reads the tag, the code reads this constant. """ -__version__ = "1.1.1" +__version__ = "1.1.3" GITHUB_REPO = "Engelgardt23/dhcpsrv" diff --git a/src/dhcpsrv/app.py b/src/dhcpsrv/app.py index 28fb0b5..673fd99 100644 --- a/src/dhcpsrv/app.py +++ b/src/dhcpsrv/app.py @@ -9,6 +9,7 @@ import threading from rich.console import Console from rich.prompt import Confirm, Prompt +from rich.table import Table from . import __version__ from .platform_win import enable_vt, require_admin @@ -39,10 +40,18 @@ def main() -> None: require_admin() console = Console(log_path=False) - console.print(f"[bold cyan]dhcpsrv v{__version__}[/] - portable laptop-side DHCP server") - console.print() - check_for_update(console) + title = f"[bold cyan]dhcpsrv v{__version__}[/] - portable laptop-side DHCP server" + latest = check_for_update() + if latest: + header = Table.grid(expand=True) + header.add_column(justify="left", ratio=1) + header.add_column(justify="right") + header.add_row(title, f"[dim]update available ({latest})[/]") + console.print(header) + else: + console.print(title) + console.print() nic = _select_nic(console) if not nic: diff --git a/src/dhcpsrv/update_check.py b/src/dhcpsrv/update_check.py index 5ef3ff9..280ae39 100644 --- a/src/dhcpsrv/update_check.py +++ b/src/dhcpsrv/update_check.py @@ -2,16 +2,13 @@ Auto-update check. On startup, ask GitHub for the latest release tag. If it's newer than the -local `__version__`, ask the user whether to open the download page in a -browser. Silent on any error (offline, rate-limit, etc.).""" +local `__version__`, return the tag string so the caller can show a quiet +hint in the header. Silent on any error (offline, rate-limit, etc.). +""" from __future__ import annotations import json import urllib.request -import webbrowser - -from rich.console import Console -from rich.prompt import Confirm from . import __version__, GITHUB_REPO @@ -27,7 +24,10 @@ def _parse_version(s: str) -> tuple[int, int, int]: return (0, 0, 0) -def check_for_update(console: Console) -> None: +def check_for_update() -> str | None: + """Return the latest release tag (e.g. 'v1.2.0') if it is newer than the + currently running version. Returns None when up to date, offline, or on + any error — the caller decides how (or whether) to render the hint.""" try: url = f"https://api.github.com/repos/{GITHUB_REPO}/releases/latest" req = urllib.request.Request(url, headers={ @@ -37,17 +37,8 @@ def check_for_update(console: Console) -> None: with urllib.request.urlopen(req, timeout=3) as r: data = json.loads(r.read().decode("utf-8", errors="replace")) latest = (data.get("tag_name") or "").strip() - page = data.get("html_url") or f"https://github.com/{GITHUB_REPO}/releases/latest" - - if _parse_version(latest) > _parse_version(__version__): - console.rule("[bold yellow]Update available") - console.print(f"Current: [dim]v{__version__}[/] Latest: [bold green]{latest}[/]") - try: - if Confirm.ask("Open the download page in your browser?", default=True): - webbrowser.open(page) - except (EOFError, KeyboardInterrupt): - pass - console.print() + if latest and _parse_version(latest) > _parse_version(__version__): + return latest except Exception: - # Offline / API error — silent on purpose. pass + return None