Update Available banner added. Implements #305
This commit is contained in:
parent
c2ced23073
commit
c7947492a0
|
@ -21,11 +21,16 @@ from app.utils.session import generate_user_key, valid_user_session
|
||||||
from bs4 import BeautifulSoup as bsoup
|
from bs4 import BeautifulSoup as bsoup
|
||||||
from flask import jsonify, make_response, request, redirect, render_template, \
|
from flask import jsonify, make_response, request, redirect, render_template, \
|
||||||
send_file, session, url_for
|
send_file, session, url_for
|
||||||
from requests import exceptions
|
from requests import exceptions, get
|
||||||
|
|
||||||
# Load DDG bang json files only on init
|
# Load DDG bang json files only on init
|
||||||
bang_json = json.load(open(app.config['BANG_FILE']))
|
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):
|
def auth_required(f):
|
||||||
@wraps(f)
|
@wraps(f)
|
||||||
|
@ -137,6 +142,7 @@ def index():
|
||||||
return render_template('error.html', error_message=error_message)
|
return render_template('error.html', error_message=error_message)
|
||||||
|
|
||||||
return render_template('index.html',
|
return render_template('index.html',
|
||||||
|
newest_version=newest_version,
|
||||||
languages=app.config['LANGUAGES'],
|
languages=app.config['LANGUAGES'],
|
||||||
countries=app.config['COUNTRIES'],
|
countries=app.config['COUNTRIES'],
|
||||||
themes=app.config['THEMES'],
|
themes=app.config['THEMES'],
|
||||||
|
@ -261,6 +267,7 @@ def search():
|
||||||
|
|
||||||
return render_template(
|
return render_template(
|
||||||
'display.html',
|
'display.html',
|
||||||
|
newest_version=newest_version,
|
||||||
query=urlparse.unquote(query),
|
query=urlparse.unquote(query),
|
||||||
search_type=search_util.search_type,
|
search_type=search_util.search_type,
|
||||||
config=g.user_config,
|
config=g.user_config,
|
||||||
|
|
|
@ -187,6 +187,6 @@ path {
|
||||||
color: var(--whoogle-dark-text) !important;
|
color: var(--whoogle-dark-text) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ip-text-div{
|
.ip-text-div, .update_available {
|
||||||
color: var(--whoogle-dark-secondary-text) !important;
|
color: var(--whoogle-dark-secondary-text) !important;
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,6 +175,6 @@ path {
|
||||||
border-bottom: 0px;
|
border-bottom: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ip-text-div{
|
.ip-text-div, .update_available {
|
||||||
color: var(--whoogle-secondary-text) !important;
|
color: var(--whoogle-secondary-text) !important;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,12 +33,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{{ response|safe }}
|
{{ response|safe }}
|
||||||
</body>
|
</body>
|
||||||
<footer>
|
{% include "footer.html" %}
|
||||||
<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>
|
|
||||||
<script src="{{ cb_url('autocomplete.js') }}"></script>
|
<script src="{{ cb_url('autocomplete.js') }}"></script>
|
||||||
<script src="{{ cb_url('utils.js') }}"></script>
|
<script src="{{ cb_url('utils.js') }}"></script>
|
||||||
<script src="{{ cb_url('keyboard.js') }}"></script>
|
<script src="{{ cb_url('keyboard.js') }}"></script>
|
||||||
|
|
10
app/templates/footer.html
Normal file
10
app/templates/footer.html
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<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>
|
||||||
|
{% endif %}
|
||||||
|
</p>
|
||||||
|
</footer>
|
|
@ -231,11 +231,6 @@
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<footer>
|
{% include "footer.html" %}
|
||||||
<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>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user