-
Notifications
You must be signed in to change notification settings - Fork 12
Misc Endpoints
Get all user score changes with timestamps
Authenticated
No input required
{
"success": true,
"scores": [
{
"author": "USERNAME_OF_USER",
"timestamp": "TIMESTAMP",
"points": "int (positive or negative)"
},
{
"author": "USERNAME_OF_USER",
"timestamp": "TIMESTAMP",
"points": "int (positive or negative)"
}
]
}
- The events are not sorted by user and this must be done on the client side
- This endpoint is probably very slow (needs to look through every document)
-
points
is non-zero
Get all user scores
Authenticated
No input required
{
"success": true,
"scores": [
{
"username": "USERNAME_OF_USER",
"points": "int"
},
{
"author": "USERNAME_OF_USER",
"points": "int"
}
]
}
Returns the score history of a requested user
Authenticated
GET: /v1/scoreboard/USERNAME_OF_USER_TO_CHECK
{
"success": true,
"scores": [
{
"challenge": "CHALLENGE_NAME",
"type": "submission/hint",
"timestamp": "TIMESTAMP",
"points": "int"
},
{
"challenge": "CHALLENGE_NAME",
"type": "submission/hint",
"timestamp": "TIMESTAMP",
"points": "int"
}
]
}
No special errors
Gets the score of a requested user Authenticated
GET: /v1/scores/USERNAME_OF_USER_TO_CHECK
{
"success": true,
"score": 200
}
// If admin scores are disabled in the admin panel, the following is returned for admins:
{
"success": true,
"score": "hidden"
}
No special errors
Returns all recorded submissions(transactions)
Authenticated // Permissions: 2
No input required
{
"success": true,
"submissions": [
{
"_id": "SUBMISSION_ID (like 5ed326c62d0f6f32a834f049)",
"author": "SUBMITTOR",
"challenge": "CHALLENGE_NAME",
"timestamp": "TIMESTAMP",
"type": "submission/blocked_submission",
"points": "int",
"correct": "bool",
"submission": "SUBMITTED_FLAG"
}
]
}
Error | Definition |
---|---|
permissions |
The logged-in user does not have sufficient permissions to view submissions |
- The submission ID is used to delete submissions
Change settings in the admin panel (more specifically settings stored in the cache
collection)
Authenticated // Permissions: 2
No input required
{
"success": true,
"setting": "name_of_setting",
"disable": "setting_value" // This can be a string/integer/boolean
}
Error | Definition |
---|---|
permissions |
The logged-in user does not have sufficient permissions to change settings |
invalid-setting |
The setting specified is not a valid setting to be changed |
- Please get the initial state of settings from
GET /account/disableStates
andGET /challenges/disableStates
- List of valid settings:
["registerDisable", "adminShowDisable", "submissionDisabled", "uploadSize", "uploadPath"]
Change the user's profile picture to the file specified Authenticated
A multi-part form data with the file data named "profile_pic"
{
"success": true
}
Error | Definition |
---|---|
no-file |
No file was uploaded/no file data was uploaded with the name "profile_pic" |
only-1-file |
More than 1 file was uploaded |
too-large |
The specified file was larger than the file size specified in cache.uploadSize (in bytes) |
invalid-ext |
The file was not an image file of one of the allowed extensions (.png , .jpg , .jpeg , .webp ) |
file-upload |
There was an issue saving the file. Please check that the uploadPath cache.uploadPath has sufficient permissions for the script to save the file there |
- By default, all images are converted to
.webp
and compressed to save space and load faster - The library used to convert the image to webp,
sharp
seems to have issues working on Windows, please use a Linux machine if possible.
Authenticated // Permissions: 2
{
"username": "USER_TO_CREDIT",
"chall": "CHALL_NAME",
"points": int,
"flag": "(optional) FLAG_TO_BE_RECORDED",
"force": (optional) bool
}
{
"success": true,
"data": "STRING"
}
Data can be any of the following:
-
recorded
: the submission was recorde -
previous-higher
: the previous score was higher, hence the score was not updated
Error | Definition |
---|---|
permissions |
The logged-in user does not have sufficient permissions to create submissions |
- When
force
istrue
, the API will ignore that the previous submissions had higher scores and will update the score anyways - This endpoint will be used for datascience challenges
The websocket is currently only used for live scoreboard updates. Please use wss
if you have HTTPS
enabled, and ws
to connect if you don't.
All messages to/from the server are JSON-encoded in the following form:
{
type: "string",
data: "any JSON/String etc."
}
The communication protocol is likely to change if more websocket features are required
-
First send an
init
packet{type: "init", data: {auth: "USER-TOKEN-FOR-AUTHENTICATION", lastChallengeID: 0 }} //lastChallengeID is the ID used for tracking whether the cached challenges are up-to-date
- Responses (all with type
init
still)-
bad-auth
: User token is wrong -
missing-auth
: Noauth
property indata
was found -
max-connections
: The account has more than the allowed connections set inmaxSockets
setting - If it is none of the above, then the endpoint sends scoreboard data to update the cached scoreboard
-
- Responses (all with type
-
If the client fails to auth with the socket endpoint within 5 seconds, the client is disconnected forcefully
-
If the account hits the
max-connections
error, the server will disconnect clients from that account till the allowed limit. -
Once the initialisation is completed, the client will receive any socket broadcasts from the server
-
A
score
packet is sent whenever a new hint is bought/challenge is solved to update the live scoreboard:{ type: "score", data: solveDetails }