Skip to content

Account server endpoints #111

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Feb 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/_sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,14 @@

- [Request](/endpoints/request.md)

**Account Server Endpoints**

- [Backup](/endpoints/accounts/backupGJAccountNew.md)
- [Sync](/endpoints/accounts/syncGJAccountNew.md)

**Topics**

- [GJP](/topics/gjp.md)
- [Level Passwords](/topics/level_passwords.md)
- [Level Encoding/Decoding](/topics/levelstring_encoding_decoding.md)
- [Game Save Files Encryption/Decryption](/topics/localfiles_encrypt_decrypt.md)
Expand Down
58 changes: 58 additions & 0 deletions docs/endpoints/accounts/backupGJAccountNew.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# accounts/backupGJAccountNew.php

Saves account data

**Note:** This page is on the account server. You can find the domain name by sending a request to /database/getAccountURL.php (currently http://www.robtopgames.net)

## Parameters

### Required Parameters

**userName** - The username of the account to be added

**password** - The password of the account to be added

**gameVersion** - 21

**binaryVersion** - 35

**saveData** - The save data for CCGameManager.dat compressed with gzip, then a semicolon `;` and the save data for CCLocalLevels.dat compressed with gzip.

**secret** - Wmfv3899gc9

### Optional Parameters

**gdw** - 0

## Response

1 if data was saved, -1 if not

## Example

<!-- tabs:start -->

### **Python**

```py
import requests

data = {
"userName": "APIAccount",
"password": "********", # This would be APIAccount's password
"gameVersion": 21,
"binaryVersion": 35,
"saveData": "H4sIAAAAAAAAA8VaWXObSBD-K1Se7ZhrOKocpWRLzubwJrVK8kphNJYICFSAHOvf74yYA6ZHgq1daatcFnzTDD1fH_Q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j68YIdq5H13ucMCa8uCA4GI4QrEVffdkSIiBquEMwFU9ZWQI-NRCeGLElKiH_8EUDlTMgQBgAR4i0oTz8Et8DijCYNvrzOhT1N6LEvx1xblxIKDQG1zyylJuA4KzRDxz9PnO_CSFuqNp16XvxdlsXqMq4wcVOt-QZM8pR_E-TI9FBOy4YnUF9X-Z3uujSdpnv_JZJuciGpky3Wb42_aw243h0Nxk78BpH5jdTEnAAA=;H4sIAAAAAAAAA7Oxr8jNUShLLSrOzM-zVTLUM1Cyt7MpyMksLkEVVUjPAvJtlYyAbDublMzkEjubbDsfH994A0Mb_WygEIgfn1nsWFQE5pco6NvZ6INFwaqMwKKZdsamNvqZIBmwEfpgq-wAmIGBy4cAAAA=",
"secret": "Wmfv3899gc9"
}

req = requests.post("http://www.robtopgames.net/database/accounts/backupGJAccountNew.php", data=data)
print(req.text)
```

**Response**
```py
1
```

<!-- tabs:end -->
63 changes: 63 additions & 0 deletions docs/endpoints/accounts/syncGJAccountNew.md

Large diffs are not rendered by default.

39 changes: 39 additions & 0 deletions docs/topics/gjp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# GJP

GJP is a parameter commonly sent as `gjp` in requests. It is used for account authentication, and commonly sent with the `accountID` parameter.

## Encoding/Decoding

The GJP is your account password XOR-encoded with key "37526", and then encoded with base64.

To decode, take the GJP and decode it from base64, then XOR-encode it again (XOR encoding and decoding is identical).

**The following code demonstrates this process programmatically:**

<!-- tabs:start -->

### **Python**

```py
import base64

def encode_gjp(password: str) -> str:
# put it through the xor cipher with the key "37526")
encoded = xor_cipher(password, "37526")
# encode the password to base64
encoded_base64 = base64.b64encode(encoded.encode()).decode()
encoded_base64 = encoded_base64.replace("+", "-")
encoded_base64 = encoded_base64.replace("/", "_")

return encoded_base64

def decode_gjp(gjp: str) -> str:
# decode the password from base64
decoded_base64 = base64.b64decode(gjp.encode()).decode()
# put it through the xor cipher with the key "37526")
decoded = xor_cipher(decoded_base64, "37526")

return decoded
```

<!-- tabs:end -->