-
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": [
{
"_id": "TRANSACTION_ID",
"author": "USERNAME_OF_USER",
"timestamp": "TIMESTAMP",
"points": "int (positive or negative)"
},
{
"_id": "TRANSACTION_ID",
"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
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"
}
],
"hidden": false // whether the user is hidden due to the "disable admin scores" setting. "scores" will be an empty array
}
No special errors
Returns the score of a requested user
Authenticated
GET: /v1/userPoints/USERNAME_OF_USER_TO_CHECK
{
"success": true,
"score": 10
"hidden": false // whether the user is hidden due to the "disable admin scores" setting. "scores" will be an empty array
}
No special errors
Returns all recorded submissions(transactions)
Authenticated // Permissions: 2
No input required
{
"success": true,
"submissions": [
{
"_id": "TRANSACTION_ID (like 5ed326c62d0f6f32a834f049)",
"author": "SUBMITTOR",
"challenge": "CHALLENGE_NAME",
"challengeID": "CHALLENGE_ID",
"timestamp": "TIMESTAMP",
"type": "submission/blocked_submission/hint",
"points": "int",
"correct": "bool",
"submission": "SUBMITTED_FLAG",
"hint_id": 0, // (optional, only present if it's a hint)
"lastChallengeID": 132
}
]
}
Error | Definition |
---|---|
permissions |
The logged-in user does not have sufficient permissions to view submissions |
- The transaction 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", "maxSockets"]
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
{
"author": "SUBMITTOR",
"challenge": "CHALLENGE_NAME",
"challengeID": "CHALLENGE_ID",
"type": "submission/blocked_submission/hint",
"points": "int",
"correct": "bool",
"submission": "SUBMITTED_FLAG",
"hint_id": 0, // (optional, only present if it's a hint)
}
{
"success": true,
}
Error | Definition |
---|---|
permissions |
The logged-in user does not have sufficient permissions to create submissions |
- When adding a new transaction, the scoreboard is updated automatically (live)
Authenticated // Permissions: 2
{
"id": "TRANSACTION_ID",
"author": "SUBMITTOR",
"challenge": "CHALLENGE_NAME",
"challengeID": "CHALLENGE_ID",
"type": "submission/blocked_submission/hint",
"points": "int",
"correct": "bool",
"submission": "SUBMITTED_FLAG",
"hint_id": 0, // (optional, only present if it's a hint)
}
{
"success": true,
}
Error | Definition |
---|---|
permissions |
The logged-in user does not have sufficient permissions to create submissions |
- When editing a transaction, the scoreboard is updated automatically (live)
Authenticated // Permissions: 2
{
"ids:" ["CHALLENGE_ID1", ""...]
}
{
"success": true,
}
Error | Definition |
---|---|
not-found |
A list of transaction ids which were not found. Perhaps cause they were already deleted, please refresh the transaction list. Also contains an additional ids property containing said ids. |
- When deleting a transaction, the scoreboard is not updated automatically. Please ask the users to refresh the page to update the cache.
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 }