mirror of
https://github.com/aljazceru/CTFd.git
synced 2025-12-18 14:34:21 +01:00
Fixing view CTF after end and making it less confusing
This commit is contained in:
@@ -10,7 +10,11 @@ import logging
|
|||||||
def init_challenges(app):
|
def init_challenges(app):
|
||||||
@app.route('/challenges', methods=['GET'])
|
@app.route('/challenges', methods=['GET'])
|
||||||
def challenges():
|
def challenges():
|
||||||
if not is_admin() and not ctftime() and not view_after_ctf():
|
if not is_admin():
|
||||||
|
if not ctftime():
|
||||||
|
if view_after_ctf():
|
||||||
|
pass
|
||||||
|
else:
|
||||||
return redirect('/')
|
return redirect('/')
|
||||||
if can_view_challenges():
|
if can_view_challenges():
|
||||||
return render_template('chals.html', ctftime=ctftime())
|
return render_template('chals.html', ctftime=ctftime())
|
||||||
@@ -19,7 +23,11 @@ def init_challenges(app):
|
|||||||
|
|
||||||
@app.route('/chals', methods=['GET'])
|
@app.route('/chals', methods=['GET'])
|
||||||
def chals():
|
def chals():
|
||||||
if not is_admin() and not ctftime() and not view_after_ctf():
|
if not is_admin():
|
||||||
|
if not ctftime():
|
||||||
|
if view_after_ctf():
|
||||||
|
pass
|
||||||
|
else:
|
||||||
return redirect('/')
|
return redirect('/')
|
||||||
if can_view_challenges():
|
if can_view_challenges():
|
||||||
chals = Challenges.query.add_columns('id', 'name', 'value', 'description', 'category').order_by(Challenges.value).all()
|
chals = Challenges.query.add_columns('id', 'name', 'value', 'description', 'category').order_by(Challenges.value).all()
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ def admins_only(f):
|
|||||||
|
|
||||||
|
|
||||||
def view_after_ctf():
|
def view_after_ctf():
|
||||||
if get_config('view_after_ctf') == '1' and get_config("end") > time.time:
|
if get_config('view_after_ctf') == '1' and time.time() > int(get_config("end")):
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|||||||
Reference in New Issue
Block a user