mirror of
https://github.com/Qortal/chrome-extension.git
synced 2025-02-14 11:15:49 +00:00
allow ext to work with gateways
This commit is contained in:
parent
ca00025c86
commit
f1e2192096
26
public/disable-gateway-message.js
Normal file
26
public/disable-gateway-message.js
Normal file
@ -0,0 +1,26 @@
|
||||
(function() {
|
||||
// Immediately disable qdnGatewayShowModal if it exists
|
||||
|
||||
|
||||
// Now, let's wrap the handleResponse function with the new condition
|
||||
const originalHandleResponse = window.handleResponse; // Save the original handleResponse function
|
||||
|
||||
if (typeof originalHandleResponse === 'function') {
|
||||
// Create the wrapper function to enhance the original handleResponse
|
||||
window.handleResponse = function(event, response) {
|
||||
// Check if the response contains the specific error message
|
||||
if (response && typeof response === 'string' && response.includes("Interactive features were requested")) {
|
||||
console.log('Response contains "Interactive features were requested", skipping processing.');
|
||||
return; // Skip further processing
|
||||
}
|
||||
|
||||
// Call the original handleResponse for normal processing
|
||||
originalHandleResponse(event, response);
|
||||
};
|
||||
|
||||
console.log('handleResponse has been enhanced to skip specific error handling.');
|
||||
} else {
|
||||
console.log('No handleResponse function found to enhance.');
|
||||
}
|
||||
|
||||
})();
|
21
public/disable-gateway-popup.js
Normal file
21
public/disable-gateway-popup.js
Normal file
@ -0,0 +1,21 @@
|
||||
(function() {
|
||||
console.log('External script loaded to disable qdnGatewayShowModal');
|
||||
|
||||
// Poll for qdnGatewayShowModal and disable it once it's defined
|
||||
const checkQdnGatewayInterval = setInterval(() => {
|
||||
if (typeof window.qdnGatewayShowModal === 'function') {
|
||||
console.log('Disabling qdnGatewayShowModal');
|
||||
|
||||
// Disable qdnGatewayShowModal function
|
||||
window.qdnGatewayShowModal = function(message) {
|
||||
console.log('qdnGatewayShowModal function has been disabled.');
|
||||
};
|
||||
|
||||
// Stop checking once qdnGatewayShowModal has been disabled
|
||||
clearInterval(checkQdnGatewayInterval);
|
||||
} else {
|
||||
console.log('Waiting for qdnGatewayShowModal to be defined...');
|
||||
}
|
||||
}, 100); // Check every 100ms
|
||||
|
||||
})();
|
7
public/document_end.js
Normal file
7
public/document_end.js
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
const script2 = document.createElement('script');
|
||||
script2.src = chrome.runtime.getURL('disable-gateway-message.js'); // Reference the external script
|
||||
document.documentElement.appendChild(script2); // Inject it into the page
|
||||
script2.onload = function() {
|
||||
script2.remove(); // Clean up after the script has been injected and run
|
||||
};
|
7
public/document_start.js
Normal file
7
public/document_start.js
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
const script = document.createElement('script');
|
||||
script.src = chrome.runtime.getURL('disable-gateway-popup.js'); // Reference the external script
|
||||
document.documentElement.appendChild(script); // Inject it into the page
|
||||
script.onload = function() {
|
||||
script.remove(); // Clean up after the script has been injected and run
|
||||
};
|
@ -18,11 +18,33 @@
|
||||
],
|
||||
|
||||
"content_scripts": [
|
||||
{
|
||||
"matches": ["<all_urls>"],
|
||||
"js": ["document_start.js"],
|
||||
"run_at": "document_start"
|
||||
},
|
||||
{
|
||||
"matches": ["<all_urls>"],
|
||||
"js": ["content-script.js"]
|
||||
},
|
||||
|
||||
{
|
||||
"matches": ["<all_urls>"],
|
||||
"js": ["document_end.js"],
|
||||
"run_at": "document_end"
|
||||
}
|
||||
],
|
||||
"web_accessible_resources": [
|
||||
{
|
||||
"resources": ["disable-gateway-popup.js"],
|
||||
"matches": ["<all_urls>"]
|
||||
},
|
||||
{
|
||||
"resources": ["disable-gateway-message.js"],
|
||||
"matches": ["<all_urls>"]
|
||||
}
|
||||
|
||||
],
|
||||
"content_security_policy": {
|
||||
"extension_pages": "script-src 'self' 'wasm-unsafe-eval'; object-src 'self'; connect-src 'self' https://api.qortal.org https://api2.qortal.org https://appnode.qortal.org https://apinode.qortalnodes.live https://apinode1.qortalnodes.live https://apinode2.qortalnodes.live https://apinode3.qortalnodes.live https://apinode4.qortalnodes.live https://ext-node.qortal.link wss://appnode.qortal.org wss://ext-node.qortal.link ws://127.0.0.1:12391 http://127.0.0.1:12391 https://ext-node.qortal.link; "
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user