mirror of
https://github.com/SteamDeckHomebrew/decky-loader.git
synced 2026-06-17 00:37:49 +00:00
hook up plugin events properly
This commit is contained in:
@@ -144,7 +144,7 @@ class Loader:
|
||||
try:
|
||||
async def plugin_emitted_event(event: str, args: Any):
|
||||
self.logger.debug(f"PLUGIN EMITTED EVENT: {event} with args {args}")
|
||||
await self.ws.emit(f"loader/plugin_event", {plugin:plugin.name, event:event, args:args})
|
||||
await self.ws.emit(f"loader/plugin_event", {"plugin": plugin.name, "event": event, "args": args})
|
||||
|
||||
plugin = PluginWrapper(file, plugin_directory, self.plugin_path, plugin_emitted_event)
|
||||
if plugin.name in self.plugins:
|
||||
|
||||
@@ -206,6 +206,8 @@ logging.basicConfig(filename=DECKY_PLUGIN_LOG,
|
||||
format='[%(asctime)s][%(levelname)s]: %(message)s',
|
||||
force=True)
|
||||
logger: logging.Logger = logging.getLogger()
|
||||
# Also log to stdout
|
||||
logger.addHandler(logging.StreamHandler())
|
||||
"""The main plugin logger writing to `DECKY_PLUGIN_LOG`."""
|
||||
|
||||
logger.setLevel(logging.INFO)
|
||||
|
||||
@@ -90,7 +90,7 @@ class PluginWrapper:
|
||||
|
||||
return await request.wait_for_result()
|
||||
|
||||
async def execute_method(self, method_name: str, args: List[Any]):
|
||||
async def execute_method(self, method_name: str, *args: List[Any]):
|
||||
if self.passive:
|
||||
raise RuntimeError("This plugin is passive (aka does not implement main.py)")
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ class SandboxedPlugin:
|
||||
|
||||
d: SocketResponseDict = {"type": SocketMessageType.RESPONSE, "res": None, "success": True, "id": data["id"]}
|
||||
try:
|
||||
if data["legacy"]:
|
||||
if data.get("legacy"):
|
||||
if self.api_version > 0:
|
||||
raise Exception("Legacy methods may not be used on api_version > 0")
|
||||
# Legacy kwargs
|
||||
|
||||
Reference in New Issue
Block a user