mirror of
https://github.com/aljazceru/CTFd.git
synced 2025-12-17 14:04:20 +01:00
Marking 1.0.0 (#196)
* Use <int:xxx> in routes to prevent some errors 500 (#192) * Use first_or_404() to prevent some errors 500 (#193) * Add a populating script for awards. (#191) * Creating upload_file util * Marking 1.0.0 in __init__ and starting database migrations * Upgrading some more HTML * Adding CHANGELOG.md
This commit is contained in:
@@ -79,7 +79,7 @@ def solves_per_chal():
|
||||
|
||||
|
||||
@challenges.route('/solves')
|
||||
@challenges.route('/solves/<teamid>')
|
||||
@challenges.route('/solves/<int:teamid>')
|
||||
def solves(teamid=None):
|
||||
solves = None
|
||||
awards = None
|
||||
@@ -131,7 +131,7 @@ def attempts():
|
||||
return jsonify(json)
|
||||
|
||||
|
||||
@challenges.route('/fails/<teamid>', methods=['GET'])
|
||||
@challenges.route('/fails/<int:teamid>', methods=['GET'])
|
||||
def fails(teamid):
|
||||
fails = WrongKeys.query.filter_by(teamid=teamid).count()
|
||||
solves = Solves.query.filter_by(teamid=teamid).count()
|
||||
@@ -140,7 +140,7 @@ def fails(teamid):
|
||||
return jsonify(json)
|
||||
|
||||
|
||||
@challenges.route('/chal/<chalid>/solves', methods=['GET'])
|
||||
@challenges.route('/chal/<int:chalid>/solves', methods=['GET'])
|
||||
def who_solved(chalid):
|
||||
if not user_can_view_challenges():
|
||||
return redirect(url_for('auth.login', next=request.path))
|
||||
@@ -151,7 +151,7 @@ def who_solved(chalid):
|
||||
return jsonify(json)
|
||||
|
||||
|
||||
@challenges.route('/chal/<chalid>', methods=['POST'])
|
||||
@challenges.route('/chal/<int:chalid>', methods=['POST'])
|
||||
def chal(chalid):
|
||||
if ctf_ended() and not view_after_ctf():
|
||||
return redirect(url_for('challenges.challenges_view'))
|
||||
@@ -178,7 +178,7 @@ def chal(chalid):
|
||||
|
||||
# Challange not solved yet
|
||||
if not solves:
|
||||
chal = Challenges.query.filter_by(id=chalid).first()
|
||||
chal = Challenges.query.filter_by(id=chalid).first_or_404()
|
||||
key = unicode(request.form['key'].strip().lower())
|
||||
keys = json.loads(chal.flags)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user