Skip to content
This repository was archived by the owner on Aug 28, 2025. It is now read-only.

Commit 56a327b

Browse files
authored
Solutions (#111)
* Add core-beta changes to support solutions * Related to CTFd/CTFd#2778
1 parent 215afcd commit 56a327b

23 files changed

+92
-53
lines changed

assets/js/challenges.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ Alpine.data("Challenge", () => ({
6969
tab: null,
7070
solves: [],
7171
submissions: [],
72+
solution: null,
7273
response: null,
7374
share_url: null,
7475
max_attempts: 0,
@@ -132,6 +133,20 @@ Alpine.data("Challenge", () => ({
132133
new Tab(this.$el).show();
133134
},
134135

136+
getSolutionId() {
137+
let data = Alpine.store("challenge").data;
138+
return data.solution_id;
139+
},
140+
141+
async showSolution() {
142+
let solution_id = this.getSolutionId();
143+
CTFd._functions.challenge.displaySolution = solution => {
144+
this.solution = solution.html;
145+
new Tab(this.$el).show();
146+
};
147+
await CTFd.pages.challenge.displaySolution(solution_id);
148+
},
149+
135150
getNextId() {
136151
let data = Alpine.store("challenge").data;
137152
return data.next_id;

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
"private": true,
44
"version": "0.0.1",
55
"scripts": {
6-
"dev": "vite build --watch",
6+
"dev": "vite build --watch --mode=development",
77
"build": "vite build",
88
"format": "prettier --write assets/",
99
"lint": "prettier --check assets/",
1010
"verify": "vite build; git diff --quiet --exit-code"
1111
},
1212
"dependencies": {
13-
"@ctfdio/ctfd-js": "^0.0.15",
13+
"@ctfdio/ctfd-js": "^0.0.17",
1414
"@fontsource/lato": "^4.5.3",
1515
"@fontsource/raleway": "^4.5.3",
1616
"@fortawesome/fontawesome-free": "6.5.1",

static/assets/challenges.8f25f69c.js renamed to static/assets/challenges.4dca8d2f.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

static/assets/clipboard.799806a9.js renamed to static/assets/clipboard.be7a2341.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

static/assets/index.af667055.js renamed to static/assets/index.993fb568.js

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

static/assets/notifications.aa88db41.js renamed to static/assets/notifications.389525f0.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

static/assets/page.2f07bf20.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import{C as o,m as d}from"./index.993fb568.js";window.CTFd=o;window.Alpine=d;d.start();

static/assets/page.8e50b780.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

static/assets/scoreboard.3ec74ec0.js renamed to static/assets/scoreboard.e0c9338a.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

static/assets/settings.23e0b0a0.js renamed to static/assets/settings.5adce2c2.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)