Compare commits

...
1 Commits
Author SHA1 Message Date
Boria138 150afb2b4a feat: added exe network block
Signed-off-by: Boris Yumankulov <boria138@altlinux.org>
2026-11-15 19:45:54 +05:00
4 changed files with 53 additions and 9 deletions

No files matched your search

@@ -3797,6 +3797,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
local steam_emu_language=""
+5 -9
View File
@@ -363,12 +363,8 @@ class ExeSettingsDialog(
target.setFocus(Qt.FocusReason.OtherFocusReason)
def _clear_run_after_entries(self, target: QLineEdit) -> None:
table = self.advanced_table
for row in reversed(range(table.rowCount())):
item = table.item(row, 0)
if item and item.data(Qt.ItemDataRole.UserRole) == "run_after_entry":
table.removeRow(row)
target.setProperty("ppqt_run_after_expanded", False)
if target.property("ppqt_run_after_expanded"):
self._toggle_run_after_entries(target)
target.clear()
if target.isVisible():
target.setFocus(Qt.FocusReason.OtherFocusReason)
@@ -1059,7 +1055,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)
container_layout = QVBoxLayout(text_container)
@@ -1076,7 +1072,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=lambda path: path.lower().endswith(".exe") or os.access(path, os.X_OK),
@@ -1098,7 +1094,7 @@ class ExeSettingsDialog(
)
file_explorer.exec()
browse_button.clicked.connect(open_run_after_exe_selector)
browse_button.clicked.connect(open_setting_file_selector)
expand_button = AutoSizeButton("≡")
expand_button.setStyleSheet(self.theme.ACTION_BUTTON_STYLE)
expand_button.clicked.connect(
+9
View File
@@ -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',
+35
View File
@@ -1031,3 +1031,38 @@ def test_run_after_removing_only_entry_clears_field(tmp_path: Path) -> None:
assert target.text() == ""
assert owner.advanced_table.rowCount() == 2
owner.advanced_table.deleteLater()
@pytest.mark.parametrize("cleared_index", [0, 1])
def test_executable_lists_clear_independently(cleared_index: int) -> None:
from portprotonqt.dialogs.settings_dialog import ExeSettingsDialog
owner = cast(Any, QWidget())
owner.advanced_table = QTableWidget(2, 3)
owner.theme = SimpleNamespace(ACTION_BUTTON_STYLE="", LINE_EDIT_STYLE="")
owner._toggle_run_after_entries = lambda target: ExeSettingsDialog._toggle_run_after_entries(
cast(ExeSettingsDialog, owner), target
)
targets = []
for row, key in enumerate(("PW_RUN_AFTER_EXE", "PW_NETWORK_BLOCKLIST")):
container = QWidget()
target = QLineEdit(container)
target.setObjectName(key)
target.setText("Game.exe,Trainer.exe")
owner.advanced_table.setCellWidget(row, 1, container)
targets.append(target)
for target in targets:
owner._toggle_run_after_entries(target)
assert owner.advanced_table.rowCount() == 6
ExeSettingsDialog._clear_run_after_entries(cast(ExeSettingsDialog, owner), targets[cleared_index])
assert targets[cleared_index].text() == ""
assert not targets[cleared_index].property("ppqt_run_after_expanded")
remaining = targets[1 - cleared_index]
assert remaining.text() == "Game.exe,Trainer.exe"
assert remaining.property("ppqt_run_after_expanded")
assert owner.advanced_table.rowCount() == 4
owner._toggle_run_after_entries(remaining)
assert owner.advanced_table.rowCount() == 2
owner.advanced_table.deleteLater()