Repository navigation
fix: 自动签到去重与自签、雨课堂凭证浏览器持久化、诊断日志 - #20
Merged
Merged
Conversation
- 修复同一成员出现多条「签到成功」回执、上游被重复打卡:SharedWorker 只让同一浏览器共用一条 WS,但每个标签页都会收到同一 qr_update 帧并各自自动签到,开 N 个标签页即提交 N 次
- 新增 frontend/src/lib/sign-once.ts:localStorage 台账(键 {user_id}:{二维码内容},条目 2 小时后淘汰),读写在同一同步调用内完成,多标签页/重进房/自身回显同一内容只提交一次
- 自动签到改为只签「最新一条未过期」的码,不再从索引 0 起对进房历史逐条补签
- 「收到消息立即签到」开关默认开(只有显式关过 localStorage='0' 才为关)
- 扫码者推送 share_qr 成功后本人也立即签到(此前仅推送,出现"扫码的人没签到、房间其他人签到了")
- 补测试:sign-once 台账 6 例、Room 自动签到 5 例(只签最新一条/重复投递只提交一次/过期不签/开关关掉不签/扫码者自签且回显不再签)
- CHANGELOG 同步
校验:lint 0 警告、tsc 通过、74 test 全绿、build 通过
- 后端 sessions 内存表重启即清空,而浏览器 sid 仍有效 14 天,重启后点课程/签到即报「登录已过期」 - 登录成功时把雨课堂 Cookie 头 base64url 编码后种入 yk_session HttpOnly cookie(SameSite=Lax,TTL 与雨课堂 sessionid 一致 14 天固定不滑动),与雨课堂官网把 sessionid 存浏览器 HttpOnly cookie 同策 - 新增 resolve_yk_cookie:浏览器 cookie 优先、内存表兜底(兼容升级前已登录的旧会话);签到接口先行接入 - 登录/登出响应改用 AppendHeaders 双 Set-Cookie(普通数组为 insert 语义,同名头会互相覆盖) - 测试:yk_session 编解码/提取 6 例、登录种 cookie、登出双清、签到重启恢复与 cookie 优先 2 例 校验:cargo test 147 全绿、clippy 无警告
- 课程接口 40101 的各条路径(未带 sid / sid 校验失败 / 内存无雨课堂会话)分别记录原因与 user_id,此前一律静默返回无法定位 - 上游响应解析改为先读文本再解析:非 2xx 或非 JSON(如雨课堂会话失效被重定向到登录页的 HTML,此前只会报「内部错误」并丢失原始返回)时记录 HTTP 状态与响应体片段(≤500 字符) - 所有日志均不记录 cookie / sid 等凭证值,仅记原因、错误码与上游响应片段
- GET /api/courses 的雨课堂凭证改为浏览器 HttpOnly cookie 优先、内存表兜底,后端重启/换机后课程页不再要求重新登录 - 回归测试:重启清空内存表后仅凭 cookie 仍能取到课程;浏览器 cookie 优先于内存旧值
- index.html 声明 <link rel="icon" href="/favicon.ico">,替换被移除的 favicon.svg / icons.svg(无代码引用)
2 tasks done
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.
Summary
sign-once.ts)消除同一成员多条「签到成功」回执与上游重复打卡;只签最新一条未过期码,不再补签进房历史;「收到消息立即签到」默认开,扫码者推送后本人也立即签到yk_sessionHttpOnly cookie(与雨课堂官网把 sessionid 存浏览器同策):后端重启不再丢失会话;课程/签到接口 cookie 优先、内存表兜底;部署后需重新登录一次以种上该 cookieTest plan