From 43dee863cd5b9d43d79c603021b747ef290ab544 Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Thu, 18 Aug 2022 23:50:59 +0200 Subject: Add CEF Remote Debugging toggle (#129) * feat: add CEF Remote Debugging toggle * feat: disable remote debugger on startup * refactor: stop debugger instead of disable * feat: add option to allow remote debugging by default Co-authored-by: TrainDoctor --- backend/utilities.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'backend/utilities.py') diff --git a/backend/utilities.py b/backend/utilities.py index 834faeb2..9c0c6388 100644 --- a/backend/utilities.py +++ b/backend/utilities.py @@ -5,6 +5,7 @@ from aiohttp import ClientSession, web from injector import inject_to_tab import helpers +import subprocess class Utilities: def __init__(self, context) -> None: @@ -16,7 +17,10 @@ class Utilities: "confirm_plugin_install": self.confirm_plugin_install, "execute_in_tab": self.execute_in_tab, "inject_css_into_tab": self.inject_css_into_tab, - "remove_css_from_tab": self.remove_css_from_tab + "remove_css_from_tab": self.remove_css_from_tab, + "allow_remote_debugging": self.allow_remote_debugging, + "disallow_remote_debugging": self.disallow_remote_debugging, + "remote_debugging_allowed": self.remote_debugging_allowed } if context: @@ -133,3 +137,15 @@ class Utilities: "success": False, "result": e } + + + async def remote_debugging_allowed(self): + return await helpers.is_systemd_unit_active(helpers.REMOTE_DEBUGGER_UNIT) + + async def allow_remote_debugging(self): + await helpers.start_systemd_unit(helpers.REMOTE_DEBUGGER_UNIT) + return True + + async def disallow_remote_debugging(self): + await helpers.stop_systemd_unit(helpers.REMOTE_DEBUGGER_UNIT) + return True -- cgit v1.2.3