Add SHOW_BLOCK_ALERT config option.
This commit is contained in:
parent
95d69ef302
commit
3d113a593c
11
app.py
11
app.py
|
@ -113,8 +113,9 @@ def init_profile():
|
||||||
def global_user():
|
def global_user():
|
||||||
g.user = wikidata_oauth.get_username()
|
g.user = wikidata_oauth.get_username()
|
||||||
|
|
||||||
@app.before_request
|
def check_for_blocks():
|
||||||
def get_blocks():
|
if hasattr(g, 'server_ip'): # already done
|
||||||
|
return
|
||||||
hostname = app.config.get('HOSTNAME')
|
hostname = app.config.get('HOSTNAME')
|
||||||
if not hostname:
|
if not hostname:
|
||||||
return
|
return
|
||||||
|
@ -127,6 +128,11 @@ def get_blocks():
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@app.before_request
|
||||||
|
def get_blocks():
|
||||||
|
if app.config.get('SHOW_BLOCK_ALERT') is not False:
|
||||||
|
check_for_blocks()
|
||||||
|
|
||||||
@app.route('/find_more_setting')
|
@app.route('/find_more_setting')
|
||||||
def flip_find_more():
|
def flip_find_more():
|
||||||
session['no_find_more'] = not session.get('no_find_more')
|
session['no_find_more'] = not session.get('no_find_more')
|
||||||
|
@ -1075,6 +1081,7 @@ def wikidata_query_list():
|
||||||
|
|
||||||
@app.route('/report/blocks')
|
@app.route('/report/blocks')
|
||||||
def server_block_report():
|
def server_block_report():
|
||||||
|
check_for_blocks()
|
||||||
return render_template('block_report.html')
|
return render_template('block_report.html')
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -17,10 +17,12 @@
|
||||||
<body>
|
<body>
|
||||||
{% block nav %}{{ navbar() }}{% endblock %}
|
{% block nav %}{{ navbar() }}{% endblock %}
|
||||||
|
|
||||||
|
{% if config.SHOW_BLOCK_ALERT %}
|
||||||
<div class="p-2">
|
<div class="p-2">
|
||||||
{{ local_block_alert() }}
|
{{ local_block_alert() }}
|
||||||
{{ global_block_alert() }}
|
{{ global_block_alert() }}
|
||||||
</div>
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% block content %}{% endblock %}
|
{% block content %}{% endblock %}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue