File tree Expand file tree Collapse file tree 2 files changed +22
-5
lines changed Expand file tree Collapse file tree 2 files changed +22
-5
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ import {
1212 displayUnlock ,
1313 displayHint ,
1414} from "./pages/challenge" ;
15- import { getScoreboard , getScoreboardDetail } from "./pages/scoreboard" ;
15+ import { getScoreboard , getScoreboardDetail , getBrackets } from "./pages/scoreboard" ;
1616import { updateSettings , generateToken , deleteToken } from "./pages/settings" ;
1717import { userSolves , userFails , userAwards } from "./pages/users" ;
1818import {
@@ -136,6 +136,7 @@ const pages = {
136136 scoreboard : {
137137 getScoreboard,
138138 getScoreboardDetail,
139+ getBrackets,
139140 } ,
140141 settings : {
141142 updateSettings,
Original file line number Diff line number Diff line change 11import CTFd from "../main" ;
22
3- export async function getScoreboard ( ) {
4- const response = await CTFd . fetch ( "/api/v1/scoreboard" , {
3+ export async function getScoreboard ( bracketId = null ) {
4+ let url = "/api/v1/scoreboard" ;
5+ if ( bracketId ) {
6+ url = `${ url } ?bracket_id=${ bracketId } ` ;
7+ }
8+ const response = await CTFd . fetch ( url , {
59 method : "GET" ,
610 } ) ;
711 const body = await response . json ( ) ;
812 return body [ "data" ] ; // scoreboard data
913}
1014
11- export async function getScoreboardDetail ( count ) {
12- const response = await CTFd . fetch ( `/api/v1/scoreboard/top/${ count } ` , {
15+ export async function getScoreboardDetail ( count , bracketId = null ) {
16+ let url = `/api/v1/scoreboard/top/${ count } ` ;
17+ if ( bracketId ) {
18+ url = `${ url } ?bracket_id=${ bracketId } ` ;
19+ }
20+ const response = await CTFd . fetch ( url , {
1321 method : "GET" ,
1422 } ) ;
1523 const body = await response . json ( ) ;
1624 return body [ "data" ] ; // scoreboard data
1725}
26+
27+ export async function getBrackets ( userMode ) {
28+ const response = await CTFd . fetch ( `/api/v1/brackets?type=${ userMode } ` , {
29+ method : "GET" ,
30+ } ) ;
31+ const body = await response . json ( ) ;
32+ return body [ "data" ] ;
33+ }
You can’t perform that action at this time.
0 commit comments