diff --git a/CTFd/admin/challenges.py b/CTFd/admin/challenges.py index cef1360f..70abe1e1 100644 --- a/CTFd/admin/challenges.py +++ b/CTFd/admin/challenges.py @@ -3,7 +3,10 @@ from flask import abort, render_template, request, url_for from CTFd.admin import admin from CTFd.models import Challenges, Flags, Solves from CTFd.plugins.challenges import CHALLENGE_CLASSES, get_chal_class +from CTFd.schemas.tags import TagSchema from CTFd.utils.decorators import admins_only +from CTFd.utils.security.signing import serialize +from CTFd.utils.user import get_current_team, get_current_user @admin.route("/admin/challenges") @@ -71,13 +74,6 @@ def challenges_detail(challenge_id): ) -from CTFd.utils.security.signing import serialize -from CTFd.utils.user import ( - get_current_team, - get_current_user, -) -from CTFd.schemas.tags import TagSchema - @admin.route("/admin/challenges/preview/") @admins_only def challenges_preview(challenge_id): @@ -93,9 +89,7 @@ def challenges_preview(challenge_id): "team_id": team.id if team else None, "file_id": f.id, } - files.append( - url_for("views.files", path=f.location, token=serialize(token)) - ) + files.append(url_for("views.files", path=f.location, token=serialize(token))) tags = [ tag["value"] for tag in TagSchema("user", many=True).dump(challenge.tags).data diff --git a/CTFd/themes/admin/assets/js/pages/challenge.js b/CTFd/themes/admin/assets/js/pages/challenge.js index e88130d9..ac95cf9b 100644 --- a/CTFd/themes/admin/assets/js/pages/challenge.js +++ b/CTFd/themes/admin/assets/js/pages/challenge.js @@ -17,7 +17,6 @@ import ChallengeFilesList from "../components/files/ChallengeFilesList.vue"; import HintsList from "../components/hints/HintsList.vue"; import NextChallenge from "../components/next/NextChallenge.vue"; - function loadChalTemplate(challenge) { CTFd._internal.challenge = {}; $.getScript(CTFd.config.urlRoot + challenge.scripts.view, function() { @@ -140,8 +139,12 @@ function handleChallengeOptions(event) { $(() => { $(".preview-challenge").click(function(_e) { - let url = `${CTFd.config.urlRoot}/admin/challenges/preview/${window.CHALLENGE_ID}`; - $("#challenge-window").html(``); + let url = `${CTFd.config.urlRoot}/admin/challenges/preview/${ + window.CHALLENGE_ID + }`; + $("#challenge-window").html( + `` + ); $("#challenge-modal").modal(); });