v1.1.3: quiet update hint in header, bump source version
This commit is contained in:
parent
fd2f1dabb9
commit
6c6602278d
4 changed files with 33 additions and 24 deletions
11
CHANGELOG.md
11
CHANGELOG.md
|
|
@ -6,6 +6,12 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
|
||||||
|
|
||||||
## [Unreleased]
|
## [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
|
## [1.1.2] - 2026-05-17
|
||||||
### Changed
|
### Changed
|
||||||
- Dropped the `made by engelgardt` line from the startup banner too — author credit lives in the README only.
|
- 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.
|
- Scrollback cleared on startup so mouse-wheel doesn't expose pre-launch text.
|
||||||
- MIT licensed.
|
- 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.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
|
[1.0.0]: https://github.com/Engelgardt23/dhcpsrv/releases/tag/v1.0.0
|
||||||
|
|
|
||||||
|
|
@ -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.
|
a release; CI reads the tag, the code reads this constant.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__version__ = "1.1.1"
|
__version__ = "1.1.3"
|
||||||
GITHUB_REPO = "Engelgardt23/dhcpsrv"
|
GITHUB_REPO = "Engelgardt23/dhcpsrv"
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import threading
|
||||||
|
|
||||||
from rich.console import Console
|
from rich.console import Console
|
||||||
from rich.prompt import Confirm, Prompt
|
from rich.prompt import Confirm, Prompt
|
||||||
|
from rich.table import Table
|
||||||
|
|
||||||
from . import __version__
|
from . import __version__
|
||||||
from .platform_win import enable_vt, require_admin
|
from .platform_win import enable_vt, require_admin
|
||||||
|
|
@ -39,10 +40,18 @@ def main() -> None:
|
||||||
require_admin()
|
require_admin()
|
||||||
|
|
||||||
console = Console(log_path=False)
|
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)
|
nic = _select_nic(console)
|
||||||
if not nic:
|
if not nic:
|
||||||
|
|
|
||||||
|
|
@ -2,16 +2,13 @@
|
||||||
Auto-update check.
|
Auto-update check.
|
||||||
|
|
||||||
On startup, ask GitHub for the latest release tag. If it's newer than the
|
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
|
local `__version__`, return the tag string so the caller can show a quiet
|
||||||
browser. Silent on any error (offline, rate-limit, etc.)."""
|
hint in the header. Silent on any error (offline, rate-limit, etc.).
|
||||||
|
"""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
import json
|
import json
|
||||||
import urllib.request
|
import urllib.request
|
||||||
import webbrowser
|
|
||||||
|
|
||||||
from rich.console import Console
|
|
||||||
from rich.prompt import Confirm
|
|
||||||
|
|
||||||
from . import __version__, GITHUB_REPO
|
from . import __version__, GITHUB_REPO
|
||||||
|
|
||||||
|
|
@ -27,7 +24,10 @@ def _parse_version(s: str) -> tuple[int, int, int]:
|
||||||
return (0, 0, 0)
|
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:
|
try:
|
||||||
url = f"https://api.github.com/repos/{GITHUB_REPO}/releases/latest"
|
url = f"https://api.github.com/repos/{GITHUB_REPO}/releases/latest"
|
||||||
req = urllib.request.Request(url, headers={
|
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:
|
with urllib.request.urlopen(req, timeout=3) as r:
|
||||||
data = json.loads(r.read().decode("utf-8", errors="replace"))
|
data = json.loads(r.read().decode("utf-8", errors="replace"))
|
||||||
latest = (data.get("tag_name") or "").strip()
|
latest = (data.get("tag_name") or "").strip()
|
||||||
page = data.get("html_url") or f"https://github.com/{GITHUB_REPO}/releases/latest"
|
if latest and _parse_version(latest) > _parse_version(__version__):
|
||||||
|
return 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()
|
|
||||||
except Exception:
|
except Exception:
|
||||||
# Offline / API error — silent on purpose.
|
|
||||||
pass
|
pass
|
||||||
|
return None
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue