From bb31c36b82297fb3eb1ed872dde4124d4b6b287e Mon Sep 17 00:00:00 2001 From: psyray <1230954+psyray@users.noreply.github.com> Date: Wed, 24 Jul 2024 22:19:55 +0200 Subject: [PATCH] feat(version): Rework the version number bump --- .gitignore | 1 + docker-compose.dev.yml | 3 --- web/api/views.py | 8 +++----- web/dashboard/templates/dashboard/index.html | 8 ++++---- web/reNgine/context_processors.py | 4 ++++ web/reNgine/settings.py | 7 ++++++- web/reNgine/version.txt | 1 + web/templates/base/_items/top_bar.html | 8 ++++---- web/templates/base/login.html | 2 +- 9 files changed, 24 insertions(+), 18 deletions(-) create mode 100644 web/reNgine/version.txt diff --git a/.gitignore b/.gitignore index c3b0c643b..7c872ac31 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ web/custom_engines* Pipfile* resume.cfg *.txt +!version.txt *.log *.pot *.pyc diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 3b5bdbff4..53554e052 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -121,9 +121,6 @@ services: - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} - POSTGRES_PORT=${POSTGRES_PORT} - POSTGRES_HOST=${POSTGRES_HOST} - # THIS IS A MUST FOR CHECKING UPDATE, EVERYTIME A COMMIT IS MERGED INTO - # MASTER, UPDATE THIS!!! MAJOR.MINOR.PATCH https://semver.org/ - - RENGINE_CURRENT_VERSION='2.0.6' volumes: - ./web:/usr/src/app - github_repos:/usr/src/github diff --git a/web/api/views.py b/web/api/views.py index 90b3facbc..4737612cb 100644 --- a/web/api/views.py +++ b/web/api/views.py @@ -20,6 +20,7 @@ from reNgine.celery import app from reNgine.common_func import * from reNgine.definitions import ABORTED_TASK +from reNgine.settings import RENGINE_CURRENT_VERSION from reNgine.tasks import * from reNgine.gpt import GPTAttackSuggestionGenerator from reNgine.utilities import is_safe_path @@ -799,11 +800,8 @@ def get(self, request): # get current version_number # remove quotes from current_version - current_version = ((os.environ['RENGINE_CURRENT_VERSION' - ])[1:] if os.environ['RENGINE_CURRENT_VERSION' - ][0] == 'v' - else os.environ['RENGINE_CURRENT_VERSION']).replace("'", "") - + current_version = (RENGINE_CURRENT_VERSION[1:] if RENGINE_CURRENT_VERSION[0] == 'v' else RENGINE_CURRENT_VERSION).replace("'", "") + # for consistency remove v from both if exists latest_version = re.search(r'v(\d+\.)?(\d+\.)?(\*|\d+)', ((response[0]['name' diff --git a/web/dashboard/templates/dashboard/index.html b/web/dashboard/templates/dashboard/index.html index 3f5f8356d..d4ead887f 100644 --- a/web/dashboard/templates/dashboard/index.html +++ b/web/dashboard/templates/dashboard/index.html @@ -17,7 +17,7 @@ {% endblock custom_js_css_link %} {% block breadcrumb_title %} -reNgine 2.0.6 +reNgine-ng {{ RENGINE_CURRENT_VERSION }} {% endblock breadcrumb_title %} {% block main_content %} @@ -39,7 +39,7 @@
Current release: v2.0.6
+Current release: v{{ RENGINE_CURRENT_VERSION }}