This commit is contained in:
2026-09-11 14:11:37 +03:00
parent 3079c4edc2
commit 7eb0472bb6
7 changed files with 51 additions and 2 deletions

View File

@@ -16,6 +16,8 @@ Env:
OUTPUT_DIR — локален/mounted път към секциите (default: share)
HOME_IMAGE — път към home картинка
GIT_SHA / SOURCE_COMMIT / COMMIT_SHA — git SHA (Coolify / Docker build-arg)
Версия: префиксът е файлът VERSION в корена на репото (същият като show-version.bat).
"""
from __future__ import annotations
@@ -58,7 +60,6 @@ HOME_IMAGE = os.getenv("HOME_IMAGE") # absolute path or None
_IMG_PLACEHOLDER_RE = re.compile(r"\[IMG:\s*([^\]]+?)\s*\]")
BASE_DIR = Path(__file__).parent
APP_VERSION = "0.3.0"
_NO_CACHE = {"Cache-Control": "no-store, no-cache, max-age=0"}
@@ -69,6 +70,22 @@ def _short_id(value: str, n: int = 7) -> str:
return value[:n] if len(value) > n else value
def _resolve_app_version() -> str:
"""Prefix from repo-root VERSION (same file as show-version.bat)."""
for candidate in (BASE_DIR.parent / "VERSION", Path("/app/VERSION")):
try:
if candidate.is_file():
text = candidate.read_text(encoding="utf-8").strip().splitlines()[0].strip()
if text:
return text
except OSError:
pass
return "0.3.0"
APP_VERSION = _resolve_app_version()
def _resolve_git() -> str:
"""Git SHA / build id that changes on each image rebuild.