From c7947492a0e2eb083ba60e06e935c83fac579cd4 Mon Sep 17 00:00:00 2001 From: Vansh Comar Date: Mon, 1 Nov 2021 10:23:50 +0530 Subject: [PATCH] Update Available banner added. Implements #305 --- app/routes.py | 9 ++++++++- app/static/css/dark-theme.css | 2 +- app/static/css/light-theme.css | 2 +- app/templates/display.html | 7 +------ app/templates/footer.html | 10 ++++++++++ app/templates/index.html | 7 +------ 6 files changed, 22 insertions(+), 15 deletions(-) create mode 100644 app/templates/footer.html diff --git a/app/routes.py b/app/routes.py index b6e6f45..35b40a3 100644 --- a/app/routes.py +++ b/app/routes.py @@ -21,11 +21,16 @@ from app.utils.session import generate_user_key, valid_user_session from bs4 import BeautifulSoup as bsoup from flask import jsonify, make_response, request, redirect, render_template, \ send_file, session, url_for -from requests import exceptions +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") +newest_version = update.select_one('[class="Link--primary"]').string[1:] + def auth_required(f): @wraps(f) @@ -137,6 +142,7 @@ def index(): return render_template('error.html', error_message=error_message) return render_template('index.html', + newest_version=newest_version, languages=app.config['LANGUAGES'], countries=app.config['COUNTRIES'], themes=app.config['THEMES'], @@ -261,6 +267,7 @@ def search(): return render_template( 'display.html', + newest_version=newest_version, query=urlparse.unquote(query), search_type=search_util.search_type, config=g.user_config, diff --git a/app/static/css/dark-theme.css b/app/static/css/dark-theme.css index 2d17c00..68b7cad 100644 --- a/app/static/css/dark-theme.css +++ b/app/static/css/dark-theme.css @@ -187,6 +187,6 @@ path { color: var(--whoogle-dark-text) !important; } -.ip-text-div{ +.ip-text-div, .update_available { color: var(--whoogle-dark-secondary-text) !important; } diff --git a/app/static/css/light-theme.css b/app/static/css/light-theme.css index fbe3ad6..de37157 100644 --- a/app/static/css/light-theme.css +++ b/app/static/css/light-theme.css @@ -175,6 +175,6 @@ path { border-bottom: 0px; } -.ip-text-div{ +.ip-text-div, .update_available { color: var(--whoogle-secondary-text) !important; } diff --git a/app/templates/display.html b/app/templates/display.html index 4f2c109..7f57715 100644 --- a/app/templates/display.html +++ b/app/templates/display.html @@ -33,12 +33,7 @@ {% endif %} {{ response|safe }} - +{% include "footer.html" %} diff --git a/app/templates/footer.html b/app/templates/footer.html new file mode 100644 index 0000000..06364a9 --- /dev/null +++ b/app/templates/footer.html @@ -0,0 +1,10 @@ + + \ No newline at end of file diff --git a/app/templates/index.html b/app/templates/index.html index 05099a2..9fa9948 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -231,11 +231,6 @@ {% endif %} - +{% include "footer.html" %}