summaryrefslogtreecommitdiff
path: root/qutebrowser
diff options
context:
space:
mode:
authorAnder Punnar <ander@kvlt.ee>2021-07-19 20:38:27 +0300
committerAnder Punnar <ander@kvlt.ee>2021-07-19 20:38:27 +0300
commit38ec7f61c854bb1c89cd7aadcc93eff87cc70dd6 (patch)
treeff3bfa0232872d330513d4bc111dce0830f4e0ad /qutebrowser
parent5b0365ddeefbd0fba443f5c152f5efa0a393dbec (diff)
downloadqutebrowser-38ec7f61c854bb1c89cd7aadcc93eff87cc70dd6.tar.gz
qutebrowser-38ec7f61c854bb1c89cd7aadcc93eff87cc70dd6.zip
make blocking subdomains configurable
Diffstat (limited to 'qutebrowser')
-rw-r--r--qutebrowser/components/hostblock.py13
-rw-r--r--qutebrowser/config/configdata.yml5
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: