Skip to content

Instantly share code, notes, and snippets.

@vlOd2
Last active December 21, 2023 21:09
Show Gist options
  • Save vlOd2/9202e85cfcecbda23de15a606b13176d to your computer and use it in GitHub Desktop.
Save vlOd2/9202e85cfcecbda23de15a606b13176d to your computer and use it in GitHub Desktop.
ClassiCube Client important API documentation
C: Client
S: Server
== ClassiCube Login ==
C: Makes blank GET request to https://www.classicube.net/api/login/
S: Server responds with {"authenticated":false,"errors":[],"token":<random token>,"username":null} and sets a useless session cookie
C: Makes POST request to https://www.classicube.net/api/login/ with the useless session cookie and the following post data: username=<username>&password=<password>&token=<random token from previos response>&login_code=<login code (if required) or empty>
S: Replies with either {"authenticated":true,"errors":[],"token":"","username":"<username>"} (success) or {"authenticated":true,"errors":[<error1>,<error2> etc],"token":"","username":"<username>"} (failure)
S: Sets the proper session cookie on success
The known errors the server reports are: username, password, login_code, verification
The "random token" appears to be protection against CSRF attacks (atleast according to the code)
If you get the error "login_code", repeat the steps but use a login code this time
== ClassiCube Server List Fetching ==
C: After logging in, makes a GET request with the proper session cookie to https://www.classicube.net/api/servers
S: The server replies with following: {"servers":[<server entry1>,<server entry2> etc]}
Example server entry format:
{
"country_abbr":"US",
"featured":false,
"hash":"abcdefgh",
"ip":"127.0.0.1",
"maxplayers":256,
"mppass":"abcdefgh",
"name":"Example Server",
"players":100,
"port":25565,
"software":"Example Server Software",
"uptime":27842250,
"web":true
}
Fields explanation:
- country_abbr: Abbreviated country name (T1 is used when unavailable)
- featured: Whether the server is featured or not
- hash: The hash of the specified server
- ip: The IP of the server
- maxplayers: The maximum amount of players that can join
- mppass: **mppass used for connecting, MAKE SURE TO KEEP THIS PRIVATE**
- name: The name of the server
- players: The amount of online players
- port: The port of the server
- software: The server's software, can contain Minecraft styled color codes
- uptime: The uptime of the server, in seconds
- web: Whether the server supports web clients or not
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment