Commit Graph

10 Commits

Author SHA1 Message Date
Abner
2bbe2f9bc4 ♻️ refactor(simyo): 统一客户端版本与 User-Agent 配置
抽取 client-identity 作为版本、设备型号与 User-Agent 的单一事实来源;
本地与 Netlify 代理强制使用配置的 User-Agent,不再透传浏览器 UA。
2026-07-22 19:26:12 +08:00
Abner
5a65dd3d01 🐛 fix(simyo): 补齐请求头 X-Device-ID
Simyo 4.28+ 要求每个请求携带 UUID 形态的 X-Device-ID,
缺失会返回 400 missing X-Device-ID。前端生成并持久化设备 ID,
本地与代理同步转发该请求头,并将上游 API 路径切换为 webapi。
2026-07-22 19:26:12 +08:00
Abner
0ef5ea82e2 🐛 fix(simyo): 升级 iOS 客户端版本至 4.28.0 修复 HTTP 426
Simyo API 拒绝过旧的 X-Client-Version/User-Agent(4.23.5),
导致登录失败 HTTP 426。同步更新前端配置、本地代理与测试页。

Closes #94
2026-07-22 17:49:11 +08:00
Abner
6379bbef90 ♻️ refactor: 移除外部二维码服务依赖,改用本地生成方案
- 将前端二维码生成从 `qrcode.show` 远程服务切换为 `qrcode-generator` 本地库(UMD 格式),消除对外部 CDN 渲染服务的依赖,降低隐私风险和第三方服务不可用时的故障点
- 重写 `generateQRCodeLocal` 函数适配 `qrcode-generator` API,使用 `qrcode(typeNumber, errorCorrectionLevel).addData().make().createDataURL()` 模式,并基于 QR 码模块数动态计算 `cellSize`,新增大尺寸预览图支持(400px)
- 移除所有页面中的 `qrcode.show` 域名引用,包括 CSP `connectSrc` 策略、preconnect 标签、resource-hints DNS 预解析配置及 Simyo/Giffgaff API 配置中的 `qrcode` 端点
- 完善二维码生成的日志与监控:在 CDN 加载成功后输出 `console.log`,本地/后端生成成功及失败时分别输出对应级别日志,并在 `trackQRCodeEvent` 中增加 `isBrowser` 守卫避免非浏览器环境报错
- 增加生成耗时和 QR 码长度(不含内容)到后端 BFF 日志,同时统一使用 `Date.now()` 计算请求耗时,避免 LPA 激活码等敏感信息进入日志
- 全面更新所有相关测试用例,适配新的 `window.qrcode` 工厂函数 mock,新增日志输出和 Sentry 上报断言,验证本地成功、本地失败降级、后端成功、后端失败四种场景的可观测性
2026-06-23 21:22:16 +08:00
Abner
c3926b14eb 📝 docs: 修正误导性描述,明确工具仅支持已有用户 eSIM 设备更换 2026-05-17 21:57:13 +08:00
Abner
a1628aa33a 🐛 fix(security): 修复全部 76 个 CodeQL 安全扫描告警
修复 GitHub 代码扫描发现的所有安全问题,涵盖 20 个文件、76 个告警:

- Actions 工作流:添加 Fork 仓库限制、来源验证、persist-credentials: false、移除 npm cache
- 明文存储:localStorage 迁移到 secureStorage (sessionStorage + TTL)
- 日志注入:新增 sanitizeLog() 过滤换行符,覆盖全部 console.log 调用
- SSRF:新增 isAllowedTarget() 域名白名单校验
- SRI 完整性:为 Bootstrap/Font Awesome/GTM 添加 integrity + crossorigin
- XSS 防护:错误消息 HTML 转义、Service Worker origin 验证
- URL 清洗:hostname.includes() 替换为精确域名匹配
- HTML 过滤:扩展标签黑名单、添加事件属性过滤
- 限流:全局引入 createRateLimiter (200 req/min/IP)
2026-05-06 21:46:25 +08:00
Abner
2b8f293506 chore: 更新 Simyo 客户端版本和用户代理字符串
* 将所有 Simyo 相关配置中的客户端版本从 4.8.0 更新为 4.23.5。
* 将默认的用户代理字符串更新为反映 MijnSimyoFT/4.23.5 (iOS 26.3; iPhone16,1)。
* 确保代理服务器和 API 配置与最新的 Simyo 客户端版本保持一致,以模拟最新的客户端行为。
* 更新了测试文件中的对应值,以确保测试环境使用最新的客户端信息。
2026-01-12 19:14:43 +08:00
Abner
dd27453c97 feat(qrcode): 更新二维码生成供应商并调整相关配置
- 将二维码生成供应商从 api.qrserver.com 更新为 qrcode.show
- 更新了相关文档、代码和测试中的二维码生成 URL
- 调整了内容安全策略(CSP)以允许新的二维码生成 URL
- 更新了 webpack 配置,为新的二维码生成 URL 添加缓存策略
2025-08-11 21:41:54 +08:00
Abner
64842b97c4 fix(ui): ensure proper visibility toggle for device change and login steps
- hide login step and show device change option when switching to device change flow
- reset ui to show login step and hide device change elements on form reset
- update step indicator to skip step 1 when showing device change option
2025-08-02 00:04:42 +08:00
Abner
c5fbc34d0a 🏗️ Major project restructure and CSP fix
🔧 Fixed CSP Issue:
- Root cause: Netlify CSP configuration overriding HTML meta CSP
- Added missing domains: id.giffgaff.com, publicapi.giffgaff.com
- Updated netlify.toml CSP configuration
- This resolves the OAuth token exchange CSP violation

📁 Project Architecture Restructure:
- src/: Source code organized by provider (giffgaff/, simyo/)
- docs/: Documentation categorized (fixes/, guides/, reference/)
- tests/: All test files centralized
- scripts/: Deployment and utility scripts
- postman/: API collections and reference files

🔄 Path Updates:
- Updated netlify.toml redirects for new file locations
- Updated README.md with new project structure
- Updated all internal documentation links
- Maintained backward compatibility for all URLs

📋 Files Moved:
- giffgaff_complete_esim.html → src/giffgaff/
- simyo_complete_esim.html → src/simyo/
- simyo_static.html → src/simyo/
- simyo_proxy_server.js → src/simyo/
- All docs → docs/{fixes,guides,reference}/
- All tests → tests/
- All scripts → scripts/
- Postman collections → postman/

 Benefits:
- Improved maintainability and organization
- Better separation of concerns
- Enhanced developer experience
- Cleaner project structure following best practices
- Zero impact on user experience (all URLs preserved)

This major restructure sets foundation for better scalability and maintenance.
2025-08-01 19:28:03 +08:00