feat: 每日积分模式与 Bark 完成提醒
- 按课时类型计分:文档 1 / 视频 3 / 音频 2 / 微课 2,每次 3 分,单日封顶 24 分;满额换类,无内容即停 - 积分计数落 localStorage,跨刷新/重启保留、跨天清零;面板与无头 TUI 都显示今日积分 - 运行器自己收尾时通过 Bark 推送今日积分、完成门数、用时和结束原因;手动停止与 --check 不推送 - 新增 --points-mode / --bark-* 参数及对应 YUN_XUE_TANG_* 环境变量 - 补充 points / notify 离线回归测试与 OpenSpec 配置 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
17217dbeb1
commit
0eb4c40629
31 files changed
+2954
-21
No files matched your search
+9
-2
@@ -104,6 +104,8 @@ export const EXPR_SNAPSHOT = `JSON.stringify((function () {
|
||||
return m ? Number(m[1]) : null;
|
||||
})(),
|
||||
status: (document.getElementById('yun-xue-tang-status') || {}).textContent || '',
|
||||
// 每日积分:{ enabled, total, max, progress:[{label,count,cap}], text }
|
||||
points: (a.points && a.points.snapshot ? a.points.snapshot() : null),
|
||||
doneCount: Object.keys(a.S.completedTitles || {}).length,
|
||||
retryCount: Object.keys(a.S.courseRetries || {}).length,
|
||||
retryWait: (a.retryWaitSeconds ? a.retryWaitSeconds() : 0),
|
||||
@@ -123,6 +125,8 @@ export const EXPR_FINAL_STATS = `JSON.stringify((function () {
|
||||
completed: a.S.completedThisRun,
|
||||
doneCount: Object.keys(a.S.completedTitles || {}).length,
|
||||
retryCount: Object.keys(a.S.courseRetries || {}).length,
|
||||
// 每日积分:收尾通知里要带上「今日积分 X/24 · 各类次数」
|
||||
points: (a.points && a.points.snapshot ? a.points.snapshot() : null),
|
||||
};
|
||||
})())`;
|
||||
|
||||
@@ -137,11 +141,14 @@ export const EXPR_PAUSE_AND_SAVE = `(function () {
|
||||
export const exprSetMaxCourses = (max) =>
|
||||
`(function(){ var a = window.__yunXueTangAuto; if (a && a.CFG) a.CFG.maxCourses = ${Number(max)}; return true; })()`;
|
||||
|
||||
/** 启动 / 接续批量刷课,同时同步「优先短课程」偏好 */
|
||||
export const exprStartBatch = (preferShort) => `(function () {
|
||||
/** 启动 / 接续批量刷课,同时同步「优先短课程」「每日积分」偏好 */
|
||||
export const exprStartBatch = (preferShort, pointsMode) => `(function () {
|
||||
var a = window.__yunXueTangAuto;
|
||||
try { localStorage.setItem('yun-xue-tang-prefer-short', '${preferShort ? '1' : '0'}'); } catch (e) {}
|
||||
try { localStorage.setItem('yun-xue-tang-daily-points-mode', '${pointsMode ? '1' : '0'}'); } catch (e) {}
|
||||
a.state.preferShortCourses = ${preferShort ? 'true' : 'false'};
|
||||
a.state.pointsEnabled = ${pointsMode ? 'true' : 'false'};
|
||||
try { a.points.setEnabled(${pointsMode ? 'true' : 'false'}); } catch (e) {}
|
||||
a.startBatch();
|
||||
return true;
|
||||
})()`;
|
||||
|
||||
Reference in new issue
Block a user