From 1a35f56beb221541379de2c6e866d14db45b629b Mon Sep 17 00:00:00 2001 From: Vern Zhang Date: Tue, 7 Feb 2023 23:58:25 +0800 Subject: [PATCH 01/24] feat: generate seed --- config/config.ts | 21 +- package-lock.json | 567 +++++++++++++++++- package.json | 2 + src/extension/background/bootstrap.ts | 15 + .../controller/wallet.controller.ts | 11 + src/extension/background/router.ts | 2 + .../background/service/wallet.service.ts | 14 + src/pages/Home/index.tsx | 82 ++- 8 files changed, 685 insertions(+), 29 deletions(-) create mode 100644 src/extension/background/controller/wallet.controller.ts create mode 100644 src/extension/background/service/wallet.service.ts diff --git a/config/config.ts b/config/config.ts index ba293ef..d0f29b7 100644 --- a/config/config.ts +++ b/config/config.ts @@ -1,9 +1,9 @@ import { defineConfig } from '@umijs/max' -// import fs from 'fs' +import fs from 'fs' import GenerateJsonPlugin from 'generate-json-webpack-plugin' +import path from 'path' +import type { Compiler } from 'webpack' -// import path from 'path' -// import type { Compiler } from 'webpack' import manifest from './manifest' import routes from './routes' @@ -53,6 +53,21 @@ export default defineConfig({ memo.plugins.delete('hmr') } + memo.plugin('fixCSP').use( + class { + apply(compiler: Compiler) { + compiler.hooks.done.tap('fixCSP', () => { + const htmlPath = path.resolve(__dirname, '../dist/index.html') + const html = fs.readFileSync(htmlPath).toString() + fs.writeFileSync( + htmlPath, + html.replace(/