Files
eSIM-Tools/package.json
Abner f5c5dee5ab 🐛 fix: 修复 Session 恢复后二维码和 LPA 不显示的问题
问题:
- 用户完成 eSIM 激活后,因外部二维码服务不可用导致页面空白
- Session 恢复时未调用 showESimResult() 显示二维码和 LPA 信息

解决方案:
1. 新增通用二维码生成模块 (src/js/modules/qrcode-generator.js)
   - 实现三层降级策略:本地 CDN → 后端 Function → 文本提示
   - 消除对外部服务的依赖,提升隐私保护

2. 新增后端 Function (netlify/functions/qrcode-generate.js)
   - POST /bff/qrcode-generate 接口
   - 返回 base64 编码的 PNG 二维码
   - withAuth 中间件保护 + 输入验证

3. 重构前端二维码生成逻辑
   - Giffgaff/Simyo 统一使用 generateQRCodeWithFallback()
   - 保留并发调用防护和 tooltip 交互
   - 使用 i18n 翻译替代硬编码错误提示

4. 修复 Session 恢复逻辑
   - 在 handleSessionRestore() 中调用 showESimResult()
   - 确保刷新页面后二维码和 LPA 正常显示

技术改进:
- 懒加载 qrcode.js(~13KB gzip),仅在首次调用时加载
- 完整的测试覆盖(前端单元测试 + 后端安全测试)
- 更新 BFF 路由配置(Edge Function + 本地开发服务器)

Closes #75
2026-06-13 19:20:22 +08:00

113 lines
3.3 KiB
JSON

{
"name": "esim-tools",
"version": "2.0.0",
"description": "专为Giffgaff和Simyo用户设计的eSIM管理工具集",
"main": "index.js",
"scripts": {
"hooks:install": "git config core.hooksPath .githooks",
"hooks:list": "ls -1 .githooks",
"precommit:check": "node scripts/pre-commit-check.js",
"prepush:check": "node scripts/pre-push-check.js --mode=full",
"prepush:check:fast": "node scripts/pre-push-check.js --mode=fast",
"commitmsg:lint": "node scripts/commit-msg-lint.js",
"prestart": "npm run build",
"predev": "npm run build",
"prenetlify-dev": "npm run build",
"start": "node server.js",
"dev": "nodemon server.js",
"build": "npm run build:static",
"build:static": "node scripts/build-static.js",
"test": "jest",
"test:watch": "jest --watch",
"test:coverage": "jest --coverage",
"netlify-dev": "npx --yes netlify-cli@latest dev",
"deploy": "npm run build && npx --yes netlify-cli@latest deploy --prod",
"optimize-images": "node scripts/optimize-images.js",
"compress": "node scripts/compress.js",
"security-check": "node scripts/security-check.js",
"quality-check": "node scripts/quality-check.js",
"deploy-prepare": "node scripts/deploy-prepare.js",
"deploy-analyze": "node scripts/deploy-analyze.js",
"deploy-test": "node scripts/test-deploy-config.js"
},
"keywords": [
"esim",
"giffgaff",
"simyo",
"mobile",
"sim-card",
"oauth",
"api"
],
"author": "eSIM Tools Team",
"license": "MIT",
"dependencies": {
"@netlify/blobs": "^8.0.0",
"@sentry/browser": "^10.30.0",
"@sentry/node": "^10.30.0",
"axios": "^1.16.0",
"cheerio": "^1.0.0-rc.12",
"cors": "^2.8.5",
"dotenv": "^16.3.1",
"express": "^4.22.2",
"helmet": "^7.1.0",
"morgan": "^1.10.0",
"qrcode": "^1.5.4"
},
"devDependencies": {
"@babel/core": "^7.23.0",
"@babel/plugin-transform-runtime": "^7.28.0",
"@babel/preset-env": "^7.23.0",
"@babel/runtime": "^7.28.2",
"@sentry/webpack-plugin": "^4.6.1",
"@testing-library/jest-dom": "^6.1.5",
"@testing-library/user-event": "^14.5.1",
"autoprefixer": "^10.4.16",
"babel-loader": "^9.1.3",
"compression-webpack-plugin": "^10.0.0",
"core-js": "^3.45.0",
"css-loader": "^6.8.1",
"cssnano": "^6.0.1",
"esbuild": "^0.25.8",
"http-proxy-middleware": "^3.0.5",
"jest": "^30.3.0",
"jest-environment-jsdom": "^30.2.0",
"nodemon": "^3.0.2",
"on-headers": "^1.1.0",
"postcss": "^8.5.10",
"postcss-cli": "^11.0.1",
"postcss-loader": "^7.3.3",
"sharp": "^0.34.3",
"style-loader": "^3.3.3",
"terser-webpack-plugin": "^5.3.9",
"webpack": "^5.105.0",
"webpack-cli": "^5.1.4",
"workbox-webpack-plugin": "^7.0.0"
},
"browserslist": [
"defaults",
"Chrome >= 90",
"not dead"
],
"engines": {
"node": ">=18.0.0",
"npm": ">=8.0.0"
},
"repository": {
"type": "git",
"url": "https://github.com/Silentely/eSIM-Tools.git"
},
"bugs": {
"url": "https://github.com/Silentely/eSIM-Tools/issues"
},
"homepage": "https://esim.cosr.eu.org",
"overrides": {
"minimatch": "^10.2.3",
"glob": "^11.1.0",
"serialize-javascript": "^7.0.5",
"path-to-regexp": "^0.1.13",
"rollup": "^2.80.0",
"uuid": "^14.0.0"
}
}