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 {
1111 loadUnlock ,
1212 displayUnlock ,
1313 displayHint ,
14+ loadSolution ,
15+ displaySolution ,
1416} from "./pages/challenge" ;
1517import { getScoreboard , getScoreboardDetail , getBrackets } from "./pages/scoreboard" ;
1618import { updateSettings , generateToken , deleteToken } from "./pages/settings" ;
@@ -127,6 +129,8 @@ const pages = {
127129 loadUnlock,
128130 displayUnlock,
129131 displayHint,
132+ loadSolution,
133+ displaySolution,
130134 } ,
131135 challenges : {
132136 getChallenges,
Original file line number Diff line number Diff line change @@ -120,3 +120,19 @@ export async function displaySolves(challengeId) {
120120 CTFd . _functions . challenge . displaySolves ( solves ) ;
121121 }
122122}
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