Fix data version extraction
Deploy HEOS panel / deploy (push) Successful in 28s

This commit is contained in:
franzz committed 2026-09-22 15:53:47 +02:00
1 parent 0c8672789d
commit c153b52641
4 files changed
+20 -2

No files matched your search

+6
View File
@@ -80,6 +80,12 @@ jobs:
- name: Run tests - name: Run tests
run: .venv-ci/bin/python -m unittest discover -s tests -t . --verbose run: .venv-ci/bin/python -m unittest discover -s tests -t . --verbose
# DEPLOY_PATH has no .git (see below), so this is the only chance to
# ask git for the commit. config.py's APP_VERSION reads it back, to
# tell a resumed iOS home-screen session its UI is stale.
- name: Stamp the deployed version
run: git rev-parse --short HEAD > VERSION
# .venv, .env and config.json are excluded, so the # .venv, .env and config.json are excluded, so the
# runtime, the stereo pair's learned membership, Spotify's # runtime, the stereo pair's learned membership, Spotify's
# credentials, and your rooms/ports survive --delete untouched. # credentials, and your rooms/ports survive --delete untouched.
+3
View File
@@ -10,3 +10,6 @@ venv/
# Your own rooms/speakers/ports -- copy config.json.example to config.json # Your own rooms/speakers/ports -- copy config.json.example to config.json
config.json config.json
# Stamped by the Gitea deploy at checkout time -- see config.py's APP_VERSION
VERSION
+2
View File
@@ -60,6 +60,8 @@ pip install -r requirements.txt
python3 app.py python3 app.py
``` ```
Needs `git` on PATH and the clone's `.git` left in place — with no `VERSION` file, that's what the panel falls back to at startup for the same stale-UI check.
### Add a reverse proxy (optional) ### Add a reverse proxy (optional)
It serves the panel at `/heos` and refuses everything else on that host; the file ends with the two-line change that puts it at the root instead. It serves the panel at `/heos` and refuses everything else on that host; the file ends with the two-line change that puts it at the root instead.
+9 -2
View File
@@ -109,9 +109,16 @@ APP_NAME = "Heos"
# The deployed commit, so the UI can tell when the Pi has moved on to a # The deployed commit, so the UI can tell when the Pi has moved on to a
# newer version and reload itself -- iOS otherwise resumes a suspended # newer version and reload itself -- iOS otherwise resumes a suspended
# home-screen session without ever checking back with the server. Empty # home-screen session without ever checking back with the server. The
# when git isn't available; app.js treats that as "nothing to compare". # Gitea deploy stamps VERSION at checkout time and ships it (the deployed
# tree otherwise has no .git -- see .gitea/workflows/deploy.yml); a manual
# git-clone install has no VERSION file, so it falls back to asking git
# directly. Empty when neither is available; app.js treats that as
# "nothing to compare".
def _app_version() -> str: def _app_version() -> str:
version_file = Path(__file__).resolve().parent / "VERSION"
if version_file.exists():
return version_file.read_text().strip()
try: try:
result = subprocess.run( result = subprocess.run(
["git", "rev-parse", "--short", "HEAD"], ["git", "rev-parse", "--short", "HEAD"],