-
Notifications
You must be signed in to change notification settings - Fork 0
Advanced Module
Lucas E. da Silva edited this page Apr 13, 2026
·
1 revision
This section covers the internal logic of the plugin, including how URLs are constructed, how security signatures are generated, and how raw data from Game Jolt is processed.
connect_api(type: String, require_user: bool, action_type: ACTION_TYPE, code: String = "") -> Variant
This is the master function that constructs the API request URL.
-
Security: Automatically fetches
game_idandprivate_keyfrom Project Settings. - Signature: Generates a SHA1 signature for every request, combining the full URL with your private key as required by Game Jolt.
- Validation: Checks if credentials and user session (if required) exist before sending the request.
Handles the low-level HTTPRequest.
-
Node Management: Dynamically creates an
HTTPRequestnode, adds it to the scene tree, and ensures it is freed (queue_free()) after the request is completed. -
Asynchronous: Uses
awaitto stay non-blocking.
The brain of the plugin. It parses the raw JSON response and filters it based on the ACTION_TYPE.
-
Error Handling: Automatically prints server-side error messages (from
response.message) to the Godot console usingprinterr. -
Filtering:
- USER: Returns the first user in the array or a boolean.
- DATA_STORE: Returns keys, raw data, or the full dictionary depending on the request.
-
TIME: Returns the time dictionary (cleans up the
successkey). - SCORES/TROPHIES: Returns specific lists or ranks.
The plugin implements Game Jolt's security protocol by appending a signature to every call.
- It takes the full URL (including the
private_key). - Generates a
.sha1_text()hash. - Appends the hash as
&signature=...and removes the plain text private key from the final link for the request.
To maintain code clarity, the following enums are used internally to route data processing:
enum ACTION_TYPE {USER, DATA_STORE, TROPHY, SESSIONS, TIME, SCORES, FRIENDS, OTHER, IMG}
enum OPERATION {ADD, SUBTRACT, MULTIPLY, DIVIDE, APPEND, PREPEND}
enum STATUS {ACTIVE, IDLE, NULL}