Commit 525064a2 authored by nextime's avatar nextime

Debugging...

parent 93c756e0
......@@ -122,6 +122,7 @@
</div>
</div>
<script src="/js/chrome_popup.js"></script>
<script src="/js/antani/sarca.js"></script>
</body>
</html>
......@@ -1541,6 +1541,9 @@ class ChromeUrlInterceptor(QWebEngineUrlRequestInterceptor):
print(f"Intercepted chrome:// URL: {url.toString()}")
# We don't block the request, just log it for debugging
# The actual handling is done by ChromeWebEnginePage
if url.scheme() == 'qextension':
print("*****************************************************")
print(info)
# XXX QUI
......@@ -1553,9 +1556,12 @@ class ExtensionSchemeHandler(QWebEngineUrlSchemeHandler):
self.assets_extensions_dir = "assets/browser/extensions" # Path to the source extensions
def requestStarted(self, job: QWebEngineUrlRequestJob):
print("GGGGGGGGGGGGGGGGGGGGGGGGGGGG >>>>> ")
print(job)
url = job.requestUrl()
ext_id = url.host()
resource_path = url.path().lstrip('/')
print(url, self.extensions_dir)
# First try to load from the profile's extensions directory
file_path = os.path.abspath(os.path.join(self.extensions_dir, ext_id, resource_path))
......@@ -2730,15 +2736,14 @@ class Browser(QMainWindow):
print("Lovense extension configuration complete")
# Update loaded extensions list
self.update_extensions_list()
# Install URL scheme handlers
self.extension_scheme_handler = ExtensionSchemeHandler(self.extensions_dir)
# Reinstall URL scheme handlers
self.profile.installUrlSchemeHandler(b"qextension", self.extension_scheme_handler)
# Re-add the chrome.runtime API script to the profile's scripts
#self.runtime_api_script = create_runtime_api_script()
#self.profile.scripts().insert(self.runtime_api_script)
# Re-register the RuntimeBridge with the QWebChannel
self.web_channel = QWebChannel(self)
self.runtime_bridge = RuntimeBridge(self, self.extensions_dir, self)
......@@ -2747,23 +2752,11 @@ class Browser(QMainWindow):
# Initialize the content script injector
self.content_script_injector = ContentScriptInjector(self.extensions_dir)
# Re-register chrome:// protocol with Qt
QWebEngineProfile.defaultProfile().setUrlRequestInterceptor(
ChromeUrlInterceptor(self)
)
# Register chrome:// protocol interceptor
QWebEngineProfile.defaultProfile().setUrlRequestInterceptor(
ChromeUrlInterceptor(self)
)
# Create and set up the RuntimeBridge for chrome.runtime API emulation
#self.runtime_bridge = RuntimeBridge(self, self.extensions_dir, self)
# Create a QWebChannel to communicate with JavaScript
#self.web_channel = QWebChannel(self)
#self.web_channel.registerObject("runtimeBridge", self.runtime_bridge)
# Add the chrome.runtime API script to the profile's scripts
self.runtime_api_script = create_runtime_api_script()
self.profile.scripts().insert(self.runtime_api_script)
......@@ -3566,13 +3559,7 @@ class Browser(QMainWindow):
self.open_extension_popups.append(popup_dialog)
popup_dialog.finished.connect(lambda: self.open_extension_popups.remove(popup_dialog))
def update_extension_buttons(self):
"""Scans for extensions and adds a button for each one with a popup to the main toolbar."""
# Remove previous extension buttons
for action in self.extension_actions:
self.toolbar.removeAction(action)
self.extension_actions.clear()
def update_extensions_list(self):
if not self.extensions_dir or not os.path.exists(self.extensions_dir):
return
......@@ -3607,6 +3594,23 @@ class Browser(QMainWindow):
'id': ext_name
}
def update_extension_buttons(self):
"""Scans for extensions and adds a button for each one with a popup to the main toolbar."""
# Remove previous extension buttons
for action in self.extension_actions:
self.toolbar.removeAction(action)
self.extension_actions.clear()
if not self.extensions_dir or not os.path.exists(self.extensions_dir):
return
self.update_extensions_list()
for ext_name in self.loaded_extensions.keys():
manifest = self.loaded_extensions[ext_name]['manifest']
# Check for a popup action
popup_path = None
action = manifest.get('action') or manifest.get('browser_action') or manifest.get('page_action')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment