diff --git a/app/main.py b/app/main.py index 143193a..64e1486 100644 --- a/app/main.py +++ b/app/main.py @@ -12,7 +12,7 @@ from flask_socketio import SocketIO, emit from app.config import config, runtime_config from app.routes.views import views_bp from app.routes.api import api_bp -from app.version import VERSION_STRING +from app.version import VERSION_STRING, GIT_BRANCH from app.archiver.manager import schedule_daily_archiving from app.meshcore.cli import fetch_device_name_from_bridge @@ -44,10 +44,10 @@ def create_app(): app.config['DEBUG'] = config.FLASK_DEBUG app.config['SECRET_KEY'] = 'mc-webui-secret-key-change-in-production' - # Inject version into all templates + # Inject version and branch into all templates @app.context_processor def inject_version(): - return {'version': VERSION_STRING} + return {'version': VERSION_STRING, 'git_branch': GIT_BRANCH} # Register blueprints app.register_blueprint(views_bp) diff --git a/app/routes/api.py b/app/routes/api.py index 5b0e7f7..fb07835 100644 --- a/app/routes/api.py +++ b/app/routes/api.py @@ -1989,20 +1989,21 @@ def get_version(): { "success": true, "version": "2025.01.18+576c8ca9", - "docker_tag": "2025.01.18-576c8ca9" + "docker_tag": "2025.01.18-576c8ca9", + "branch": "dev" } """ - from app.version import VERSION_STRING, DOCKER_TAG + from app.version import VERSION_STRING, DOCKER_TAG, GIT_BRANCH return jsonify({ 'success': True, 'version': VERSION_STRING, - 'docker_tag': DOCKER_TAG + 'docker_tag': DOCKER_TAG, + 'branch': GIT_BRANCH }), 200 # GitHub repository for update checks GITHUB_REPO = "MarekWo/mc-webui" -GITHUB_BRANCH = "dev" # Check updates against dev branch @api_bp.route('/check-update', methods=['GET']) @@ -2011,9 +2012,10 @@ def check_update(): Check if a newer version is available on GitHub. Compares current commit hash with latest commit on GitHub. + Uses the branch from frozen version (dev/main) automatically. Query parameters: - branch (str): Branch to check (default: dev) + branch (str): Branch to check (default: from frozen version) Returns: JSON with update status: @@ -2022,16 +2024,18 @@ def check_update(): "update_available": true, "current_version": "2026.01.18+abc1234", "current_commit": "abc1234", + "current_branch": "dev", "latest_commit": "def5678", "latest_date": "2026.01.20", "latest_message": "feat: New feature", "github_url": "https://github.com/MarekWo/mc-webui/commits/dev" } """ - from app.version import VERSION_STRING + from app.version import VERSION_STRING, GIT_BRANCH try: - branch = request.args.get('branch', GITHUB_BRANCH) + # Use branch from frozen version, or allow override via query param + branch = request.args.get('branch', GIT_BRANCH) # Extract current commit hash from VERSION_STRING (format: YYYY.MM.DD+hash or YYYY.MM.DD+hash+dirty) current_commit = None @@ -2093,6 +2097,7 @@ def check_update(): 'update_available': update_available, 'current_version': VERSION_STRING, 'current_commit': current_commit[:7], + 'current_branch': branch, 'latest_commit': latest_commit, 'latest_date': latest_date, 'latest_message': latest_message, diff --git a/app/templates/base.html b/app/templates/base.html index 2713c4c..e88a066 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -61,6 +61,7 @@