Skip to content

Advanced Module

Lucas E. da Silva edited this page Apr 13, 2026 · 1 revision

⚙️ Connections & Internal Mechanics

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.


🛠️ Core Connection Functions

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_id and private_key from 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.

connect_web(LINK: String, action_type: ACTION_TYPE) -> Variant

Handles the low-level HTTPRequest.

  • Node Management: Dynamically creates an HTTPRequest node, adds it to the scene tree, and ensures it is freed (queue_free()) after the request is completed.
  • Asynchronous: Uses await to stay non-blocking.

data_processing(data: Array, action_type: ACTION_TYPE) -> Variant

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 using printerr.
  • 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 success key).
    • SCORES/TROPHIES: Returns specific lists or ranks.

🔒 Security Implementation (SHA1)

The plugin implements Game Jolt's security protocol by appending a signature to every call.

  1. It takes the full URL (including the private_key).
  2. Generates a .sha1_text() hash.
  3. Appends the hash as &signature=... and removes the plain text private key from the final link for the request.

🚦 Internal Enums

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}

Clone this wiki locally