Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions dodo/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,13 @@
from embedded image tags or iframes. If set to True, Dodo will not allow these requests.
"""

html_block_remote_requests_trusted_hosts = []
"""A list of trusted hosts for HTML remote requests.

Dodo will let any request to those hosts through, even if
:func:`~dodo.settings.html_block_remote_requests` is True.
"""

html_confirm_open_links = True
"""Display a confirmation dialog before opening a link in browser

Expand Down
9 changes: 7 additions & 2 deletions dodo/thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,13 @@ def requestStarted(self, request: QWebEngineUrlRequestJob) -> None:

class RemoteBlockingUrlRequestInterceptor(QWebEngineUrlRequestInterceptor):
def interceptRequest(self, info):
if info.requestUrl().scheme() not in app.LOCAL_PROTOCOLS:
info.block(settings.html_block_remote_requests)
url = info.requestUrl()
if url.scheme() not in app.LOCAL_PROTOCOLS:
trusted_hosts = settings.html_block_remote_requests_trusted_hosts
info.block(
settings.html_block_remote_requests
and url.host() not in trusted_hosts
)

RE_REGEX = re.compile(r'^R[Ee]: ')
class ThreadItem:
Expand Down