summaryrefslogtreecommitdiff
path: root/decky_client.py
diff options
context:
space:
mode:
authorTranch <tranch.xiao@gmail.com>2026-02-11 18:42:43 +0800
committerGitHub <noreply@github.com>2026-02-11 18:42:43 +0800
commitb2b3ca6b043e83b5522f818640247189ac752a8e (patch)
treefcaa7965b7ddd09309ffa68134cdb8f900aa41ec /decky_client.py
parentd50c14341bd67ea029566440b1eba9d4d1481a9e (diff)
parented5433ad7de353aa266a08683075d8363cfb8632 (diff)
downloadaccelerator-installer-b2b3ca6b043e83b5522f818640247189ac752a8e.tar.gz
accelerator-installer-b2b3ca6b043e83b5522f818640247189ac752a8e.zip
Merge pull request #4 from AeroCore-IO/copilot/fix-store-type-configurationv1.0.8
Fix store URL setting key to match Decky Loader official implementation
Diffstat (limited to 'decky_client.py')
-rw-r--r--decky_client.py46
1 files changed, 40 insertions, 6 deletions
diff --git a/decky_client.py b/decky_client.py
index 53f8037..597a9b3 100644
--- a/decky_client.py
+++ b/decky_client.py
@@ -17,6 +17,13 @@ EVENT = 3
# Default store URL
DEFAULT_STORE_URL = "https://plugins.deckbrew.xyz/plugins"
+# Store type mapping
+STORE_TYPE_NAMES = {
+ 0: "default",
+ 1: "testing",
+ 2: "custom"
+}
+
def log(*args: Any) -> None:
"""Print formatted logs to stderr."""
@@ -295,10 +302,21 @@ async def configure_store_url(store_url: str) -> None:
token = await client.get_token()
await client.connect(token)
- log(f"Setting custom store URL: {store_url}")
- await client.send(CALL, "utilities/settings/set", ["store_url", store_url])
+ # First, set the store type to 2 (custom)
+ log(f"Setting store type to custom (2)...")
+ await client.send(CALL, "utilities/settings/set", ["store", 2])
+ msg = await client.recv()
+ if msg is None:
+ raise RuntimeError("Connection closed by server")
+
+ if msg.get("type") == ERROR:
+ log(f"Server error setting store type: {msg.get('error')}")
+ raise RuntimeError(f"Failed to set store type: {msg.get('error')}")
+
+ log(f"Store type set to custom")
- # Wait for reply
+ log(f"Setting custom store URL: {store_url}")
+ await client.send(CALL, "utilities/settings/set", ["store-url", store_url])
msg = await client.recv()
if msg is None:
raise RuntimeError("Connection closed by server")
@@ -319,17 +337,33 @@ async def configure_store_url(store_url: str) -> None:
async def get_store_url() -> str:
- """Get the configured custom store URL from Decky settings."""
+ """Get the configured custom store URL and type from Decky settings."""
client = DeckyClient()
try:
log(f"Connecting to Decky server at {client.host}:{client.port}...")
token = await client.get_token()
await client.connect(token)
+ # Get store type
+ log("Getting configured store type...")
+ await client.send(CALL, "utilities/settings/get", ["store", 0])
+
+ msg = await client.recv()
+ if msg is None:
+ raise RuntimeError("Connection closed by server")
+
+ if msg.get("type") == REPLY:
+ store_type = msg.get('result')
+ store_type_name = STORE_TYPE_NAMES.get(store_type, f"unknown ({store_type})")
+ log(f"Current store type: {store_type_name}")
+ elif msg.get("type") == ERROR:
+ log(f"Server error: {msg.get('error')}")
+ raise RuntimeError(f"Failed to get store type: {msg.get('error')}")
+
+ # Get store URL
log("Getting configured store URL...")
- await client.send(CALL, "utilities/settings/get", ["store_url", DEFAULT_STORE_URL])
+ await client.send(CALL, "utilities/settings/get", ["store-url", DEFAULT_STORE_URL])
- # Wait for reply
msg = await client.recv()
if msg is None:
raise RuntimeError("Connection closed by server")