Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Update Available warning #517

Merged
merged 3 commits into from
Nov 2, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion app/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,16 @@
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"
vacom13 marked this conversation as resolved.
Show resolved Hide resolved
update = bsoup(get(link_releases).text, "html.parser")
vacom13 marked this conversation as resolved.
Show resolved Hide resolved
newest_version = update.select_one('[class="Link--primary"]').string[1:]


def auth_required(f):
@wraps(f)
Expand Down Expand Up @@ -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'],
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion app/static/css/dark-theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
2 changes: 1 addition & 1 deletion app/static/css/light-theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,6 @@ path {
border-bottom: 0px;
}

.ip-text-div{
.ip-text-div, .update_available {
color: var(--whoogle-secondary-text) !important;
}
7 changes: 1 addition & 6 deletions app/templates/display.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,7 @@
{% endif %}
{{ response|safe }}
</body>
<footer>
<p class="footer">
Whoogle Search v{{ version_number }} ||
<a id="gh-link" href="https://github.com/benbusby/whoogle-search">{{ translation['github-link'] }}</a>
</p>
</footer>
{% include "footer.html" %}
<script src="{{ cb_url('autocomplete.js') }}"></script>
<script src="{{ cb_url('utils.js') }}"></script>
<script src="{{ cb_url('keyboard.js') }}"></script>
Expand Down
10 changes: 10 additions & 0 deletions app/templates/footer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta2/css/all.min.css" rel="stylesheet">
vacom13 marked this conversation as resolved.
Show resolved Hide resolved
<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 %}
vacom13 marked this conversation as resolved.
Show resolved Hide resolved
|| <span class="update_available">Update Available <i class="far fa-arrow-alt-circle-up"></i></span>
{% endif %}
</p>
</footer>
7 changes: 1 addition & 6 deletions app/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,6 @@
</div>
{% endif %}
</div>
<footer>
<p class="footer">
Whoogle Search v{{ version_number }} ||
<a id="gh-link" href="https://github.com/benbusby/whoogle-search">{{ translation['github-link'] }}</a>
</p>
</footer>
{% include "footer.html" %}
</body>
</html>