mirror of
https://github.com/andrei0x309/clear-wallet.git
synced 2024-11-18 23:41:10 +00:00
changes: for 1.2.3
This commit is contained in:
parent
a74e4a5814
commit
efca3756d1
@ -1,5 +1,11 @@
|
||||
# Changelog
|
||||
|
||||
## Manifest Version 1.2.3
|
||||
|
||||
- injected stub with chrome feature available in chrome 103 ( register world ) to bypass CSP
|
||||
- clear up some console errors
|
||||
- pushed minimum version to 103
|
||||
|
||||
## Manifest Version 1.2.2
|
||||
|
||||
- updated dependencies
|
||||
|
@ -1,21 +1,6 @@
|
||||
|
||||
(() =>{
|
||||
try {
|
||||
// sha256-QANFAnmGYlNymbZUT9oHee/3HE1z/X5Qcngml3GzhVY=
|
||||
const metamaskStub = `
|
||||
// Add MetamaskAPI STUB for wallets lib to detect wallet exists
|
||||
window.ethereum = {
|
||||
isMetaMask: true,
|
||||
isConnected: () => true,
|
||||
request: (a,b,c) => window.ethereum.request(a,b,c),
|
||||
sendAsync: (a,b,c) => window.ethereum.sendAsync(a,b,c),
|
||||
send: (a,b,c) => window.ethereum.send(a,b,c),
|
||||
}
|
||||
|
||||
`;
|
||||
document.documentElement.setAttribute('onreset', metamaskStub);
|
||||
document.documentElement.dispatchEvent(new CustomEvent('reset'));
|
||||
document.documentElement.removeAttribute('onreset');
|
||||
const container = document.documentElement;
|
||||
const script = document.createElement('script');
|
||||
script.setAttribute('async', "false")
|
||||
@ -26,9 +11,6 @@
|
||||
} catch (error) {
|
||||
console.error('MetaMask: Provider injection failed.', error);
|
||||
}
|
||||
chrome.runtime.connect({
|
||||
name: 'content'
|
||||
})
|
||||
})()
|
||||
|
||||
const allowedMethods = {
|
||||
|
@ -20,7 +20,7 @@
|
||||
"128": "assets/extension-icon/wallet_128.png"
|
||||
}
|
||||
},
|
||||
"minimum_chrome_version": "94",
|
||||
"minimum_chrome_version": "103",
|
||||
"permissions": [
|
||||
"notifications",
|
||||
"storage",
|
||||
@ -45,6 +45,16 @@
|
||||
"all_frames": true,
|
||||
"run_at": "document_start",
|
||||
"js": ["/src/extension/content.ts"]
|
||||
},
|
||||
{
|
||||
"matches": [
|
||||
"http://*/*",
|
||||
"https://*/*"
|
||||
],
|
||||
"all_frames": true,
|
||||
"run_at": "document_start",
|
||||
"js": ["/src/extension/metamask-stub.js"],
|
||||
"world": "MAIN"
|
||||
}
|
||||
],
|
||||
"web_accessible_resources": [{
|
||||
|
11
src/extension/metamask-stub.js
Normal file
11
src/extension/metamask-stub.js
Normal file
@ -0,0 +1,11 @@
|
||||
try {
|
||||
window.ethereum = {
|
||||
isMetaMask: true,
|
||||
isConnected: () => true,
|
||||
request: (a,b,c) => window.ethereum.request(a,b,c),
|
||||
sendAsync: (a,b,c) => window.ethereum.sendAsync(a,b,c),
|
||||
send: (a,b,c) => window.ethereum.send(a,b,c),
|
||||
}
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
@ -10,23 +10,20 @@ let notificationUrl: string
|
||||
|
||||
chrome.runtime.onInstalled.addListener(() => {
|
||||
console.log('Service worker installed');
|
||||
|
||||
chrome.runtime.onConnect.addListener(port => port.onDisconnect.addListener(() =>
|
||||
{
|
||||
console.log('Service worker connected');
|
||||
}))
|
||||
|
||||
chrome.runtime.connect(null as unknown as string, {
|
||||
name:'sw-connection'
|
||||
})
|
||||
})
|
||||
|
||||
chrome.runtime.onStartup.addListener(() => {
|
||||
console.log('Service worker startup');
|
||||
if(chrome.runtime.lastError) {
|
||||
console.warn("Whoops.. " + chrome.runtime.lastError.message);
|
||||
}
|
||||
})
|
||||
|
||||
chrome.runtime.onSuspend.addListener(() => {
|
||||
console.log('Service worker suspend');
|
||||
if(chrome.runtime.lastError) {
|
||||
console.warn("Whoops.. " + chrome.runtime.lastError.message);
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user