From a76ef50ed70d5ba1600a40257a1f516a5331f172 Mon Sep 17 00:00:00 2001 From: SimplifiedPrivacy Date: Mon, 27 Jul 2026 19:54:22 -0400 Subject: [PATCH] Improved Systemwide feedback errors to GUI --- core/controllers/ProfileController.py | 29 ++++++++++++++----- .../systemwide/systemwide_wireguard.py | 1 - 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/core/controllers/ProfileController.py b/core/controllers/ProfileController.py index 9d85729..2d0e73a 100644 --- a/core/controllers/ProfileController.py +++ b/core/controllers/ProfileController.py @@ -91,13 +91,13 @@ class ProfileController: if profile.is_system_profile(): try: establish_connection(profile, ignore=ignore, connection_observer=connection_observer) + if profile_observer is not None: + profile_observer.notify('enabled', profile) except FirewallError: - raise ProfileActivationError('Firewall could not be enabled.') + raise except ConnectionError: raise ProfileActivationError('The profile could not be enabled.') - if profile_observer is not None: - profile_observer.notify('enabled', profile) @staticmethod def disable(profile: Union[SessionProfile, SystemProfile], explicitly: bool = True, ignore: tuple[type[Exception]] = (), profile_observer: ProfileObserver = None): @@ -117,6 +117,15 @@ class ProfileController: session_state.dissolve(session_state.id) + if profile_observer is not None: + + profile_observer.notify('disabled', profile, dict( + explicitly=explicitly, + )) + + # ============================================================================ + # SYSTEMWIDE + # ============================================================================ if profile.is_system_profile(): subjects = ProfileController.get_all().values() @@ -137,14 +146,20 @@ class ProfileController: try: terminate_system_connection() + if profile_observer is not None: + profile_observer.notify('disabled', profile, dict( + explicitly=explicitly, + )) except ConnectionTerminationError: raise ProfileDeactivationError('The profile could not be disabled.') + except FirewallError: + raise - if profile_observer is not None: + # if profile_observer is not None: - profile_observer.notify('disabled', profile, dict( - explicitly=explicitly, - )) + # profile_observer.notify('disabled', profile, dict( + # explicitly=explicitly, + # )) time.sleep(1.0) diff --git a/core/services/networking/systemwide/systemwide_wireguard.py b/core/services/networking/systemwide/systemwide_wireguard.py index b09432b..d959e73 100644 --- a/core/services/networking/systemwide/systemwide_wireguard.py +++ b/core/services/networking/systemwide/systemwide_wireguard.py @@ -233,7 +233,6 @@ def establish_system_connection( 2) Pass to private function 3) Retry on failure """ - # ================= VERIFY ENDPOINT ================= if ConfigurationController.get_endpoint_verification_enabled(): verify_wireguard_endpoint(profile, ignore=ignore)