mirror of
https://github.com/Qortal/chrome-extension.git
synced 2025-03-28 08:15:55 +00:00
remove scripts
This commit is contained in:
parent
2ba7341e2b
commit
f8f5eeb35b
@ -678,7 +678,6 @@ async function retrieveFileFromIndexedDB(fileId) {
|
|||||||
|
|
||||||
async function deleteQortalFilesFromIndexedDB() {
|
async function deleteQortalFilesFromIndexedDB() {
|
||||||
try {
|
try {
|
||||||
console.log("Opening IndexedDB for deleting files...");
|
|
||||||
const db = await openIndexedDB();
|
const db = await openIndexedDB();
|
||||||
const transaction = db.transaction(["files"], "readwrite");
|
const transaction = db.transaction(["files"], "readwrite");
|
||||||
const objectStore = transaction.objectStore("files");
|
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']
|
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) {
|
if (!window.hasAddedQortalListener) {
|
||||||
console.log("Listener added");
|
|
||||||
window.hasAddedQortalListener = true;
|
window.hasAddedQortalListener = true;
|
||||||
//qortalRequests
|
//qortalRequests
|
||||||
const listener = async (event) => {
|
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 } },
|
||||||
|
"*"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
@ -1,26 +1,26 @@
|
|||||||
(function() {
|
// (function() {
|
||||||
// Immediately disable qdnGatewayShowModal if it exists
|
// // Immediately disable qdnGatewayShowModal if it exists
|
||||||
|
|
||||||
|
|
||||||
// Now, let's wrap the handleResponse function with the new condition
|
// // Now, let's wrap the handleResponse function with the new condition
|
||||||
const originalHandleResponse = window.handleResponse; // Save the original handleResponse function
|
// const originalHandleResponse = window.handleResponse; // Save the original handleResponse function
|
||||||
|
|
||||||
if (typeof originalHandleResponse === 'function') {
|
// if (typeof originalHandleResponse === 'function') {
|
||||||
// Create the wrapper function to enhance the original handleResponse
|
// // Create the wrapper function to enhance the original handleResponse
|
||||||
window.handleResponse = function(event, response) {
|
// window.handleResponse = function(event, response) {
|
||||||
// Check if the response contains the specific error message
|
// // Check if the response contains the specific error message
|
||||||
if (response && typeof response === 'string' && response.includes("Interactive features were requested")) {
|
// if (response && typeof response === 'string' && response.includes("Interactive features were requested")) {
|
||||||
console.log('Response contains "Interactive features were requested", skipping processing.');
|
// console.log('Response contains "Interactive features were requested", skipping processing.');
|
||||||
return; // Skip further processing
|
// return; // Skip further processing
|
||||||
}
|
// }
|
||||||
|
|
||||||
// Call the original handleResponse for normal processing
|
// // Call the original handleResponse for normal processing
|
||||||
originalHandleResponse(event, response);
|
// originalHandleResponse(event, response);
|
||||||
};
|
// };
|
||||||
|
|
||||||
console.log('handleResponse has been enhanced to skip specific error handling.');
|
// console.log('handleResponse has been enhanced to skip specific error handling.');
|
||||||
} else {
|
// } else {
|
||||||
console.log('No handleResponse function found to enhance.');
|
// console.log('No handleResponse function found to enhance.');
|
||||||
}
|
// }
|
||||||
|
|
||||||
})();
|
// })();
|
||||||
|
@ -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)
|
// const timeoutDuration = 5000; // Set timeout duration to 5 seconds (5000ms)
|
||||||
let elapsedTime = 0; // Track the time that has passed
|
// let elapsedTime = 0; // Track the time that has passed
|
||||||
|
|
||||||
// Poll for qdnGatewayShowModal and disable it once it's defined
|
// // Poll for qdnGatewayShowModal and disable it once it's defined
|
||||||
const checkQdnGatewayInterval = setInterval(() => {
|
// const checkQdnGatewayInterval = setInterval(() => {
|
||||||
elapsedTime += 100; // Increment elapsed time by the polling interval (100ms)
|
// elapsedTime += 100; // Increment elapsed time by the polling interval (100ms)
|
||||||
|
|
||||||
if (typeof window.qdnGatewayShowModal === 'function') {
|
// if (typeof window.qdnGatewayShowModal === 'function') {
|
||||||
console.log('Disabling qdnGatewayShowModal');
|
// console.log('Disabling qdnGatewayShowModal');
|
||||||
|
|
||||||
// Disable qdnGatewayShowModal function
|
// // Disable qdnGatewayShowModal function
|
||||||
window.qdnGatewayShowModal = function(message) {
|
// window.qdnGatewayShowModal = function(message) {
|
||||||
console.log('qdnGatewayShowModal function has been disabled.');
|
// console.log('qdnGatewayShowModal function has been disabled.');
|
||||||
};
|
// };
|
||||||
|
|
||||||
// Stop checking once qdnGatewayShowModal has been disabled
|
// // Stop checking once qdnGatewayShowModal has been disabled
|
||||||
clearInterval(checkQdnGatewayInterval);
|
// clearInterval(checkQdnGatewayInterval);
|
||||||
} else if (elapsedTime >= timeoutDuration) {
|
// } else if (elapsedTime >= timeoutDuration) {
|
||||||
console.log('Timeout reached, stopping polling for qdnGatewayShowModal.');
|
// console.log('Timeout reached, stopping polling for qdnGatewayShowModal.');
|
||||||
clearInterval(checkQdnGatewayInterval); // Stop checking after 5 seconds
|
// clearInterval(checkQdnGatewayInterval); // Stop checking after 5 seconds
|
||||||
}
|
// }
|
||||||
}, 100); // Check every 100ms
|
// }, 100); // Check every 100ms
|
||||||
|
|
||||||
})();
|
// })();
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
const script = document.createElement('script');
|
const script = document.createElement('script');
|
||||||
script.src = chrome.runtime.getURL('disable-gateway-popup.js'); // Reference the external script
|
script.src = chrome.runtime.getURL('disable-gateway-popup.js'); // Reference the external script
|
||||||
document.documentElement.appendChild(script); // Inject it into the page
|
document.documentElement.appendChild(script); // Inject it into the page
|
||||||
|
@ -18,33 +18,14 @@
|
|||||||
],
|
],
|
||||||
|
|
||||||
"content_scripts": [
|
"content_scripts": [
|
||||||
{
|
|
||||||
"matches": ["<all_urls>"],
|
|
||||||
"js": ["document_start.js"],
|
|
||||||
"run_at": "document_start"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"matches": ["<all_urls>"],
|
"matches": ["<all_urls>"],
|
||||||
"js": ["content-script.js"]
|
"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": {
|
"content_security_policy": {
|
||||||
"extension_pages": "script-src 'self' 'wasm-unsafe-eval'; object-src 'self'; connect-src 'self' https://*:* http://*:* wss://*:* ws://*:*;"
|
"extension_pages": "script-src 'self' 'wasm-unsafe-eval'; object-src 'self'; connect-src 'self' https://*:* http://*:* wss://*:* ws://*:*;"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user