From dcdbedc26eb45372119f8f1504c233aab2806bb7 Mon Sep 17 00:00:00 2001 From: Joe Gitta Date: Sun, 24 May 2026 03:14:39 +0000 Subject: [PATCH] feat: auto-increment version on deploy, show version in toolbar --- VERSION | 1 + browser.py | 18 ++++++++++++++++-- deploy.sh | 16 +++++++++++++++- 3 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 VERSION diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..0c62199 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.2.1 diff --git a/browser.py b/browser.py index 596d3a1..6784a7c 100755 --- a/browser.py +++ b/browser.py @@ -17,6 +17,10 @@ from PyQt5.QtWidgets import ( _HOME = pathlib.Path.home() HOME_URL = f"file://{_HOME}/kiosk-home/index.html" BOOKMARKS_FILE = str(_HOME / "kiosk-browser/bookmarks.json") +try: + _VERSION = (pathlib.Path(__file__).parent / "VERSION").read_text().strip() +except Exception: + _VERSION = "?" CDP_PORT = 9222 TOOLBAR_H = 72 # single row — was 142 (82 + 60) # Screen size is detected dynamically in main() after QApplication starts @@ -670,11 +674,21 @@ class KioskOverlay(QWidget): tl = QHBoxLayout(bar) tl.setContentsMargins(24, 7, 16, 7); tl.setSpacing(10) - # Brand label + # Brand label + version + brand_wrap = QWidget() + brand_wrap.setStyleSheet("background:transparent;") + brand_vbox = QVBoxLayout(brand_wrap) + brand_vbox.setContentsMargins(0, 0, 0, 0) + brand_vbox.setSpacing(0) brand = QLabel("SeniorNet") brand.setFont(QFont("Arial", 22, QFont.Bold)) brand.setStyleSheet("color:white;") - tl.addWidget(brand) + ver = QLabel(f"v{_VERSION}") + ver.setFont(QFont("Arial", 10)) + ver.setStyleSheet("color:#7aafd4;") + brand_vbox.addWidget(brand) + brand_vbox.addWidget(ver) + tl.addWidget(brand_wrap) tl.addStretch() # ◀ Back diff --git a/deploy.sh b/deploy.sh index 4e3518b..8ed69be 100755 --- a/deploy.sh +++ b/deploy.sh @@ -10,7 +10,21 @@ REPO_DIR="$(cd "$(dirname "$0")" && pwd)" HOME_SRC="$REPO_DIR/home-screen-index.html" HOME_DST="/home/jgitta/kiosk-home/index.html" CONFIG_SRC="$REPO_DIR/config.json" -COMMIT_MSG="${1:-deploy: update from kiosk-dev $(date +%Y-%m-%d)}" +# Auto-increment patch version (0.2.0 → 0.2.1 → 0.2.2 ...) +VERSION_FILE="$REPO_DIR/VERSION" +if [ -f "$VERSION_FILE" ]; then + CUR=$(cat "$VERSION_FILE" | tr -d '[:space:]') + MAJOR=$(echo "$CUR" | cut -d. -f1) + MINOR=$(echo "$CUR" | cut -d. -f2) + PATCH=$(echo "$CUR" | cut -d. -f3) + NEW_VERSION="$MAJOR.$MINOR.$((PATCH + 1))" + echo "$NEW_VERSION" > "$VERSION_FILE" + echo "==> Version: $CUR → $NEW_VERSION" +else + NEW_VERSION="unknown" +fi + +COMMIT_MSG="${1:-deploy: v$NEW_VERSION $(date +%Y-%m-%d)}" # Gitea credentials (from credentials.md) GITEA_TOKEN="4fe93c6c62490ef0bb4e4aeec58f47da26752ce8"