Normalize outbound RPC params to ints so cached game dicts (float ids from Godot's JSON parser) don't fail Install.Queue with -32700

This commit is contained in:
Jose Falanga 2026-08-06 19:08:44 -03:00
parent e9f25d104b
commit b19903e682
2 changed files with 7 additions and 2 deletions

View file

@ -323,7 +323,12 @@ func _rpc_call(method: String, params: Dictionary = {}) -> Dictionary:
var id := _next_id var id := _next_id
_next_id += 1 _next_id += 1
var req := {"jsonrpc": "2.0", "id": id, "method": method, "params": params} var req := {"jsonrpc": "2.0", "id": id, "method": method, "params": params}
_send_line(JSON.stringify(req)) # Params can carry game dicts that went through a JSON cache roundtrip
# (Godot's JSON.parse_string decodes every number as a float), so an id
# like 936521 comes back as 936521.0 and butlerd's int64 fields reject it
# with RPC error -32700. Normalizing before serializing guarantees every
# integral number is sent as an int, mirroring the inbound normalization.
_send_line(JSON.stringify(_normalize_json(req)))
var out: Array = [-1, null, null] var out: Array = [-1, null, null]
while out[0] != id: while out[0] != id:

View file

@ -1,7 +1,7 @@
{ {
"plugin.id": "itch", "plugin.id": "itch",
"plugin.name": "itch.io", "plugin.name": "itch.io",
"plugin.version": "0.1.6", "plugin.version": "0.1.7",
"plugin.min-api-version": "1.1.0", "plugin.min-api-version": "1.1.0",
"plugin.link": "https://github.com/YOUR_USERNAME/OpenGamepadUI-itch", "plugin.link": "https://github.com/YOUR_USERNAME/OpenGamepadUI-itch",
"plugin.source": "https://github.com/YOUR_USERNAME/OpenGamepadUI-itch", "plugin.source": "https://github.com/YOUR_USERNAME/OpenGamepadUI-itch",