This repository has been archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: inaccessible under scuttling mode (#308)
- Loading branch information
Showing
4 changed files
with
29 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import path from "path"; | ||
import { readFileSync, writeFileSync } from "fs"; | ||
|
||
export const disableScuttleGlobalThis = (metaMaskPath: string): void => { | ||
const runtimeLavaMoatPath = path.resolve(metaMaskPath, "runtime-lavamoat.js"); | ||
|
||
const file = readFileSync(runtimeLavaMoatPath, "utf8"); | ||
const patchedFile = file.replace( | ||
`"scuttleGlobalThis":true`, | ||
`"scuttleGlobalThis":false` | ||
); | ||
writeFileSync(runtimeLavaMoatPath, patchedFile); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { addKeyToMetaMaskManifest } from "./addKeyToMetaMaskManifest"; | ||
import { disableScuttleGlobalThis } from "./disableScuttleGlobalThis"; | ||
|
||
interface PatchOptions { | ||
key: string; | ||
} | ||
|
||
export const patchMetaMask = ( | ||
metamaskPath: string, | ||
options: PatchOptions | ||
): void => { | ||
addKeyToMetaMaskManifest(metamaskPath, options.key); | ||
disableScuttleGlobalThis(metamaskPath); | ||
}; |