Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/pwncore/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"insufficient_coins": 22,
"user_or_email_exists": 23,
"users_not_found": 24,
"no_hints_available": 25,
}

admin_hash_value = os.environ.get("PWNCORE_ADMIN_HASH", bcrypt_sha256.hash("pwncore"))
Expand Down
5 changes: 5 additions & 0 deletions src/pwncore/routes/ctf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,11 @@ async def hint_get(ctf_id: int, response: Response, jwt: RequireJwt):
hint = await Hint.get(problem_id=ctf_id, order=viewed_hints.order + 1)

else:
# If there are no hints for this particular CTF, return no hints available
if not await Hint.exists(problem_id=ctf_id, order=0):
response.status_code = 403
return {"msg_code": config.msg_codes["no_hints_available"]}

hint = await Hint.get(problem_id=ctf_id, order=0)

with_points = team.coins < config.hint_penalty
Expand Down