Provides functions to customize the character.
- Source:
Methods
(static) getGameToken(req, res)
Generates a new game token for the authenticated user and responds with it.
Clients will push this to game backend to claim they're some particular user. The reason that game tokens exist:
- Clients have to send some kind of identity, saying they're some particular user.
- We could use the character customization access token directly, but it is not a good idea to send it over non-encrypted WS since CC token is powerful
- And we don't wanna convert WS to WSS because of shitty performance
- Anyway... clients ask for a token that is not that powerful and that expires very soon and push it to game backend.
Parameters:
Name | Type | Description |
---|---|---|
req |
request |
|
res |
response |
- Source:
(static) getMask(req, res)
Responds with the masks of the user with given id. Returns HTTP 500 if user with given id is not found or user hasn't saved any character customization yet.
Parameters:
Name | Type | Description |
---|---|---|
req |
request |
|
res |
response |
- Source:
(static) getRandomCharacterCustomization(req, res)
Responds with one of the predefined customizations randomly. Requires authentication even though it would be ok otherwise. Doesn't save that customization to user automatically. Clients should send a separate request for that.
Parameters:
Name | Type | Description |
---|---|---|
req |
request |
|
res |
response |
- Source:
(static) getUserCharacterCustomization(req, res)
Responds with character customization of the authenticated user.
Parameters:
Name | Type | Description |
---|---|---|
req |
request |
|
res |
response |
- Source:
(static) saveUserCharacterCustomization(req, res)
Saves posted character customization of the authenticated user.
Does some validation before saving.
Masks (images) are created and saved as well.
If all good, returns {"OK":1}
Parameters:
Name | Type | Description |
---|---|---|
req |
request |
|
res |
response |
- Source:
(private, inner) getUser(req) → {User}
Gets the current logged user. It is set on the request object by the authenticate
middleware.
Parameters:
Name | Type | Description |
---|---|---|
req |
- Source:
Returns:
- Type
- User