diff --git a/gui/v2/ui/pages/menu_page.py b/gui/v2/ui/pages/menu_page.py index 334bcf2..37e1df4 100755 --- a/gui/v2/ui/pages/menu_page.py +++ b/gui/v2/ui/pages/menu_page.py @@ -784,7 +784,6 @@ class MenuPage(Page): profile_location = None profile_operator = self._location_operator(profile_obj) operator_name = getattr(profile_operator, 'name', '') if profile_operator else "" - if protocol.lower() == "wireguard" and is_profile_enabled and profile_obj and profile_obj.connection and profile_obj.connection.code == 'wireguard': verification_widget = self.create_verification_widget( profile_obj) @@ -792,7 +791,7 @@ class MenuPage(Page): show_verification_widget = True label_principal = None - elif operator_name != 'Simplified Privacy' and protocol.lower() == "wireguard": + elif operator_name != 'Simplified Privacy' and protocol.lower() in ("wireguard", "hysteria2", "vless"): if isinstance(profile_obj, SessionProfile): text_color = "black" label_background = QLabel(self) @@ -1343,6 +1342,8 @@ class MenuPage(Page): lambda: self.handle_sync_after_verification(profile_id)) self.worker_thread.sync_output.connect( self.update_status.update_values) + self.worker_thread.sync_error.connect( + self.update_status.update_status) self.worker_thread.start() else: self.update_status.update_status("Profile enable aborted") diff --git a/gui/v2/ui/pages/sync_screen.py b/gui/v2/ui/pages/sync_screen.py index 5dcd9c6..49d52e8 100755 --- a/gui/v2/ui/pages/sync_screen.py +++ b/gui/v2/ui/pages/sync_screen.py @@ -82,6 +82,8 @@ class SyncScreen(Page): self.worker_thread = WorkerThread('SYNC') self.worker_thread.sync_output.connect(self.update_output) + self.worker_thread.sync_error.connect( + self.update_status.update_status) self.worker_thread.start() def update_output(self, available_locations, available_browsers, status, is_tor, locations, all_browsers): diff --git a/gui/v2/workers/worker_thread.py b/gui/v2/workers/worker_thread.py index 4d968c6..cd211fe 100755 --- a/gui/v2/workers/worker_thread.py +++ b/gui/v2/workers/worker_thread.py @@ -8,6 +8,7 @@ from PyQt6.QtCore import QThread, pyqtSignal from core.controllers.ApplicationVersionController import ApplicationVersionController from core.controllers.ClientController import ClientController from core.controllers.ConfigurationController import ConfigurationController, ConnectionChoice +from core.Constants import Constants from core.controllers.SyncController import new_sync from core.controllers.InvoiceController import InvoiceController @@ -42,6 +43,7 @@ from gui.v2.infrastructure.setup_observers import ( class WorkerThread(QThread): text_output = pyqtSignal(str) sync_output = pyqtSignal(list, list, bool, bool, list, list) + sync_error = pyqtSignal(str) invoice_output = pyqtSignal(object, str) invoice_finished = pyqtSignal(bool) profiles_output = pyqtSignal(dict) @@ -334,7 +336,15 @@ class WorkerThread(QThread): ConfigurationController.set_connection('tor') else: ConfigurationController.set_connection('system') - self.check_for_update() + print(f"[SYNC] Syncing from URL: {Constants.SP_API_BASE_URL}/cachedsync") + sync_result = new_sync( + client_observer=client_observer, + connection_observer=connection_observer) + if not sync_result.valid: + error_message = sync_result.message or "Connection error or invalid sync URL" + self.sync_output.emit([], [], False, False, [], []) + self.sync_error.emit(f"Sync failed: {error_message}") + return locations = LocationController.get_all() @@ -350,6 +360,7 @@ class WorkerThread(QThread): except Exception as e: print(f'the error is: {e}') self.sync_output.emit([], [], False, False, [], []) + self.sync_error.emit(f"Sync failed: {e}") def get_connection(self): connection = ConfigurationController.get_connection()