diff --git a/CTFd/admin/challenges.py b/CTFd/admin/challenges.py index 70abe1e1..2f610c5c 100644 --- a/CTFd/admin/challenges.py +++ b/CTFd/admin/challenges.py @@ -106,7 +106,9 @@ def challenges_preview(challenge_id): attempts=0, 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") diff --git a/CTFd/themes/admin/templates/challenges/preview.html b/CTFd/themes/admin/templates/challenges/preview.html index 9d9607eb..d6db4baf 100644 --- a/CTFd/themes/admin/templates/challenges/preview.html +++ b/CTFd/themes/admin/templates/challenges/preview.html @@ -1,6 +1,9 @@ {% extends "page.html" %} {% block scripts %} + {% if "beta" in Configs.ctf_theme %} {{ Assets.js("assets/js/challenges.js") }} {% else %} @@ -127,7 +130,7 @@ CTFd._internal.challenge = {}; $.get( - CTFd.config.urlRoot + "/api/v1/challenges/1", + CTFd.config.urlRoot + "/api/v1/challenges/" + window.CHALLENGE_ID, function (response) { // Preview should not show any solves var challenge_data = response.data;