From d1018019d2ed68daabee520194430151133a10b7 Mon Sep 17 00:00:00 2001 From: Boris Yumankulov Date: Fri, 31 Jul 2026 23:56:34 +0500 Subject: [PATCH] feat: added exe network block Signed-off-by: Boris Yumankulov --- build-aux/share/portproton/scripts/functions_helper | 4 ++++ portprotonqt/dialogs/settings_dialog.py | 6 +++--- portprotonqt/settings_manager.py | 9 +++++++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/build-aux/share/portproton/scripts/functions_helper b/build-aux/share/portproton/scripts/functions_helper index 91e1bffa..0f20abef 100755 --- a/build-aux/share/portproton/scripts/functions_helper +++ b/build-aux/share/portproton/scripts/functions_helper @@ -3754,6 +3754,10 @@ start_portproton () { *) get_and_set_reg_file --delete 'Software\Wine\Drivers' 'Audio' ;; esac + if [[ -n "${PW_NETWORK_BLOCKLIST:-}" ]] ; then + export PW_LD_PRELOAD="${PW_LD_PRELOAD:+${PW_LD_PRELOAD}:}libppqt-network-filter.so" + fi + add_in_start_portproton if [[ "$FULL_LN" == russian ]] ; then diff --git a/portprotonqt/dialogs/settings_dialog.py b/portprotonqt/dialogs/settings_dialog.py index 1d07bb68..ab2553b1 100644 --- a/portprotonqt/dialogs/settings_dialog.py +++ b/portprotonqt/dialogs/settings_dialog.py @@ -795,7 +795,7 @@ class ExeSettingsDialog( line_edit.setEnabled(False) line_edit.setStyleSheet(self.theme.SETTINGS_DISABLED_INPUT_STYLE) - if setting['key'] == 'PW_RUN_AFTER_EXE': + if setting['key'] in ('PW_RUN_AFTER_EXE', 'PW_NETWORK_BLOCKLIST'): text_container = QWidget() text_container.setProperty("ppqt_run_after_exe_widget", True) text_layout = QHBoxLayout(text_container) @@ -810,7 +810,7 @@ class ExeSettingsDialog( if is_blocked: browse_button.setEnabled(False) - def open_run_after_exe_selector( + def open_setting_file_selector( _checked: bool = False, target_line_edit=line_edit, file_filter="", @@ -832,7 +832,7 @@ class ExeSettingsDialog( ) file_explorer.exec() - browse_button.clicked.connect(open_run_after_exe_selector) + browse_button.clicked.connect(open_setting_file_selector) text_layout.addWidget(browse_button) self.advanced_table.setCellWidget(row, 1, text_container) else: diff --git a/portprotonqt/settings_manager.py b/portprotonqt/settings_manager.py index 73dfc3e6..71874e78 100644 --- a/portprotonqt/settings_manager.py +++ b/portprotonqt/settings_manager.py @@ -321,6 +321,14 @@ def get_advanced_settings(disabled_text, logical_core_options=None, locale_optio 'default': '' }) + advanced_settings.append({ + 'key': 'PW_NETWORK_BLOCKLIST', + 'name': _("Blocked Network Destinations"), + 'description': _("Comma-separated IP addresses, domains, wildcard patterns, or absolute paths to hosts files. Example: 192.0.2.1,example.com,*.ru,/home/user/hosts"), + 'type': 'text', + 'default': '' + }) + # 8. CPU cores limit advanced_settings.append({ 'key': 'PW_WINE_CPU_TOPOLOGY', @@ -405,6 +413,7 @@ ADVANCED_SETTING_KEYS = [ 'WINEDLLOVERRIDES', 'LAUNCH_PARAMETERS', 'PW_RUN_AFTER_EXE', + 'PW_NETWORK_BLOCKLIST', 'PW_WINE_CPU_TOPOLOGY', 'PW_MESA_GL_VERSION_OVERRIDE', 'PW_VKD3D_FEATURE_LEVEL', -- 2.54.0