Fix hardcoded value

This commit is contained in:
Kevin Chung
2023-06-27 04:38:24 -04:00
parent e2b8c2de07
commit 6c97610ea4
2 changed files with 7 additions and 2 deletions

View File

@@ -106,7 +106,9 @@ def challenges_preview(challenge_id):
attempts=0, attempts=0,
challenge=challenge, challenge=challenge,
) )
return render_template("admin/challenges/preview.html", content=content) return render_template(
"admin/challenges/preview.html", content=content, challenge=challenge
)
@admin.route("/admin/challenges/new") @admin.route("/admin/challenges/new")

View File

@@ -1,6 +1,9 @@
{% extends "page.html" %} {% extends "page.html" %}
{% block scripts %} {% block scripts %}
<script>
var CHALLENGE_ID = {{ challenge.id }};
</script>
{% if "beta" in Configs.ctf_theme %} {% if "beta" in Configs.ctf_theme %}
{{ Assets.js("assets/js/challenges.js") }} {{ Assets.js("assets/js/challenges.js") }}
{% else %} {% else %}
@@ -127,7 +130,7 @@
CTFd._internal.challenge = {}; CTFd._internal.challenge = {};
$.get( $.get(
CTFd.config.urlRoot + "/api/v1/challenges/1", CTFd.config.urlRoot + "/api/v1/challenges/" + window.CHALLENGE_ID,
function (response) { function (response) {
// Preview should not show any solves // Preview should not show any solves
var challenge_data = response.data; var challenge_data = response.data;