summaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
Diffstat (limited to 'backend')
-rw-r--r--backend/decky_loader/helpers.py1
-rw-r--r--backend/decky_loader/loader.py2
-rw-r--r--backend/decky_loader/localplatform/localplatformlinux.py1
-rw-r--r--backend/decky_loader/plugin/plugin.py8
-rw-r--r--backend/decky_loader/plugin/sandboxed_plugin.py5
-rw-r--r--backend/decky_loader/updater.py8
-rw-r--r--backend/decky_loader/utilities.py10
7 files changed, 28 insertions, 7 deletions
diff --git a/backend/decky_loader/helpers.py b/backend/decky_loader/helpers.py
index 8e571f92..c6778352 100644
--- a/backend/decky_loader/helpers.py
+++ b/backend/decky_loader/helpers.py
@@ -16,6 +16,7 @@ from .enums import UserType
from logging import getLogger
from packaging.version import Version
+SSHD_UNIT = "sshd.service"
REMOTE_DEBUGGER_UNIT = "steam-web-debug-portforward.service"
# global vars
diff --git a/backend/decky_loader/loader.py b/backend/decky_loader/loader.py
index c4206176..e4a43fbc 100644
--- a/backend/decky_loader/loader.py
+++ b/backend/decky_loader/loader.py
@@ -160,7 +160,7 @@ class Loader:
self.plugins[plugin.name] = plugin.start()
self.logger.info(f"Loaded {plugin.name}")
if not batch:
- self.loop.create_task(self.dispatch_plugin(plugin.name, plugin.version))
+ self.loop.create_task(self.dispatch_plugin(plugin.name, plugin.version, plugin.load_type))
except Exception as e:
self.logger.error(f"Could not load {file}. {e}")
print_exc()
diff --git a/backend/decky_loader/localplatform/localplatformlinux.py b/backend/decky_loader/localplatform/localplatformlinux.py
index 2674e9bc..f22cb465 100644
--- a/backend/decky_loader/localplatform/localplatformlinux.py
+++ b/backend/decky_loader/localplatform/localplatformlinux.py
@@ -158,6 +158,7 @@ async def service_start(service_name : str) -> bool:
async def restart_webhelper() -> bool:
logger.info("Restarting steamwebhelper")
+ # TODO move to pkill
res = run(["killall", "-s", "SIGTERM", "steamwebhelper"], stdout=DEVNULL, stderr=DEVNULL)
return res.returncode == 0
diff --git a/backend/decky_loader/plugin/plugin.py b/backend/decky_loader/plugin/plugin.py
index 00b5dad8..75e52c6a 100644
--- a/backend/decky_loader/plugin/plugin.py
+++ b/backend/decky_loader/plugin/plugin.py
@@ -99,8 +99,10 @@ class PluginWrapper:
return self
def stop(self, uninstall: bool = False):
- self._listener_task.cancel()
+ if hasattr(self, "_listener_task"):
+ self._listener_task.cancel()
async def _(self: PluginWrapper):
- await self._socket.write_single_line(dumps({ "stop": True, "uninstall": uninstall }, ensure_ascii=False))
- await self._socket.close_socket_connection()
+ if hasattr(self, "_socket"):
+ await self._socket.write_single_line(dumps({ "stop": True, "uninstall": uninstall }, ensure_ascii=False))
+ await self._socket.close_socket_connection()
create_task(_(self)) \ No newline at end of file
diff --git a/backend/decky_loader/plugin/sandboxed_plugin.py b/backend/decky_loader/plugin/sandboxed_plugin.py
index 0bbcb471..6c2bcee2 100644
--- a/backend/decky_loader/plugin/sandboxed_plugin.py
+++ b/backend/decky_loader/plugin/sandboxed_plugin.py
@@ -142,7 +142,10 @@ class SandboxedPlugin:
try:
self.log.info("Attempting to uninstall with plugin " + self.name + "'s \"_uninstall\" function.\n")
if hasattr(self.Plugin, "_uninstall"):
- await self.Plugin._uninstall(self.Plugin)
+ if self.api_version > 0:
+ await self.Plugin._uninstall()
+ else:
+ await self.Plugin._uninstall(self.Plugin)
self.log.info("Uninstalled " + self.name + "\n")
else:
self.log.info("Could not find \"_uninstall\" in " + self.name + "'s main.py" + "\n")
diff --git a/backend/decky_loader/updater.py b/backend/decky_loader/updater.py
index 1957c59d..780cf263 100644
--- a/backend/decky_loader/updater.py
+++ b/backend/decky_loader/updater.py
@@ -6,7 +6,7 @@ from os import getcwd, path, remove
from typing import TYPE_CHECKING, List, TypedDict
if TYPE_CHECKING:
from .main import PluginManager
-from .localplatform.localplatform import chmod, service_restart, ON_LINUX, ON_WINDOWS, get_keep_systemd_service, get_selinux
+from .localplatform.localplatform import chmod, service_restart, service_stop, ON_LINUX, ON_WINDOWS, get_keep_systemd_service, get_selinux
import shutil
from typing import List, TYPE_CHECKING, TypedDict
import zipfile
@@ -53,6 +53,7 @@ class Updater:
context.ws.add_route("updater/get_version_info", self.get_version_info);
context.ws.add_route("updater/check_for_updates", self.check_for_updates);
context.ws.add_route("updater/do_restart", self.do_restart);
+ context.ws.add_route("updater/do_shutdown", self.do_shutdown);
context.ws.add_route("updater/do_update", self.do_update);
context.ws.add_route("updater/get_testing_versions", self.get_testing_versions);
context.ws.add_route("updater/download_testing_version", self.download_testing_version);
@@ -184,8 +185,8 @@ class Updater:
logger.info("Updated loader installation.")
await self.context.ws.emit("updater/finish_download")
- await self.do_restart()
await tab.close_websocket()
+ await self.do_restart()
async def do_update(self):
logger.debug("Starting update.")
@@ -242,6 +243,9 @@ class Updater:
async def do_restart(self):
await service_restart("plugin_loader")
+ async def do_shutdown(self):
+ await service_stop("plugin_loader")
+
async def get_testing_versions(self) -> List[TestingVersion]:
result: List[TestingVersion] = []
async with ClientSession() as web:
diff --git a/backend/decky_loader/utilities.py b/backend/decky_loader/utilities.py
index 7c15bb85..4dbf34f7 100644
--- a/backend/decky_loader/utilities.py
+++ b/backend/decky_loader/utilities.py
@@ -79,6 +79,8 @@ class Utilities:
context.ws.add_route("utilities/remove_css_from_tab", self.remove_css_from_tab)
context.ws.add_route("utilities/allow_remote_debugging", self.allow_remote_debugging)
context.ws.add_route("utilities/disallow_remote_debugging", self.disallow_remote_debugging)
+ context.ws.add_route("utilities/start_ssh", self.allow_remote_debugging)
+ context.ws.add_route("utilities/stop_ssh", self.allow_remote_debugging)
context.ws.add_route("utilities/filepicker_ls", self.filepicker_ls)
context.ws.add_route("utilities/disable_rdt", self.disable_rdt)
context.ws.add_route("utilities/enable_rdt", self.enable_rdt)
@@ -284,6 +286,14 @@ class Utilities:
await service_stop(helpers.REMOTE_DEBUGGER_UNIT)
return True
+ async def start_ssh(self):
+ await service_start(helpers.SSHD_UNIT)
+ return True
+
+ async def stop_ssh(self):
+ await service_stop(helpers.SSHD_UNIT)
+ return True
+
async def filepicker_ls(self,
path: str | None = None,
include_files: bool = True,