Skip to content

Instantly share code, notes, and snippets.

@luisivan
Created March 14, 2017 09:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luisivan/80c45a5d3fddf73c23d527815c63609c to your computer and use it in GitHub Desktop.
Save luisivan/80c45a5d3fddf73c23d527815c63609c to your computer and use it in GitHub Desktop.
Serving MetaMask our the metamask:// Electron custom protocol
// distPath can greatly vary. Just point it to where you want to serve MetaMask's build files
protocol.registerFileProtocol('metamask', (req, cb) => {
const filePath = req.url.replace('metamask://app/', '')
const distPath = (process.defaultApp) ? `${url.resolve(__dirname, '.metamask')}/dist/chrome/${filePath}` : path.resolve(`${__dirname}/metamask/${filePath}`)
cb({ path: distPath })
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment