diff --git a/CTFd/themes/admin/assets/js/pages/challenges.js b/CTFd/themes/admin/assets/js/pages/challenges.js index e69de29..cada9cb 100644 --- a/CTFd/themes/admin/assets/js/pages/challenges.js +++ b/CTFd/themes/admin/assets/js/pages/challenges.js @@ -0,0 +1,34 @@ +import "./main"; +import CTFd from "core/CTFd"; +import $ from "jquery"; +import { ezQuery } from "core/ezq"; + +function deleteSelectedChallenges(event){ + let challengeIDs = $("input[data-challenge-id]:checked").map(function() { + return $(this).data("challenge-id"); + }); + let target = challengeIDs.length === 1 ? "challenge" : "challenges"; + + ezQuery({ + title: "Delete Challenges", + body: `Are you sure you want to delete ${challengeIDs.length} ${target}?`, + success: function() { + const reqs = []; + for (var chalID of challengeIDs) { + reqs.push( + CTFd.fetch(`/api/v1/challenges/${chalID}`, { + method: "DELETE" + }) + ); + } + Promise.all(reqs).then(responses => { + window.location.reload(); + }); + } + }); +} + +$(() => { + $("#challenges-delete-button").click(deleteSelectedChallenges); +}); + diff --git a/CTFd/themes/admin/assets/js/pages/pages.js b/CTFd/themes/admin/assets/js/pages/pages.js index de5f81c..7cf3d11 100644 --- a/CTFd/themes/admin/assets/js/pages/pages.js +++ b/CTFd/themes/admin/assets/js/pages/pages.js @@ -1,37 +1,35 @@ import "./main"; import CTFd from "core/CTFd"; import $ from "jquery"; -import { htmlEntities } from "core/utils"; import { ezQuery } from "core/ezq"; -function deletePage(event) { - const elem = $(this); - const name = elem.attr("page-route"); - const page_id = elem.attr("page-id"); + +function deleteSelectedUsers(event) { + let pageIDs = $("input[data-page-id]:checked").map(function() { + return $(this).data("page-id"); + }); + let target = pageIDs.length === 1 ? "page" : "pages"; + ezQuery({ - title: "Delete " + htmlEntities(name), - body: "Are you sure you want to delete {0}?".format( - "" + htmlEntities(name) + "" - ), + title: "Delete Pages", + body: `Are you sure you want to delete ${pageIDs.length} ${target}?`, success: function() { - CTFd.fetch("/api/v1/pages/" + page_id, { - method: "DELETE" - }) - .then(function(response) { - return response.json(); - }) - .then(function(response) { - if (response.success) { - elem - .parent() - .parent() - .remove(); - } - }); + const reqs = []; + for (var pageID of pageIDs) { + reqs.push( + CTFd.fetch(`/api/v1/pages/${pageID}`, { + method: "DELETE" + }) + ); + } + Promise.all(reqs).then(responses => { + window.location.reload(); + }); } }); } + $(() => { - $(".delete-page").click(deletePage); + $("#pages-delete-button").click(deleteSelectedUsers); }); diff --git a/CTFd/themes/admin/assets/js/pages/teams.js b/CTFd/themes/admin/assets/js/pages/teams.js index e69de29..10c123b 100644 --- a/CTFd/themes/admin/assets/js/pages/teams.js +++ b/CTFd/themes/admin/assets/js/pages/teams.js @@ -0,0 +1,34 @@ +import "./main"; +import CTFd from "core/CTFd"; +import $ from "jquery"; +import { ezQuery } from "core/ezq"; + + +function deleteSelectedTeams(event) { + let teamIDs = $("input[data-team-id]:checked").map(function() { + return $(this).data("team-id"); + }); + let target = teamIDs.length === 1 ? "team" : "teams"; + + ezQuery({ + title: "Delete Teams", + body: `Are you sure you want to delete ${teamIDs.length} ${target}?`, + success: function() { + const reqs = []; + for (var teamID of teamIDs) { + reqs.push( + CTFd.fetch(`/api/v1/teams/${teamID}`, { + method: "DELETE" + }) + ); + } + Promise.all(reqs).then(responses => { + window.location.reload(); + }); + } + }); +} + +$(() => { + $("#teams-delete-button").click(deleteSelectedTeams); +}); \ No newline at end of file diff --git a/CTFd/themes/admin/assets/js/pages/users.js b/CTFd/themes/admin/assets/js/pages/users.js index 09198c2..90233ee 100644 --- a/CTFd/themes/admin/assets/js/pages/users.js +++ b/CTFd/themes/admin/assets/js/pages/users.js @@ -1 +1,33 @@ import "./main"; +import CTFd from "core/CTFd"; +import $ from "jquery"; +import { ezQuery } from "core/ezq"; + +function deleteSelectedUsers(event) { + let userIDs = $("input[data-user-id]:checked").map(function() { + return $(this).data("user-id"); + }); + let target = userIDs.length === 1 ? "user" : "users"; + + ezQuery({ + title: "Delete Users", + body: `Are you sure you want to delete ${userIDs.length} ${target}?`, + success: function() { + const reqs = []; + for (var userID of userIDs) { + reqs.push( + CTFd.fetch(`/api/v1/users/${userID}`, { + method: "DELETE" + }) + ); + } + Promise.all(reqs).then(responses => { + window.location.reload(); + }); + } + }); +} + +$(() => { + $("#users-delete-button").click(deleteSelectedUsers); +}); diff --git a/CTFd/themes/admin/static/js/core.dev.js b/CTFd/themes/admin/static/js/core.dev.js index a58bd97..371db0c 100644 --- a/CTFd/themes/admin/static/js/core.dev.js +++ b/CTFd/themes/admin/static/js/core.dev.js @@ -1,4 +1,4 @@ -(window["webpackJsonp"] = window["webpackJsonp"] || []).push([["default~pages/challenge~pages/configs~pages/editor~pages/main~pages/notifications~pages/pages~pages/~0fc9fcae"],{ +(window["webpackJsonp"] = window["webpackJsonp"] || []).push([["default~pages/challenge~pages/challenges~pages/configs~pages/editor~pages/main~pages/notifications~p~d5a3cc0a"],{ /***/ "./CTFd/themes/admin/assets/js/pages/main.js": /*!***************************************************!*\ diff --git a/CTFd/themes/admin/static/js/pages/challenge.dev.js b/CTFd/themes/admin/static/js/pages/challenge.dev.js index d84a106..9c5a418 100644 --- a/CTFd/themes/admin/static/js/pages/challenge.dev.js +++ b/CTFd/themes/admin/static/js/pages/challenge.dev.js @@ -147,7 +147,7 @@ /******/ /******/ /******/ // add entry module to deferred list -/******/ deferredModules.push(["./CTFd/themes/admin/assets/js/pages/challenge.js","helpers","vendor","default~pages/challenge~pages/configs~pages/editor~pages/main~pages/notifications~pages/pages~pages/~0fc9fcae"]); +/******/ deferredModules.push(["./CTFd/themes/admin/assets/js/pages/challenge.js","helpers","vendor","default~pages/challenge~pages/challenges~pages/configs~pages/editor~pages/main~pages/notifications~p~d5a3cc0a"]); /******/ // run deferred modules when ready /******/ return checkDeferredModules(); /******/ }) diff --git a/CTFd/themes/admin/static/js/pages/challenges.dev.js b/CTFd/themes/admin/static/js/pages/challenges.dev.js new file mode 100644 index 0000000..5c77e4d --- /dev/null +++ b/CTFd/themes/admin/static/js/pages/challenges.dev.js @@ -0,0 +1,169 @@ +/******/ (function(modules) { // webpackBootstrap +/******/ // install a JSONP callback for chunk loading +/******/ function webpackJsonpCallback(data) { +/******/ var chunkIds = data[0]; +/******/ var moreModules = data[1]; +/******/ var executeModules = data[2]; +/******/ +/******/ // add "moreModules" to the modules object, +/******/ // then flag all "chunkIds" as loaded and fire callback +/******/ var moduleId, chunkId, i = 0, resolves = []; +/******/ for(;i < chunkIds.length; i++) { +/******/ chunkId = chunkIds[i]; +/******/ if(installedChunks[chunkId]) { +/******/ resolves.push(installedChunks[chunkId][0]); +/******/ } +/******/ installedChunks[chunkId] = 0; +/******/ } +/******/ for(moduleId in moreModules) { +/******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) { +/******/ modules[moduleId] = moreModules[moduleId]; +/******/ } +/******/ } +/******/ if(parentJsonpFunction) parentJsonpFunction(data); +/******/ +/******/ while(resolves.length) { +/******/ resolves.shift()(); +/******/ } +/******/ +/******/ // add entry modules from loaded chunk to deferred list +/******/ deferredModules.push.apply(deferredModules, executeModules || []); +/******/ +/******/ // run deferred modules when all chunks ready +/******/ return checkDeferredModules(); +/******/ }; +/******/ function checkDeferredModules() { +/******/ var result; +/******/ for(var i = 0; i < deferredModules.length; i++) { +/******/ var deferredModule = deferredModules[i]; +/******/ var fulfilled = true; +/******/ for(var j = 1; j < deferredModule.length; j++) { +/******/ var depId = deferredModule[j]; +/******/ if(installedChunks[depId] !== 0) fulfilled = false; +/******/ } +/******/ if(fulfilled) { +/******/ deferredModules.splice(i--, 1); +/******/ result = __webpack_require__(__webpack_require__.s = deferredModule[0]); +/******/ } +/******/ } +/******/ return result; +/******/ } +/******/ +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // object to store loaded and loading chunks +/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched +/******/ // Promise = chunk loading, 0 = chunk loaded +/******/ var installedChunks = { +/******/ "pages/challenges": 0 +/******/ }; +/******/ +/******/ var deferredModules = []; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); +/******/ } +/******/ }; +/******/ +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ +/******/ // create a fake namespace object +/******/ // mode & 1: value is a module id, require it +/******/ // mode & 2: merge all properties of value into the ns +/******/ // mode & 4: return value when already ns object +/******/ // mode & 8|1: behave like require +/******/ __webpack_require__.t = function(value, mode) { +/******/ if(mode & 1) value = __webpack_require__(value); +/******/ if(mode & 8) return value; +/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; +/******/ var ns = Object.create(null); +/******/ __webpack_require__.r(ns); +/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); +/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); +/******/ return ns; +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = "/themes/admin/static/js"; +/******/ +/******/ var jsonpArray = window["webpackJsonp"] = window["webpackJsonp"] || []; +/******/ var oldJsonpFunction = jsonpArray.push.bind(jsonpArray); +/******/ jsonpArray.push = webpackJsonpCallback; +/******/ jsonpArray = jsonpArray.slice(); +/******/ for(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]); +/******/ var parentJsonpFunction = oldJsonpFunction; +/******/ +/******/ +/******/ // add entry module to deferred list +/******/ deferredModules.push(["./CTFd/themes/admin/assets/js/pages/challenges.js","helpers","vendor","default~pages/challenge~pages/challenges~pages/configs~pages/editor~pages/main~pages/notifications~p~d5a3cc0a"]); +/******/ // run deferred modules when ready +/******/ return checkDeferredModules(); +/******/ }) +/************************************************************************/ +/******/ ({ + +/***/ "./CTFd/themes/admin/assets/js/pages/challenges.js": +/*!*********************************************************!*\ + !*** ./CTFd/themes/admin/assets/js/pages/challenges.js ***! + \*********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +; +eval("\n\n__webpack_require__(/*! ./main */ \"./CTFd/themes/admin/assets/js/pages/main.js\");\n\nvar _CTFd = _interopRequireDefault(__webpack_require__(/*! core/CTFd */ \"./CTFd/themes/core/assets/js/CTFd.js\"));\n\nvar _jquery = _interopRequireDefault(__webpack_require__(/*! jquery */ \"./node_modules/jquery/dist/jquery.js\"));\n\nvar _ezq = __webpack_require__(/*! core/ezq */ \"./CTFd/themes/core/assets/js/ezq.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction deleteSelectedChallenges(event) {\n var challengeIDs = (0, _jquery.default)(\"input[data-challenge-id]:checked\").map(function () {\n return (0, _jquery.default)(this).data(\"challenge-id\");\n });\n var target = challengeIDs.length === 1 ? \"challenge\" : \"challenges\";\n (0, _ezq.ezQuery)({\n title: \"Delete Challenges\",\n body: \"Are you sure you want to delete \".concat(challengeIDs.length, \" \").concat(target, \"?\"),\n success: function success() {\n var reqs = [];\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = challengeIDs[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var chalID = _step.value;\n reqs.push(_CTFd.default.fetch(\"/api/v1/challenges/\".concat(chalID), {\n method: \"DELETE\"\n }));\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n Promise.all(reqs).then(function (responses) {\n window.location.reload();\n });\n }\n });\n}\n\n(0, _jquery.default)(function () {\n (0, _jquery.default)(\"#challenges-delete-button\").click(deleteSelectedChallenges);\n});\n\n//# sourceURL=webpack:///./CTFd/themes/admin/assets/js/pages/challenges.js?"); + +/***/ }) + +/******/ }); \ No newline at end of file diff --git a/CTFd/themes/admin/static/js/pages/configs.dev.js b/CTFd/themes/admin/static/js/pages/configs.dev.js index e2ad88f..1668f7f 100644 --- a/CTFd/themes/admin/static/js/pages/configs.dev.js +++ b/CTFd/themes/admin/static/js/pages/configs.dev.js @@ -147,7 +147,7 @@ /******/ /******/ /******/ // add entry module to deferred list -/******/ deferredModules.push(["./CTFd/themes/admin/assets/js/pages/configs.js","helpers","vendor","default~pages/challenge~pages/configs~pages/editor~pages/main~pages/notifications~pages/pages~pages/~0fc9fcae"]); +/******/ deferredModules.push(["./CTFd/themes/admin/assets/js/pages/configs.js","helpers","vendor","default~pages/challenge~pages/challenges~pages/configs~pages/editor~pages/main~pages/notifications~p~d5a3cc0a"]); /******/ // run deferred modules when ready /******/ return checkDeferredModules(); /******/ }) diff --git a/CTFd/themes/admin/static/js/pages/editor.dev.js b/CTFd/themes/admin/static/js/pages/editor.dev.js index 96c0233..c9c9ca5 100644 --- a/CTFd/themes/admin/static/js/pages/editor.dev.js +++ b/CTFd/themes/admin/static/js/pages/editor.dev.js @@ -147,7 +147,7 @@ /******/ /******/ /******/ // add entry module to deferred list -/******/ deferredModules.push(["./CTFd/themes/admin/assets/js/pages/editor.js","helpers","vendor","default~pages/challenge~pages/configs~pages/editor~pages/main~pages/notifications~pages/pages~pages/~0fc9fcae"]); +/******/ deferredModules.push(["./CTFd/themes/admin/assets/js/pages/editor.js","helpers","vendor","default~pages/challenge~pages/challenges~pages/configs~pages/editor~pages/main~pages/notifications~p~d5a3cc0a"]); /******/ // run deferred modules when ready /******/ return checkDeferredModules(); /******/ }) diff --git a/CTFd/themes/admin/static/js/pages/main.dev.js b/CTFd/themes/admin/static/js/pages/main.dev.js index 67d967b..6a49208 100644 --- a/CTFd/themes/admin/static/js/pages/main.dev.js +++ b/CTFd/themes/admin/static/js/pages/main.dev.js @@ -147,7 +147,7 @@ /******/ /******/ /******/ // add entry module to deferred list -/******/ deferredModules.push(["./CTFd/themes/admin/assets/js/pages/main.js","helpers","vendor","default~pages/challenge~pages/configs~pages/editor~pages/main~pages/notifications~pages/pages~pages/~0fc9fcae"]); +/******/ deferredModules.push(["./CTFd/themes/admin/assets/js/pages/main.js","helpers","vendor","default~pages/challenge~pages/challenges~pages/configs~pages/editor~pages/main~pages/notifications~p~d5a3cc0a"]); /******/ // run deferred modules when ready /******/ return checkDeferredModules(); /******/ }) diff --git a/CTFd/themes/admin/static/js/pages/notifications.dev.js b/CTFd/themes/admin/static/js/pages/notifications.dev.js index 3bc9775..833e596 100644 --- a/CTFd/themes/admin/static/js/pages/notifications.dev.js +++ b/CTFd/themes/admin/static/js/pages/notifications.dev.js @@ -147,7 +147,7 @@ /******/ /******/ /******/ // add entry module to deferred list -/******/ deferredModules.push(["./CTFd/themes/admin/assets/js/pages/notifications.js","helpers","vendor","default~pages/challenge~pages/configs~pages/editor~pages/main~pages/notifications~pages/pages~pages/~0fc9fcae"]); +/******/ deferredModules.push(["./CTFd/themes/admin/assets/js/pages/notifications.js","helpers","vendor","default~pages/challenge~pages/challenges~pages/configs~pages/editor~pages/main~pages/notifications~p~d5a3cc0a"]); /******/ // run deferred modules when ready /******/ return checkDeferredModules(); /******/ }) diff --git a/CTFd/themes/admin/static/js/pages/pages.dev.js b/CTFd/themes/admin/static/js/pages/pages.dev.js index 80d4a34..038b06c 100644 --- a/CTFd/themes/admin/static/js/pages/pages.dev.js +++ b/CTFd/themes/admin/static/js/pages/pages.dev.js @@ -147,7 +147,7 @@ /******/ /******/ /******/ // add entry module to deferred list -/******/ deferredModules.push(["./CTFd/themes/admin/assets/js/pages/pages.js","helpers","vendor","default~pages/challenge~pages/configs~pages/editor~pages/main~pages/notifications~pages/pages~pages/~0fc9fcae"]); +/******/ deferredModules.push(["./CTFd/themes/admin/assets/js/pages/pages.js","helpers","vendor","default~pages/challenge~pages/challenges~pages/configs~pages/editor~pages/main~pages/notifications~p~d5a3cc0a"]); /******/ // run deferred modules when ready /******/ return checkDeferredModules(); /******/ }) @@ -162,7 +162,7 @@ /***/ (function(module, exports, __webpack_require__) { ; -eval("\n\n__webpack_require__(/*! ./main */ \"./CTFd/themes/admin/assets/js/pages/main.js\");\n\nvar _CTFd = _interopRequireDefault(__webpack_require__(/*! core/CTFd */ \"./CTFd/themes/core/assets/js/CTFd.js\"));\n\nvar _jquery = _interopRequireDefault(__webpack_require__(/*! jquery */ \"./node_modules/jquery/dist/jquery.js\"));\n\nvar _utils = __webpack_require__(/*! core/utils */ \"./CTFd/themes/core/assets/js/utils.js\");\n\nvar _ezq = __webpack_require__(/*! core/ezq */ \"./CTFd/themes/core/assets/js/ezq.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction deletePage(event) {\n var elem = (0, _jquery.default)(this);\n var name = elem.attr(\"page-route\");\n var page_id = elem.attr(\"page-id\");\n (0, _ezq.ezQuery)({\n title: \"Delete \" + (0, _utils.htmlEntities)(name),\n body: \"Are you sure you want to delete {0}?\".format(\"\" + (0, _utils.htmlEntities)(name) + \"\"),\n success: function success() {\n _CTFd.default.fetch(\"/api/v1/pages/\" + page_id, {\n method: \"DELETE\"\n }).then(function (response) {\n return response.json();\n }).then(function (response) {\n if (response.success) {\n elem.parent().parent().remove();\n }\n });\n }\n });\n}\n\n(0, _jquery.default)(function () {\n (0, _jquery.default)(\".delete-page\").click(deletePage);\n});\n\n//# sourceURL=webpack:///./CTFd/themes/admin/assets/js/pages/pages.js?"); +eval("\n\n__webpack_require__(/*! ./main */ \"./CTFd/themes/admin/assets/js/pages/main.js\");\n\nvar _CTFd = _interopRequireDefault(__webpack_require__(/*! core/CTFd */ \"./CTFd/themes/core/assets/js/CTFd.js\"));\n\nvar _jquery = _interopRequireDefault(__webpack_require__(/*! jquery */ \"./node_modules/jquery/dist/jquery.js\"));\n\nvar _ezq = __webpack_require__(/*! core/ezq */ \"./CTFd/themes/core/assets/js/ezq.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction deleteSelectedUsers(event) {\n var pageIDs = (0, _jquery.default)(\"input[data-page-id]:checked\").map(function () {\n return (0, _jquery.default)(this).data(\"page-id\");\n });\n var target = pageIDs.length === 1 ? \"page\" : \"pages\";\n (0, _ezq.ezQuery)({\n title: \"Delete Pages\",\n body: \"Are you sure you want to delete \".concat(pageIDs.length, \" \").concat(target, \"?\"),\n success: function success() {\n var reqs = [];\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = pageIDs[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var pageID = _step.value;\n reqs.push(_CTFd.default.fetch(\"/api/v1/pages/\".concat(pageID), {\n method: \"DELETE\"\n }));\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n Promise.all(reqs).then(function (responses) {\n window.location.reload();\n });\n }\n });\n}\n\n(0, _jquery.default)(function () {\n (0, _jquery.default)(\"#pages-delete-button\").click(deleteSelectedUsers);\n});\n\n//# sourceURL=webpack:///./CTFd/themes/admin/assets/js/pages/pages.js?"); /***/ }) diff --git a/CTFd/themes/admin/static/js/pages/reset.dev.js b/CTFd/themes/admin/static/js/pages/reset.dev.js index 043a1c1..d8926f9 100644 --- a/CTFd/themes/admin/static/js/pages/reset.dev.js +++ b/CTFd/themes/admin/static/js/pages/reset.dev.js @@ -147,7 +147,7 @@ /******/ /******/ /******/ // add entry module to deferred list -/******/ deferredModules.push(["./CTFd/themes/admin/assets/js/pages/reset.js","helpers","vendor","default~pages/challenge~pages/configs~pages/editor~pages/main~pages/notifications~pages/pages~pages/~0fc9fcae"]); +/******/ deferredModules.push(["./CTFd/themes/admin/assets/js/pages/reset.js","helpers","vendor","default~pages/challenge~pages/challenges~pages/configs~pages/editor~pages/main~pages/notifications~p~d5a3cc0a"]); /******/ // run deferred modules when ready /******/ return checkDeferredModules(); /******/ }) diff --git a/CTFd/themes/admin/static/js/pages/scoreboard.dev.js b/CTFd/themes/admin/static/js/pages/scoreboard.dev.js index f88be9e..94485ae 100644 --- a/CTFd/themes/admin/static/js/pages/scoreboard.dev.js +++ b/CTFd/themes/admin/static/js/pages/scoreboard.dev.js @@ -147,7 +147,7 @@ /******/ /******/ /******/ // add entry module to deferred list -/******/ deferredModules.push(["./CTFd/themes/admin/assets/js/pages/scoreboard.js","helpers","vendor","default~pages/challenge~pages/configs~pages/editor~pages/main~pages/notifications~pages/pages~pages/~0fc9fcae"]); +/******/ deferredModules.push(["./CTFd/themes/admin/assets/js/pages/scoreboard.js","helpers","vendor","default~pages/challenge~pages/challenges~pages/configs~pages/editor~pages/main~pages/notifications~p~d5a3cc0a"]); /******/ // run deferred modules when ready /******/ return checkDeferredModules(); /******/ }) diff --git a/CTFd/themes/admin/static/js/pages/statistics.dev.js b/CTFd/themes/admin/static/js/pages/statistics.dev.js index aa3730d..f010040 100644 --- a/CTFd/themes/admin/static/js/pages/statistics.dev.js +++ b/CTFd/themes/admin/static/js/pages/statistics.dev.js @@ -147,7 +147,7 @@ /******/ /******/ /******/ // add entry module to deferred list -/******/ deferredModules.push(["./CTFd/themes/admin/assets/js/pages/statistics.js","helpers","graphs","plotly","vendor","default~pages/challenge~pages/configs~pages/editor~pages/main~pages/notifications~pages/pages~pages/~0fc9fcae"]); +/******/ deferredModules.push(["./CTFd/themes/admin/assets/js/pages/statistics.js","helpers","graphs","plotly","vendor","default~pages/challenge~pages/challenges~pages/configs~pages/editor~pages/main~pages/notifications~p~d5a3cc0a"]); /******/ // run deferred modules when ready /******/ return checkDeferredModules(); /******/ }) diff --git a/CTFd/themes/admin/static/js/pages/submissions.dev.js b/CTFd/themes/admin/static/js/pages/submissions.dev.js index be2c17e..25929a2 100644 --- a/CTFd/themes/admin/static/js/pages/submissions.dev.js +++ b/CTFd/themes/admin/static/js/pages/submissions.dev.js @@ -147,7 +147,7 @@ /******/ /******/ /******/ // add entry module to deferred list -/******/ deferredModules.push(["./CTFd/themes/admin/assets/js/pages/submissions.js","helpers","vendor","default~pages/challenge~pages/configs~pages/editor~pages/main~pages/notifications~pages/pages~pages/~0fc9fcae"]); +/******/ deferredModules.push(["./CTFd/themes/admin/assets/js/pages/submissions.js","helpers","vendor","default~pages/challenge~pages/challenges~pages/configs~pages/editor~pages/main~pages/notifications~p~d5a3cc0a"]); /******/ // run deferred modules when ready /******/ return checkDeferredModules(); /******/ }) diff --git a/CTFd/themes/admin/static/js/pages/team.dev.js b/CTFd/themes/admin/static/js/pages/team.dev.js index 25ab2c4..66fca87 100644 --- a/CTFd/themes/admin/static/js/pages/team.dev.js +++ b/CTFd/themes/admin/static/js/pages/team.dev.js @@ -147,7 +147,7 @@ /******/ /******/ /******/ // add entry module to deferred list -/******/ deferredModules.push(["./CTFd/themes/admin/assets/js/pages/team.js","helpers","graphs","plotly","vendor","default~pages/challenge~pages/configs~pages/editor~pages/main~pages/notifications~pages/pages~pages/~0fc9fcae"]); +/******/ deferredModules.push(["./CTFd/themes/admin/assets/js/pages/team.js","helpers","graphs","plotly","vendor","default~pages/challenge~pages/challenges~pages/configs~pages/editor~pages/main~pages/notifications~p~d5a3cc0a"]); /******/ // run deferred modules when ready /******/ return checkDeferredModules(); /******/ }) diff --git a/CTFd/themes/admin/static/js/pages/teams.dev.js b/CTFd/themes/admin/static/js/pages/teams.dev.js index 4927e7c..dbb39fa 100644 --- a/CTFd/themes/admin/static/js/pages/teams.dev.js +++ b/CTFd/themes/admin/static/js/pages/teams.dev.js @@ -1,7 +1,66 @@ /******/ (function(modules) { // webpackBootstrap +/******/ // install a JSONP callback for chunk loading +/******/ function webpackJsonpCallback(data) { +/******/ var chunkIds = data[0]; +/******/ var moreModules = data[1]; +/******/ var executeModules = data[2]; +/******/ +/******/ // add "moreModules" to the modules object, +/******/ // then flag all "chunkIds" as loaded and fire callback +/******/ var moduleId, chunkId, i = 0, resolves = []; +/******/ for(;i < chunkIds.length; i++) { +/******/ chunkId = chunkIds[i]; +/******/ if(installedChunks[chunkId]) { +/******/ resolves.push(installedChunks[chunkId][0]); +/******/ } +/******/ installedChunks[chunkId] = 0; +/******/ } +/******/ for(moduleId in moreModules) { +/******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) { +/******/ modules[moduleId] = moreModules[moduleId]; +/******/ } +/******/ } +/******/ if(parentJsonpFunction) parentJsonpFunction(data); +/******/ +/******/ while(resolves.length) { +/******/ resolves.shift()(); +/******/ } +/******/ +/******/ // add entry modules from loaded chunk to deferred list +/******/ deferredModules.push.apply(deferredModules, executeModules || []); +/******/ +/******/ // run deferred modules when all chunks ready +/******/ return checkDeferredModules(); +/******/ }; +/******/ function checkDeferredModules() { +/******/ var result; +/******/ for(var i = 0; i < deferredModules.length; i++) { +/******/ var deferredModule = deferredModules[i]; +/******/ var fulfilled = true; +/******/ for(var j = 1; j < deferredModule.length; j++) { +/******/ var depId = deferredModule[j]; +/******/ if(installedChunks[depId] !== 0) fulfilled = false; +/******/ } +/******/ if(fulfilled) { +/******/ deferredModules.splice(i--, 1); +/******/ result = __webpack_require__(__webpack_require__.s = deferredModule[0]); +/******/ } +/******/ } +/******/ return result; +/******/ } +/******/ /******/ // The module cache /******/ var installedModules = {}; /******/ +/******/ // object to store loaded and loading chunks +/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched +/******/ // Promise = chunk loading, 0 = chunk loaded +/******/ var installedChunks = { +/******/ "pages/teams": 0 +/******/ }; +/******/ +/******/ var deferredModules = []; +/******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ @@ -79,9 +138,18 @@ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = "/themes/admin/static/js"; /******/ +/******/ var jsonpArray = window["webpackJsonp"] = window["webpackJsonp"] || []; +/******/ var oldJsonpFunction = jsonpArray.push.bind(jsonpArray); +/******/ jsonpArray.push = webpackJsonpCallback; +/******/ jsonpArray = jsonpArray.slice(); +/******/ for(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]); +/******/ var parentJsonpFunction = oldJsonpFunction; /******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = "./CTFd/themes/admin/assets/js/pages/teams.js"); +/******/ +/******/ // add entry module to deferred list +/******/ deferredModules.push(["./CTFd/themes/admin/assets/js/pages/teams.js","helpers","vendor","default~pages/challenge~pages/challenges~pages/configs~pages/editor~pages/main~pages/notifications~p~d5a3cc0a"]); +/******/ // run deferred modules when ready +/******/ return checkDeferredModules(); /******/ }) /************************************************************************/ /******/ ({ @@ -94,7 +162,7 @@ /***/ (function(module, exports, __webpack_require__) { ; -eval("\n\n//# sourceURL=webpack:///./CTFd/themes/admin/assets/js/pages/teams.js?"); +eval("\n\n__webpack_require__(/*! ./main */ \"./CTFd/themes/admin/assets/js/pages/main.js\");\n\nvar _CTFd = _interopRequireDefault(__webpack_require__(/*! core/CTFd */ \"./CTFd/themes/core/assets/js/CTFd.js\"));\n\nvar _jquery = _interopRequireDefault(__webpack_require__(/*! jquery */ \"./node_modules/jquery/dist/jquery.js\"));\n\nvar _ezq = __webpack_require__(/*! core/ezq */ \"./CTFd/themes/core/assets/js/ezq.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction deleteSelectedTeams(event) {\n var teamIDs = (0, _jquery.default)(\"input[data-team-id]:checked\").map(function () {\n return (0, _jquery.default)(this).data(\"team-id\");\n });\n var target = teamIDs.length === 1 ? \"team\" : \"teams\";\n (0, _ezq.ezQuery)({\n title: \"Delete Teams\",\n body: \"Are you sure you want to delete \".concat(teamIDs.length, \" \").concat(target, \"?\"),\n success: function success() {\n var reqs = [];\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = teamIDs[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var teamID = _step.value;\n reqs.push(_CTFd.default.fetch(\"/api/v1/teams/\".concat(teamID), {\n method: \"DELETE\"\n }));\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n Promise.all(reqs).then(function (responses) {\n window.location.reload();\n });\n }\n });\n}\n\n(0, _jquery.default)(function () {\n (0, _jquery.default)(\"#teams-delete-button\").click(deleteSelectedTeams);\n});\n\n//# sourceURL=webpack:///./CTFd/themes/admin/assets/js/pages/teams.js?"); /***/ }) diff --git a/CTFd/themes/admin/static/js/pages/user.dev.js b/CTFd/themes/admin/static/js/pages/user.dev.js index dca9791..7d5ac5f 100644 --- a/CTFd/themes/admin/static/js/pages/user.dev.js +++ b/CTFd/themes/admin/static/js/pages/user.dev.js @@ -147,7 +147,7 @@ /******/ /******/ /******/ // add entry module to deferred list -/******/ deferredModules.push(["./CTFd/themes/admin/assets/js/pages/user.js","helpers","graphs","plotly","vendor","default~pages/challenge~pages/configs~pages/editor~pages/main~pages/notifications~pages/pages~pages/~0fc9fcae"]); +/******/ deferredModules.push(["./CTFd/themes/admin/assets/js/pages/user.js","helpers","graphs","plotly","vendor","default~pages/challenge~pages/challenges~pages/configs~pages/editor~pages/main~pages/notifications~p~d5a3cc0a"]); /******/ // run deferred modules when ready /******/ return checkDeferredModules(); /******/ }) diff --git a/CTFd/themes/admin/static/js/pages/users.dev.js b/CTFd/themes/admin/static/js/pages/users.dev.js index b3e8278..fc1569c 100644 --- a/CTFd/themes/admin/static/js/pages/users.dev.js +++ b/CTFd/themes/admin/static/js/pages/users.dev.js @@ -147,7 +147,7 @@ /******/ /******/ /******/ // add entry module to deferred list -/******/ deferredModules.push(["./CTFd/themes/admin/assets/js/pages/users.js","helpers","vendor","default~pages/challenge~pages/configs~pages/editor~pages/main~pages/notifications~pages/pages~pages/~0fc9fcae"]); +/******/ deferredModules.push(["./CTFd/themes/admin/assets/js/pages/users.js","helpers","vendor","default~pages/challenge~pages/challenges~pages/configs~pages/editor~pages/main~pages/notifications~p~d5a3cc0a"]); /******/ // run deferred modules when ready /******/ return checkDeferredModules(); /******/ }) @@ -162,7 +162,7 @@ /***/ (function(module, exports, __webpack_require__) { ; -eval("\n\n__webpack_require__(/*! ./main */ \"./CTFd/themes/admin/assets/js/pages/main.js\");\n\n//# sourceURL=webpack:///./CTFd/themes/admin/assets/js/pages/users.js?"); +eval("\n\n__webpack_require__(/*! ./main */ \"./CTFd/themes/admin/assets/js/pages/main.js\");\n\nvar _CTFd = _interopRequireDefault(__webpack_require__(/*! core/CTFd */ \"./CTFd/themes/core/assets/js/CTFd.js\"));\n\nvar _jquery = _interopRequireDefault(__webpack_require__(/*! jquery */ \"./node_modules/jquery/dist/jquery.js\"));\n\nvar _ezq = __webpack_require__(/*! core/ezq */ \"./CTFd/themes/core/assets/js/ezq.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction deleteSelectedUsers(event) {\n var userIDs = (0, _jquery.default)(\"input[data-user-id]:checked\").map(function () {\n return (0, _jquery.default)(this).data(\"user-id\");\n });\n var target = userIDs.length === 1 ? \"user\" : \"users\";\n (0, _ezq.ezQuery)({\n title: \"Delete Users\",\n body: \"Are you sure you want to delete \".concat(userIDs.length, \" \").concat(target, \"?\"),\n success: function success() {\n var reqs = [];\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = userIDs[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var userID = _step.value;\n reqs.push(_CTFd.default.fetch(\"/api/v1/users/\".concat(userID), {\n method: \"DELETE\"\n }));\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n Promise.all(reqs).then(function (responses) {\n window.location.reload();\n });\n }\n });\n}\n\n(0, _jquery.default)(function () {\n (0, _jquery.default)(\"#users-delete-button\").click(deleteSelectedUsers);\n});\n\n//# sourceURL=webpack:///./CTFd/themes/admin/assets/js/pages/users.js?"); /***/ }) diff --git a/CTFd/themes/admin/templates/challenges/challenges.html b/CTFd/themes/admin/templates/challenges/challenges.html index 8ce7e8d..4d64c09 100644 --- a/CTFd/themes/admin/templates/challenges/challenges.html +++ b/CTFd/themes/admin/templates/challenges/challenges.html @@ -25,7 +25,7 @@ - @@ -81,3 +81,7 @@ {% block scripts %} {% endblock %} + +{% block entrypoint %} + +{% endblock %} \ No newline at end of file diff --git a/CTFd/themes/admin/templates/pages.html b/CTFd/themes/admin/templates/pages.html index ec45540..9fdfb1e 100644 --- a/CTFd/themes/admin/templates/pages.html +++ b/CTFd/themes/admin/templates/pages.html @@ -21,7 +21,7 @@
-
@@ -51,7 +51,7 @@
-   +  
diff --git a/CTFd/themes/admin/templates/teams/teams.html b/CTFd/themes/admin/templates/teams/teams.html index 8c835a0..e38d00b 100644 --- a/CTFd/themes/admin/templates/teams/teams.html +++ b/CTFd/themes/admin/templates/teams/teams.html @@ -51,17 +51,15 @@
-
- - - -
+ + +
@@ -90,7 +88,7 @@
-   +  
{{ team.id }} @@ -165,3 +163,7 @@ {% block scripts %} {% endblock %} + +{% block entrypoint %} + +{% endblock %} \ No newline at end of file diff --git a/CTFd/themes/admin/templates/users/users.html b/CTFd/themes/admin/templates/users/users.html index d2af186..62c4bcc 100644 --- a/CTFd/themes/admin/templates/users/users.html +++ b/CTFd/themes/admin/templates/users/users.html @@ -59,7 +59,7 @@ -
@@ -92,7 +92,7 @@
-   +  
{{ user.id }} diff --git a/webpack.config.js b/webpack.config.js index 42aa267..138504b 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -36,6 +36,7 @@ const roots = { 'js': { 'pages/main': 'assets/js/pages/main.js', 'pages/challenge': 'assets/js/pages/challenge.js', + 'pages/challenges': 'assets/js/pages/challenges.js', 'pages/configs': 'assets/js/pages/configs.js', 'pages/notifications': 'assets/js/pages/notifications.js', 'pages/editor': 'assets/js/pages/editor.js',