From 3a2b279e33deea22777aae3c297008a3eb77e596 Mon Sep 17 00:00:00 2001 From: Vansh Comar Date: Tue, 2 Nov 2021 18:33:04 +0530 Subject: [PATCH] Implemented the requested changes --- app/__init__.py | 1 + app/routes.py | 10 +++++++--- app/templates/display.html | 2 +- app/templates/footer.html | 5 ++--- app/templates/index.html | 2 +- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/app/__init__.py b/app/__init__.py index b6bce99..1977c7b 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -59,6 +59,7 @@ app.config['BANG_PATH'] = os.getenv( app.config['BANG_FILE'] = os.path.join( app.config['BANG_PATH'], 'bangs.json') +app.config['RELEASES_URL'] = 'https://github.com/benbusby/whoogle-search/releases' # The alternative to Google Translate is treated a bit differently than other # social media site alternatives, in that it is used for any translation diff --git a/app/routes.py b/app/routes.py index 35b40a3..4b8a777 100644 --- a/app/routes.py +++ b/app/routes.py @@ -26,10 +26,14 @@ from requests import exceptions, get # Load DDG bang json files only on init bang_json = json.load(open(app.config['BANG_FILE'])) -# Get the newest version of WHOOGLE -link_releases = "https://github.com/benbusby/whoogle-search/releases" -update = bsoup(get(link_releases).text, "html.parser") + +# Check the newest version of WHOOGLE +update = bsoup(get(app.config['RELEASES_URL']).text, 'html.parser') newest_version = update.select_one('[class="Link--primary"]').string[1:] +current_version = int(''.join(filter(str.isdigit, app.config['VERSION_NUMBER']))) +newest_version = int(''.join(filter(str.isdigit, newest_version))) +newest_version = newest_version if (current_version + < newest_version) else '' def auth_required(f): diff --git a/app/templates/display.html b/app/templates/display.html index 7f57715..df896b3 100644 --- a/app/templates/display.html +++ b/app/templates/display.html @@ -33,7 +33,7 @@ {% endif %} {{ response|safe }} -{% include "footer.html" %} +{% include 'footer.html' %} diff --git a/app/templates/footer.html b/app/templates/footer.html index 06364a9..f018318 100644 --- a/app/templates/footer.html +++ b/app/templates/footer.html @@ -1,10 +1,9 @@ - \ No newline at end of file diff --git a/app/templates/index.html b/app/templates/index.html index 9fa9948..d81865c 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -231,6 +231,6 @@ {% endif %} -{% include "footer.html" %} +{% include 'footer.html' %}