Update window title handling and ensure consistent version retrieval in configuration
Some checks failed
Tests & Quality Checks / Test on Python 3.11 (push) Has been cancelled
Tests & Quality Checks / Test on Python 3.12 (push) Has been cancelled
Tests & Quality Checks / Test on Python 3.11-1 (push) Has been cancelled
Tests & Quality Checks / Test on Python 3.12-1 (push) Has been cancelled
Tests & Quality Checks / Test on Python 3.10 (push) Has been cancelled
Tests & Quality Checks / Test on Python 3.11-2 (push) Has been cancelled
Tests & Quality Checks / Test on Python 3.12-2 (push) Has been cancelled
Tests & Quality Checks / Build Artifacts (push) Has been cancelled
Tests & Quality Checks / Build Artifacts-1 (push) Has been cancelled

This commit is contained in:
claudi 2026-02-20 12:36:24 +01:00
parent e0b316fe65
commit 03991fdea5
2 changed files with 24 additions and 8 deletions

View file

@ -137,7 +137,22 @@ class Config:
log_file = Config.get_default_log_path()
app_name = data.get("app_name", "WebDrop Bridge")
window_title = data.get("window_title", f"{app_name} v{__version__}")
stored_window_title = data.get("window_title", "")
# Regenerate default window titles on version upgrade
# If the stored title matches the pattern "{app_name} v{version}", regenerate it
# with the current version. This ensures the title updates automatically on upgrades.
import re
version_pattern = re.compile(rf"^{re.escape(app_name)}\s+v[\d.]+$")
if stored_window_title and version_pattern.match(stored_window_title):
# Detected a default-pattern title with old version, regenerate
window_title = f"{app_name} v{__version__}"
elif stored_window_title:
# Custom window title, keep it as-is
window_title = stored_window_title
else:
# No window title specified, use default
window_title = f"{app_name} v{__version__}"
return cls(
app_name=app_name,
@ -178,12 +193,10 @@ class Config:
# Extract and validate configuration values
app_name = os.getenv("APP_NAME", "WebDrop Bridge")
# Version comes from __init__.py (lazy import to avoid circular imports)
if not os.getenv("APP_VERSION"):
from webdrop_bridge import __version__
app_version = __version__
else:
app_version = os.getenv("APP_VERSION")
# Version always comes from __init__.py for consistency
from webdrop_bridge import __version__
app_version = __version__
log_level = os.getenv("LOG_LEVEL", "INFO").upper()
log_file_str = os.getenv("LOG_FILE", None)
allowed_roots_str = os.getenv("ALLOWED_ROOTS", "Z:/,C:/Users/Public")