Skip to content

Warn when adding a domain that is already blocked#20

Open
TwDover wants to merge 1 commit into
linuxmint:masterfrom
TwDover:fix-duplicate-domain-warning
Open

Warn when adding a domain that is already blocked#20
TwDover wants to merge 1 commit into
linuxmint:masterfrom
TwDover:fix-duplicate-domain-warning

Conversation

@TwDover
Copy link
Copy Markdown

@TwDover TwDover commented May 2, 2026

Summary

  • Adds an is_domain_blocked() helper that walks the GTK tree model to check if a domain is already in the list
  • Before inserting, checks all variants that would be added (e.g. both example.com and www.example.com)
  • Shows an error dialog with a clear message if a duplicate is detected, preventing the same domain being written to /etc/hosts multiple times

Test plan

  • Add a domain (e.g. example.com) — should succeed as normal
  • Try adding the same domain again — should show "Already Blocked" error dialog instead of adding a duplicate
  • Try adding www.example.com after example.com is blocked — should also show the error
  • Remove the domain and re-add it — should succeed again

🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant