File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ import {
11
11
loadUnlock ,
12
12
displayUnlock ,
13
13
displayHint ,
14
+ loadSolution ,
15
+ displaySolution ,
14
16
} from "./pages/challenge" ;
15
17
import { getScoreboard , getScoreboardDetail , getBrackets } from "./pages/scoreboard" ;
16
18
import { updateSettings , generateToken , deleteToken } from "./pages/settings" ;
@@ -127,6 +129,8 @@ const pages = {
127
129
loadUnlock,
128
130
displayUnlock,
129
131
displayHint,
132
+ loadSolution,
133
+ displaySolution,
130
134
} ,
131
135
challenges : {
132
136
getChallenges,
Original file line number Diff line number Diff line change @@ -120,3 +120,19 @@ export async function displaySolves(challengeId) {
120
120
CTFd . _functions . challenge . displaySolves ( solves ) ;
121
121
}
122
122
}
123
+
124
+ export async function loadSolution ( solutionId ) {
125
+ const response = await CTFd . fetch ( `/api/v1/solutions/${ solutionId } ` , {
126
+ method : "GET" ,
127
+ } ) ;
128
+
129
+ const body = await response . json ( ) ;
130
+ return body [ "data" ] ;
131
+ }
132
+
133
+ export async function displaySolution ( solutionId ) {
134
+ let solution = await loadSolution ( solutionId ) ;
135
+ if ( CTFd . _functions . challenge . displaySolution ) {
136
+ CTFd . _functions . challenge . displaySolution ( solution ) ;
137
+ }
138
+ }
You can’t perform that action at this time.
0 commit comments