added new debug flow

This commit is contained in:
John 2025-09-19 21:45:48 +01:00
parent 9caaf6abcf
commit 5eead2258d
8 changed files with 135 additions and 102 deletions

View file

@ -4808,24 +4808,8 @@ class Settings(Page):
scroll_layout = QVBoxLayout(scroll_content) scroll_layout = QVBoxLayout(scroll_content)
scroll_layout.setSpacing(15) scroll_layout.setSpacing(15)
app_path = sys.executable if hasattr(sys, 'frozen') else os.path.abspath(__file__) profile_selection_group = QGroupBox("Profile Selection")
if hasattr(sys, 'frozen'): profile_selection_group.setStyleSheet(f"""
app_dir = os.path.dirname(app_path)
else:
app_dir = os.path.dirname(os.path.dirname(app_path))
app_path_label = QLabel(f"Application Path: {app_path}")
app_path_label.setStyleSheet(f"color: white; font-size: 14px; {self.font_style}")
app_path_label.setWordWrap(True)
scroll_layout.addWidget(app_path_label)
app_dir_label = QLabel(f"Application Directory: {app_dir}")
app_dir_label.setStyleSheet(f"color: white; font-size: 14px; {self.font_style}")
app_dir_label.setWordWrap(True)
scroll_layout.addWidget(app_dir_label)
command_group = QGroupBox("CLI Commands")
command_group.setStyleSheet(f"""
QGroupBox {{ QGroupBox {{
color: white; color: white;
font-weight: bold; font-weight: bold;
@ -4842,98 +4826,44 @@ class Settings(Page):
padding: 0 5px; padding: 0 5px;
}} }}
""") """)
command_layout = QVBoxLayout(command_group) profile_selection_layout = QVBoxLayout(profile_selection_group)
self.cli_command = QLineEdit()
self.cli_command.setReadOnly(True)
self.cli_command.setText(f"{app_path} --cli profile enable -i 1")
self.cli_command.setStyleSheet(f"""
QLineEdit {{
color: white;
background: rgba(255, 255, 255, 0.1);
border: 1px solid rgba(255, 255, 255, 0.2);
border-radius: 4px;
padding: 8px;
font-family: 'Courier New', monospace;
font-size: 12px;
}}
""")
command_layout.addWidget(self.cli_command)
copy_button = QPushButton("Copy Command")
copy_button.setFixedSize(120, 40)
copy_button.setStyleSheet(f"""
QPushButton {{
font-size: 12px;
background: #007AFF;
color: white;
border: none;
border-radius: 5px;
font-weight: bold;
{self.font_style}
}}
QPushButton:hover {{
background: #0056CC;
}}
""")
copy_button.clicked.connect(self.copy_cli_command)
command_layout.addWidget(copy_button)
execute_button = QPushButton("Execute Command")
execute_button.setFixedSize(120, 40)
execute_button.setStyleSheet(f"""
QPushButton {{
font-size: 10px;
background: #4CAF50;
color: white;
border: none;
border-radius: 5px;
font-weight: bold;
{self.font_style}
}}
QPushButton:hover {{
background: #45a049;
}}
""")
execute_button.clicked.connect(self.execute_cli_command)
command_layout.addWidget(execute_button)
scroll_layout.addWidget(command_group)
debug_helper_group = QGroupBox("Debug Helper")
debug_helper_group.setStyleSheet(f"""
QGroupBox {{
color: white;
font-weight: bold;
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 8px;
padding: 15px;
font-size: 10px;
margin-top: 15px;
{self.font_style}
}}
QGroupBox::title {{
subcontrol-origin: margin;
left: 10px;
padding: 0 5px;
}}
""")
debug_helper_layout = QVBoxLayout(debug_helper_group)
profile_label = QLabel("Select System-wide Profile:") profile_label = QLabel("Select System-wide Profile:")
profile_label.setStyleSheet(f"color: white; font-size: 12px; {self.font_style}") profile_label.setStyleSheet(f"color: white; font-size: 12px; {self.font_style}")
debug_helper_layout.addWidget(profile_label) profile_selection_layout.addWidget(profile_label)
self.debug_profile_selector = QComboBox() self.debug_profile_selector = QComboBox()
self.debug_profile_selector.setStyleSheet(self.get_combobox_style()) self.debug_profile_selector.setStyleSheet(self.get_combobox_style())
self.debug_profile_selector.currentTextChanged.connect(self.on_debug_profile_selected) self.debug_profile_selector.currentTextChanged.connect(self.on_debug_profile_selected)
debug_helper_layout.addWidget(self.debug_profile_selector) profile_selection_layout.addWidget(self.debug_profile_selector)
scroll_layout.addWidget(profile_selection_group)
ping_group = QGroupBox("Ping Test")
ping_group.setStyleSheet(f"""
QGroupBox {{
color: white;
font-weight: bold;
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 8px;
padding: 15px;
font-size: 10px;
margin-top: 15px;
{self.font_style}
}}
QGroupBox::title {{
subcontrol-origin: margin;
left: 10px;
padding: 0 5px;
}}
""")
ping_layout = QVBoxLayout(ping_group)
self.ping_instruction_label = QLabel("") self.ping_instruction_label = QLabel("")
self.ping_instruction_label.setStyleSheet(f"color: white; font-size: 12px; {self.font_style}") self.ping_instruction_label.setStyleSheet(f"color: white; font-size: 12px; {self.font_style}")
self.ping_instruction_label.setWordWrap(True) self.ping_instruction_label.setWordWrap(True)
self.ping_instruction_label.hide() self.ping_instruction_label.hide()
debug_helper_layout.addWidget(self.ping_instruction_label) ping_layout.addWidget(self.ping_instruction_label)
ping_buttons_layout = QHBoxLayout() ping_buttons_layout = QHBoxLayout()
@ -4983,15 +4913,108 @@ class Settings(Page):
self.test_ping_button.setEnabled(False) self.test_ping_button.setEnabled(False)
ping_buttons_layout.addWidget(self.test_ping_button) ping_buttons_layout.addWidget(self.test_ping_button)
debug_helper_layout.addLayout(ping_buttons_layout) ping_layout.addLayout(ping_buttons_layout)
self.ping_result_label = QLabel("") self.ping_result_label = QLabel("")
self.ping_result_label.setStyleSheet(f"color: white; font-size: 12px; font-weight: bold; {self.font_style}") self.ping_result_label.setStyleSheet(f"color: white; font-size: 12px; font-weight: bold; {self.font_style}")
self.ping_result_label.setWordWrap(True) self.ping_result_label.setWordWrap(True)
self.ping_result_label.hide() self.ping_result_label.hide()
debug_helper_layout.addWidget(self.ping_result_label) ping_layout.addWidget(self.ping_result_label)
scroll_layout.addWidget(debug_helper_group) scroll_layout.addWidget(ping_group)
app_path = sys.executable if hasattr(sys, 'frozen') else os.path.abspath(__file__)
if hasattr(sys, 'frozen'):
app_dir = os.path.dirname(app_path)
else:
app_dir = os.path.dirname(os.path.dirname(app_path))
command_group = QGroupBox("CLI Commands")
command_group.setStyleSheet(f"""
QGroupBox {{
color: white;
font-weight: bold;
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 8px;
padding: 15px;
font-size: 10px;
margin-top: 15px;
{self.font_style}
}}
QGroupBox::title {{
subcontrol-origin: margin;
left: 10px;
padding: 0 5px;
}}
""")
command_layout = QVBoxLayout(command_group)
self.cli_command = QLineEdit()
self.cli_command.setReadOnly(True)
self.cli_command.setText("Select a profile above to see command")
self.cli_command.setStyleSheet(f"""
QLineEdit {{
color: white;
background: rgba(255, 255, 255, 0.1);
border: 1px solid rgba(255, 255, 255, 0.2);
border-radius: 4px;
padding: 8px;
font-family: 'Courier New', monospace;
font-size: 12px;
}}
""")
command_layout.addWidget(self.cli_command)
copy_button = QPushButton("Copy Command")
copy_button.setFixedSize(120, 40)
copy_button.setStyleSheet(f"""
QPushButton {{
font-size: 12px;
background: #007AFF;
color: white;
border: none;
border-radius: 5px;
font-weight: bold;
{self.font_style}
}}
QPushButton:hover {{
background: #0056CC;
}}
QPushButton:disabled {{
background: #666666;
}}
""")
copy_button.clicked.connect(self.copy_cli_command)
copy_button.setEnabled(False)
command_layout.addWidget(copy_button)
execute_button = QPushButton("Execute Command")
execute_button.setFixedSize(120, 40)
execute_button.setStyleSheet(f"""
QPushButton {{
font-size: 10px;
background: #4CAF50;
color: white;
border: none;
border-radius: 5px;
font-weight: bold;
{self.font_style}
}}
QPushButton:hover {{
background: #45a049;
}}
QPushButton:disabled {{
background: #666666;
}}
""")
execute_button.clicked.connect(self.execute_cli_command)
execute_button.setEnabled(False)
command_layout.addWidget(execute_button)
scroll_layout.addWidget(command_group)
self.cli_copy_button = copy_button
self.cli_execute_button = execute_button
wg_quick_group = QGroupBox("Direct Systemwide Wireguard") wg_quick_group = QGroupBox("Direct Systemwide Wireguard")
wg_quick_group.setStyleSheet(f""" wg_quick_group.setStyleSheet(f"""
@ -5138,6 +5161,9 @@ class Settings(Page):
self.copy_ping_button.setEnabled(False) self.copy_ping_button.setEnabled(False)
self.test_ping_button.setEnabled(False) self.test_ping_button.setEnabled(False)
self.ping_result_label.hide() self.ping_result_label.hide()
self.cli_command.setText("Select a profile above to see command")
self.cli_copy_button.setEnabled(False)
self.cli_execute_button.setEnabled(False)
if hasattr(self, 'wg_quick_up_command_widget'): if hasattr(self, 'wg_quick_up_command_widget'):
self.wg_quick_up_command_widget.setText("Select a profile above to see commands") self.wg_quick_up_command_widget.setText("Select a profile above to see commands")
self.wg_quick_down_command_widget.setText("Select a profile above to see commands") self.wg_quick_down_command_widget.setText("Select a profile above to see commands")
@ -5155,7 +5181,11 @@ class Settings(Page):
self.test_ping_button.setEnabled(True) self.test_ping_button.setEnabled(True)
self.ping_result_label.hide() self.ping_result_label.hide()
# Update wg-quick commands with the selected profile ID app_path = sys.executable if hasattr(sys, 'frozen') else os.path.abspath(__file__)
self.cli_command.setText(f"{app_path} --cli profile enable -i {profile_id}")
self.cli_copy_button.setEnabled(True)
self.cli_execute_button.setEnabled(True)
if hasattr(self, 'wg_quick_up_command_widget'): if hasattr(self, 'wg_quick_up_command_widget'):
self.wg_quick_up_command_widget.setText(f"sudo wg-quick up '/etc/hydra-veil/profiles/{profile_id}/wg.conf'") self.wg_quick_up_command_widget.setText(f"sudo wg-quick up '/etc/hydra-veil/profiles/{profile_id}/wg.conf'")
self.wg_quick_down_command_widget.setText(f"sudo wg-quick down '/etc/hydra-veil/profiles/{profile_id}/wg.conf'") self.wg_quick_down_command_widget.setText(f"sudo wg-quick down '/etc/hydra-veil/profiles/{profile_id}/wg.conf'")
@ -5167,6 +5197,9 @@ class Settings(Page):
self.copy_ping_button.setEnabled(False) self.copy_ping_button.setEnabled(False)
self.test_ping_button.setEnabled(False) self.test_ping_button.setEnabled(False)
self.ping_result_label.hide() self.ping_result_label.hide()
self.cli_command.setText("Could not load profile configuration")
self.cli_copy_button.setEnabled(False)
self.cli_execute_button.setEnabled(False)
if hasattr(self, 'wg_quick_up_command_widget'): if hasattr(self, 'wg_quick_up_command_widget'):
self.wg_quick_up_command_widget.setText("Could not load profile configuration") self.wg_quick_up_command_widget.setText("Could not load profile configuration")
self.wg_quick_down_command_widget.setText("Could not load profile configuration") self.wg_quick_down_command_widget.setText("Could not load profile configuration")

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

View file

Before

Width:  |  Height:  |  Size: 162 KiB

After

Width:  |  Height:  |  Size: 162 KiB

View file

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

View file

Before

Width:  |  Height:  |  Size: 94 KiB

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 132 KiB

View file

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 118 KiB