Refactor code structure for improved readability and maintainability

This commit is contained in:
claudi 2026-01-29 10:19:52 +01:00
parent 4581fd393c
commit db3799a643
3 changed files with 3 additions and 3 deletions

BIN
full_test.txt Normal file

Binary file not shown.

View file

@ -38,20 +38,20 @@ class RestrictedWebEngineView(QWebEngineView):
Args:
request: Navigation request to process
"""
url = request.url()
url = request.url
# If no restrictions, allow all URLs
if not self.allowed_urls:
return
# Check if URL matches whitelist
if self._is_url_allowed(url):
if self._is_url_allowed(url): # type: ignore[operator]
# Allow the navigation (default behavior)
return
# URL not whitelisted - open in system browser
request.reject()
QDesktopServices.openUrl(url)
QDesktopServices.openUrl(url) # type: ignore[operator]
def _is_url_allowed(self, url: QUrl) -> bool:
"""Check if a URL matches the whitelist.

BIN
test_output.txt Normal file

Binary file not shown.