Implemented the requested changes

This commit is contained in:
Vansh Comar 2021-11-02 18:33:04 +05:30
parent c7947492a0
commit 3a2b279e33
5 changed files with 12 additions and 8 deletions

View File

@ -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

View File

@ -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):

View File

@ -33,7 +33,7 @@
{% endif %}
{{ response|safe }}
</body>
{% include "footer.html" %}
{% include 'footer.html' %}
<script src="{{ cb_url('autocomplete.js') }}"></script>
<script src="{{ cb_url('utils.js') }}"></script>
<script src="{{ cb_url('keyboard.js') }}"></script>

View File

@ -1,10 +1,9 @@
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta2/css/all.min.css" rel="stylesheet">
<footer>
<p class="footer">
Whoogle Search v{{ version_number }} ||
<a id="gh-link" href="https://github.com/benbusby/whoogle-search">{{ translation['github-link'] }}</a>
{% if newest_version != version_number %}
|| <span class="update_available">Update Available <i class="far fa-arrow-alt-circle-up"></i></span>
{% if newest_version %}
|| <span class="update_available">Update Available 🟢</span>
{% endif %}
</p>
</footer>

View File

@ -231,6 +231,6 @@
</div>
{% endif %}
</div>
{% include "footer.html" %}
{% include 'footer.html' %}
</body>
</html>