update: new display for hysteria and vless protocols

This commit is contained in:
JOhn 2026-09-11 19:58:08 -04:00
parent a3cfc06630
commit 234a177689
3 changed files with 17 additions and 3 deletions

View file

@ -784,7 +784,6 @@ class MenuPage(Page):
profile_location = None profile_location = None
profile_operator = self._location_operator(profile_obj) profile_operator = self._location_operator(profile_obj)
operator_name = getattr(profile_operator, 'name', '') if profile_operator else "" 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': 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( verification_widget = self.create_verification_widget(
profile_obj) profile_obj)
@ -792,7 +791,7 @@ class MenuPage(Page):
show_verification_widget = True show_verification_widget = True
label_principal = None 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): if isinstance(profile_obj, SessionProfile):
text_color = "black" text_color = "black"
label_background = QLabel(self) label_background = QLabel(self)
@ -1343,6 +1342,8 @@ class MenuPage(Page):
lambda: self.handle_sync_after_verification(profile_id)) lambda: self.handle_sync_after_verification(profile_id))
self.worker_thread.sync_output.connect( self.worker_thread.sync_output.connect(
self.update_status.update_values) self.update_status.update_values)
self.worker_thread.sync_error.connect(
self.update_status.update_status)
self.worker_thread.start() self.worker_thread.start()
else: else:
self.update_status.update_status("Profile enable aborted") self.update_status.update_status("Profile enable aborted")

View file

@ -82,6 +82,8 @@ class SyncScreen(Page):
self.worker_thread = WorkerThread('SYNC') self.worker_thread = WorkerThread('SYNC')
self.worker_thread.sync_output.connect(self.update_output) self.worker_thread.sync_output.connect(self.update_output)
self.worker_thread.sync_error.connect(
self.update_status.update_status)
self.worker_thread.start() self.worker_thread.start()
def update_output(self, available_locations, available_browsers, status, is_tor, locations, all_browsers): def update_output(self, available_locations, available_browsers, status, is_tor, locations, all_browsers):

View file

@ -8,6 +8,7 @@ from PyQt6.QtCore import QThread, pyqtSignal
from core.controllers.ApplicationVersionController import ApplicationVersionController from core.controllers.ApplicationVersionController import ApplicationVersionController
from core.controllers.ClientController import ClientController from core.controllers.ClientController import ClientController
from core.controllers.ConfigurationController import ConfigurationController, ConnectionChoice from core.controllers.ConfigurationController import ConfigurationController, ConnectionChoice
from core.Constants import Constants
from core.controllers.SyncController import new_sync from core.controllers.SyncController import new_sync
from core.controllers.InvoiceController import InvoiceController from core.controllers.InvoiceController import InvoiceController
@ -42,6 +43,7 @@ from gui.v2.infrastructure.setup_observers import (
class WorkerThread(QThread): class WorkerThread(QThread):
text_output = pyqtSignal(str) text_output = pyqtSignal(str)
sync_output = pyqtSignal(list, list, bool, bool, list, list) sync_output = pyqtSignal(list, list, bool, bool, list, list)
sync_error = pyqtSignal(str)
invoice_output = pyqtSignal(object, str) invoice_output = pyqtSignal(object, str)
invoice_finished = pyqtSignal(bool) invoice_finished = pyqtSignal(bool)
profiles_output = pyqtSignal(dict) profiles_output = pyqtSignal(dict)
@ -334,7 +336,15 @@ class WorkerThread(QThread):
ConfigurationController.set_connection('tor') ConfigurationController.set_connection('tor')
else: else:
ConfigurationController.set_connection('system') 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() locations = LocationController.get_all()
@ -350,6 +360,7 @@ class WorkerThread(QThread):
except Exception as e: except Exception as e:
print(f'the error is: {e}') print(f'the error is: {e}')
self.sync_output.emit([], [], False, False, [], []) self.sync_output.emit([], [], False, False, [], [])
self.sync_error.emit(f"Sync failed: {e}")
def get_connection(self): def get_connection(self):
connection = ConfigurationController.get_connection() connection = ConfigurationController.get_connection()