Add button to manually add blacklisted post URLs

Supports pasting multiple URLs at once (space or newline separated).
This commit is contained in:
pax 2026-04-05 02:54:28 -05:00
parent 781f03e85b
commit 558c07877b

View File

@ -254,6 +254,10 @@ class SettingsDialog(QDialog):
layout.addWidget(self._bl_post_list)
bl_post_row = QHBoxLayout()
add_post_btn = QPushButton("Add...")
add_post_btn.clicked.connect(self._bl_add_post)
bl_post_row.addWidget(add_post_btn)
remove_post_btn = QPushButton("Remove Selected")
remove_post_btn.clicked.connect(self._bl_remove_post)
bl_post_row.addWidget(remove_post_btn)
@ -265,6 +269,20 @@ class SettingsDialog(QDialog):
layout.addLayout(bl_post_row)
return w
def _bl_add_post(self) -> None:
from PySide6.QtWidgets import QInputDialog
text, ok = QInputDialog.getMultiLineText(
self, "Add Blacklisted Posts",
"Paste URLs (one per line or space-separated):",
)
if ok and text.strip():
urls = text.replace("\n", " ").split()
for url in urls:
url = url.strip()
if url:
self._db.add_blacklisted_post(url)
self._bl_post_list.addItem(url)
def _bl_remove_post(self) -> None:
item = self._bl_post_list.currentItem()
if item: