Files
CTFd/CTFd/plugins/dynamic_challenges/assets/view.js
Kevin Chung f3e43d97a6 Null out some functions in view.js (#2105)
* Remove some unused functions from the default provided standard & dynamic challenge `view.js` files
2022-04-30 22:05:16 -04:00

38 lines
960 B
JavaScript

CTFd._internal.challenge.data = undefined;
// TODO: Remove in CTFd v4.0
CTFd._internal.challenge.renderer = null;
CTFd._internal.challenge.preRender = function() {};
// TODO: Remove in CTFd v4.0
CTFd._internal.challenge.render = null;
CTFd._internal.challenge.postRender = function() {};
CTFd._internal.challenge.submit = function(preview) {
var challenge_id = parseInt(CTFd.lib.$("#challenge-id").val());
var submission = CTFd.lib.$("#challenge-input").val();
var body = {
challenge_id: challenge_id,
submission: submission
};
var params = {};
if (preview) {
params["preview"] = true;
}
return CTFd.api.post_challenge_attempt(params, body).then(function(response) {
if (response.status === 429) {
// User was ratelimited but process response
return response;
}
if (response.status === 403) {
// User is not logged in or CTF is paused.
return response;
}
return response;
});
};