Repository navigation
Conversation
* feat(wechat): M5 微信 JS-SDK 扫码签到——jssdk-signature 接口与微信内扫一扫
后端新增 wechat 模块:access_token / jsapi_ticket 内存缓存(tokio RwLock,提前
300s 刷新)与 plain SHA1 签名;GET /api/wechat/jssdk-signature?url= 供前端
wx.config,url 自动去除 # 及其后部分。凭证经 WECHAT_APP_ID / WECHAT_APP_SECRET
注入,未配置返回 40307 而非 panic。
前端新增 MicroMessenger UA 检测与 jweixin 动态注入(幂等),房间页底栏在微信内
新增「微信扫一扫」主按钮,扫码结果与相机扫码同路径(本地预校验 → share_qr
推送全房间);非微信环境保持相机扫码。
* fix(wechat): 消除 NodeListOf 迭代告警并加固微信扫一扫取消处理
- 测试改用 Array.from,消除 IDE 对 for...of NodeListOf 的类型告警(本项目
tsconfig lib 为 ES2023+DOM,未含 DOM.Iterable;tsc -b 实际不受影响)
- wx.scanQRCode 的 scanType 限定为 qrCode,避免误扫条形码
- fail 回调 errMsg 含 cancel 时按用户取消处理(部分微信版本行为),返回 null
* feat(wechat): 新增 status 可用性预检查与 VITE_WX_DEBUG 真机调试开关
参照参考实现 qrcode_share:
- 后端新增 GET /api/wechat/status(免会话)返回 {available, reason},只暴露
「是否已配置」不含凭证
- 前端环境预检查:房间页仅在「微信内 且 后端判定可用」时才渲染「微信扫一扫」
入口,未配置时完全不显示,避免点击后才报 40307
- VITE_WX_DEBUG=true 时 wx.config({debug:true}),真机以弹窗输出签名校验细节,
便于定位 invalid signature(默认关闭)
备案号通过 VITE_ICP_BEIAN 注入(生产机 frontend/.env.local,已 gitignore),未配置时组件返回 null 零 DOM 痕迹;仓库与开源发布不含任何具体号码,部署方可随时 git pull 更新而不冲突。
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
变更说明
dev→main发版合并,包含两个已 squash 合入dev的 feature:backend/src/wechat/:GET /api/wechat/jssdk-signature?url=(需会话)与GET /api/wechat/status(免会话可用性探测,不泄露凭证)WechatClient内存缓存access_token/jsapi_ticket(7200s,提前 300s 刷新,tokio::sync::RwLock);签名串取 plain SHA1,url自动去除#及其后部分WECHAT_APP_ID/WECHAT_APP_SECRET注入,未配置时返回 40307(不 panic)src/lib/wechat.ts(UA 检测 + jweixin 1.6.0 幂等注入 +wx.config→wx.scanQRCode)与src/api/wechat.ts;房间页底栏在「微信内 且 后端可用」时展示「微信扫一扫」,非微信环境保持相机扫码VITE_WX_DEBUG真机调试开关(默认关闭)VITE_ICP_BEIAN注入;未配置时组件return null零 DOM 痕迹,配置后登录页底部展示并链接工信部frontend/.env.local(已 gitignore),仓库与开源发布不含任何具体号码,可随时git pull更新变更类型
feat新功能fix缺陷修复docs文档refactor重构(不改行为)chore构建/依赖/杂项目标分支
dev(feature/fix 常规合并)main(仅发版合并,dev → main)自查清单
feat/fix/docs/chore/+ 简短描述),基于最新dev创建cargo fmt --check/cargo clippy -D warnings/cargo test通过(后端改动)eslint/tsc --noEmit/ 测试 / 构建通过(前端改动)unwrap()(测试代码除外)、无unsafe、无any关联 issue / 备注