remove scripts

This commit is contained in:
PhilReact 2024-11-01 17:30:56 +02:00
parent 2ba7341e2b
commit f8f5eeb35b
5 changed files with 66 additions and 66 deletions

View File

@ -678,7 +678,6 @@ async function retrieveFileFromIndexedDB(fileId) {
async function deleteQortalFilesFromIndexedDB() {
try {
console.log("Opening IndexedDB for deleting files...");
const db = await openIndexedDB();
const transaction = db.transaction(["files"], "readwrite");
const objectStore = transaction.objectStore("files");
@ -800,7 +799,6 @@ async function storeFilesInIndexedDB(obj) {
const UIQortalRequests = ['GET_USER_ACCOUNT', 'DECRYPT_DATA', 'SEND_COIN', 'GET_LIST_ITEMS', 'ADD_LIST_ITEMS', 'DELETE_LIST_ITEM', 'VOTE_ON_POLL', 'CREATE_POLL', 'SEND_CHAT_MESSAGE', 'JOIN_GROUP', 'DEPLOY_AT', 'GET_USER_WALLET', 'GET_WALLET_BALANCE', 'GET_USER_WALLET_INFO', 'GET_CROSSCHAIN_SERVER_INFO', 'GET_TX_ACTIVITY_SUMMARY', 'GET_FOREIGN_FEE', 'UPDATE_FOREIGN_FEE', 'GET_SERVER_CONNECTION_HISTORY', 'SET_CURRENT_FOREIGN_SERVER', 'ADD_FOREIGN_SERVER', 'REMOVE_FOREIGN_SERVER', 'GET_DAY_SUMMARY']
if (!window.hasAddedQortalListener) {
console.log("Listener added");
window.hasAddedQortalListener = true;
//qortalRequests
const listener = async (event) => {
@ -887,4 +885,25 @@ if (!window.hasAddedQortalListener) {
}
window.addEventListener("message", (event) => {
// Ensure the message is from the same page
if (event.source !== window || !event.data || event.data.type !== "qortalExtensionRequests") return;
// Extract the message detail
const { detail } = event.data;
// Forward the message to the background script and listen for a response
chrome?.runtime?.sendMessage({ action: "version" }, (response) => {
if (response.error) {
console.error("Error:", response.error);
} else {
// Include the requestId in the detail when dispatching the response
window.postMessage(
{ type: "qortalExtensionResponses", detail: { requestId: detail.requestId, data: response } },
"*"
);
}
});
});

View File

@ -1,26 +1,26 @@
(function() {
// Immediately disable qdnGatewayShowModal if it exists
// (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
// // 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
}
// 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);
};
// // 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.');
}
// console.log('handleResponse has been enhanced to skip specific error handling.');
// } else {
// console.log('No handleResponse function found to enhance.');
// }
})();
// })();

View File

@ -1,27 +1,28 @@
(function() {
console.log('External script loaded to disable qdnGatewayShowModal');
// (function() {
// console.log('External script loaded to disable qdnGatewayShowModal');
const timeoutDuration = 5000; // Set timeout duration to 5 seconds (5000ms)
let elapsedTime = 0; // Track the time that has passed
// const timeoutDuration = 5000; // Set timeout duration to 5 seconds (5000ms)
// let elapsedTime = 0; // Track the time that has passed
// Poll for qdnGatewayShowModal and disable it once it's defined
const checkQdnGatewayInterval = setInterval(() => {
elapsedTime += 100; // Increment elapsed time by the polling interval (100ms)
// // Poll for qdnGatewayShowModal and disable it once it's defined
// const checkQdnGatewayInterval = setInterval(() => {
// elapsedTime += 100; // Increment elapsed time by the polling interval (100ms)
if (typeof window.qdnGatewayShowModal === 'function') {
console.log('Disabling qdnGatewayShowModal');
// if (typeof window.qdnGatewayShowModal === 'function') {
// console.log('Disabling qdnGatewayShowModal');
// Disable qdnGatewayShowModal function
window.qdnGatewayShowModal = function(message) {
console.log('qdnGatewayShowModal function has been disabled.');
};
// // Disable qdnGatewayShowModal function
// window.qdnGatewayShowModal = function(message) {
// console.log('qdnGatewayShowModal function has been disabled.');
// };
// Stop checking once qdnGatewayShowModal has been disabled
clearInterval(checkQdnGatewayInterval);
} else if (elapsedTime >= timeoutDuration) {
console.log('Timeout reached, stopping polling for qdnGatewayShowModal.');
clearInterval(checkQdnGatewayInterval); // Stop checking after 5 seconds
}
}, 100); // Check every 100ms
// // Stop checking once qdnGatewayShowModal has been disabled
// clearInterval(checkQdnGatewayInterval);
// } else if (elapsedTime >= timeoutDuration) {
// console.log('Timeout reached, stopping polling for qdnGatewayShowModal.');
// clearInterval(checkQdnGatewayInterval); // Stop checking after 5 seconds
// }
// }, 100); // Check every 100ms
})();
// })();

View File

@ -1,4 +1,3 @@
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

View File

@ -18,33 +18,14 @@
],
"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://*:* http://*:* wss://*:* ws://*:*;"
}