diff options
author | Ander Punnar <ander@kvlt.ee> | 2021-07-19 20:38:27 +0300 |
---|---|---|
committer | Ander Punnar <ander@kvlt.ee> | 2021-07-19 20:38:27 +0300 |
commit | 38ec7f61c854bb1c89cd7aadcc93eff87cc70dd6 (patch) | |
tree | ff3bfa0232872d330513d4bc111dce0830f4e0ad /qutebrowser | |
parent | 5b0365ddeefbd0fba443f5c152f5efa0a393dbec (diff) | |
download | qutebrowser-38ec7f61c854bb1c89cd7aadcc93eff87cc70dd6.tar.gz qutebrowser-38ec7f61c854bb1c89cd7aadcc93eff87cc70dd6.zip |
make blocking subdomains configurable
Diffstat (limited to 'qutebrowser')
-rw-r--r-- | qutebrowser/components/hostblock.py | 13 | ||||
-rw-r--r-- | qutebrowser/config/configdata.yml | 5 |
2 files changed, 14 insertions, 4 deletions
diff --git a/qutebrowser/components/hostblock.py b/qutebrowser/components/hostblock.py index 2d6086245..3cdd47223 100644 --- a/qutebrowser/components/hostblock.py +++ b/qutebrowser/components/hostblock.py @@ -132,10 +132,15 @@ class HostBlocker: host = request_url.host() - return any( - hostname in self._blocked_hosts or hostname in self._config_blocked_hosts - for hostname in urlutils.widened_hostnames(host) - ) + if config.get("content.blocking.hosts.block_subdomains"): + return any( + hostname in self._blocked_hosts or hostname in self._config_blocked_hosts + for hostname in urlutils.widened_hostnames(host) + ) + else: + return ( + host in self._blocked_hosts or host in self._config_blocked_hosts + ) def filter_request(self, info: interceptor.Request) -> None: """Block the given request if necessary.""" diff --git a/qutebrowser/config/configdata.yml b/qutebrowser/config/configdata.yml index 76c4ce369..2f090cc06 100644 --- a/qutebrowser/config/configdata.yml +++ b/qutebrowser/config/configdata.yml @@ -747,6 +747,11 @@ content.blocking.hosts.lists: The file `~/.config/qutebrowser/blocked-hosts` is always read if it exists. +content.blocking.hosts.block_subdomains: + default: true + type: Bool + desc: Block subdomains of blocked hosts. + content.blocking.method: default: auto type: |