Skip to content

Commit cd7a895

Browse files
committed
Refactor WelcomeWebPage to restrict navigation to local files only and remove unused allowed_pages attribute
1 parent 46a1006 commit cd7a895

1 file changed

Lines changed: 1 addition & 12 deletions

File tree

activity_browser/layouts/pages/welcome.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ def __init__(self, parent=None):
2020

2121
self.url = QtCore.QUrl.fromLocalFile(self.html_file)
2222
self.page.setWebChannel(self.channel)
23-
self.page.allowed_pages.append(self.url)
2423
self.page.load(self.url)
2524

2625
# associate page with view
@@ -67,19 +66,9 @@ def open_project(self, project_name):
6766
actions.ProjectSwitch.run(project_name)
6867

6968
class WelcomeWebPage(QtWebEngineWidgets.QWebEnginePage):
70-
"""Filters links so that users cannot just navigate to any page on the web,
71-
but just to those pages, that are listed in allowed_pages.
72-
This is achieved by re-implementing acceptNavigationRequest.
73-
The latter could also be adapted to accept, e.g. URLs within a domain.
74-
"""
75-
76-
def __init__(self, parent=None):
77-
super().__init__(parent)
78-
self.allowed_pages = []
79-
8069
def acceptNavigationRequest(self, qurl, navtype, mainframe):
8170
# print("Navigation Request intercepted:", qurl)
82-
if qurl in self.allowed_pages: # open in Activity Browser QWebEngineView
71+
if qurl.isLocalFile(): # open in Activity Browser QWebEngineView
8372
return True
8473
else: # delegate link to default browser
8574
QtGui.QDesktopServices.openUrl(qurl)

0 commit comments

Comments
 (0)