dsh-rank-scan 0.6.1 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -18,7 +18,7 @@ DeepSeek Harness 扫榜插件:定时 + 按需采集多站小说榜单,算变
18
18
 
19
19
  ```sh
20
20
  dsh plugin --profile desktop add github:kilo-s/dsh-rank-scan
21
- # 钉版本:github:kilo-s/dsh-rank-scan#v0.6.1
21
+ # 钉版本:github:kilo-s/dsh-rank-scan#v0.6.3
22
22
  ```
23
23
 
24
24
  仓库不含编译产物,这条命令会在安装时现场构建 `lib/`。首次可能被 pnpm 拦下构建脚本(它会打印要放行的键,加进 `allowBuilds` 后重跑即可),细节见 [docs/DEVELOPMENT.md](docs/DEVELOPMENT.md)。
@@ -37,14 +37,14 @@ dsh plugin --profile desktop add "<tgz 的完整路径>"
37
37
 
38
38
  ```sh
39
39
  dsh plugin --profile desktop add dsh-rank-scan
40
- # 钉版本:dsh-rank-scan@0.6.1
40
+ # 钉版本:dsh-rank-scan@0.6.3
41
41
  ```
42
42
 
43
43
  npm 上那份是 CI 从源码构建的(包内自带 `lib/`,发布带 `--provenance` 签名)——装的时候不用再编译,也不会被 pnpm 的 `allowBuilds` 拦下。面板的「检查更新」读的就是 npm 上的版本号。
44
44
 
45
45
  **验证**:重开 DSH 后左侧栏会话列表下方应出现「扫榜」入口;或访问 `http://127.0.0.1:19387/api/rank-scan/health`,返回 `{ok:true,...}` 即通。
46
46
 
47
- **更新**:重跑安装命令即可(链接直装取最新 `main`,registry 装取最新发布版;本版本为 **0.6.1**);面板「设置」页底部会读 npm 上的版本号提示有没有新版,装了 [dsh-market](https://github.com/dsh-market/dsh-market) 的话还能就地更新。
47
+ **更新**:重跑安装命令即可(链接直装取最新 `main`,registry 装取最新发布版;本版本为 **0.6.3**);面板「设置」页底部会读 npm 上的版本号提示有没有新版,装了 [dsh-market](https://github.com/dsh-market/dsh-market) 的话还能就地更新。
48
48
 
49
49
  **卸载**:`dsh plugin --profile desktop remove dsh-rank-scan`。数据目录 `~/.dsh/data/rank-scan` 会保留,要彻底清理自行删除;脚本化卸载与 patch 安全口径见 [docs/DEVELOPMENT.md](docs/DEVELOPMENT.md)。
50
50
 
@@ -85,7 +85,7 @@ npm 上那份是 CI 从源码构建的(包内自带 `lib/`,发布带 `--prov
85
85
  ### 定时扫描
86
86
 
87
87
  - **默认开启**,但**安装当天不自动跑**(次日按时刻跑);面板「设置」页可关掉或改时刻,关掉后重载仍保留。
88
- - 按站分时:每个站可以有自己的抓取时刻,兜底时刻 22:30。新安装的菠萝包默认时刻为 09:30;已有安装保留已保存的时刻,升级不覆盖。
88
+ - 按站分时:每个站可以有自己的抓取时刻,兜底时刻 22:30。新安装的默认时刻:起点 01:30、番茄 08:30、刺猬猫 10:40、菠萝包 14:30、起点图 21:30(2026-10-30 起)。已有安装保留已保存的时刻,升级不覆盖 —— 只有某个站仍是旧默认值(菠萝包 09:30 / 起点图 12:40)时才随升级自动改用新时刻。
89
89
  - 同一时刻只有一轮扫描(定时与手动共用一把锁,冲突时手动请求返回 409)。
90
90
  - 诊断日志:`<dataDir>/state/timer.log`(接线 / 迁移 / 每轮开始结束各一行)。
91
91
 
package/lib/client.js CHANGED
@@ -3366,9 +3366,15 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
3366
3366
  * 宿主的 catalog 校验留待 0.7(见交接)。
3367
3367
  */
3368
3368
  const qidianFixed = /^qidian\./.test(String(curBoard || ''))
3369
- const fixedDepth = qidianFixed ? 20 : null
3370
- const depthLocked = qidianFixed || info.can === false
3371
- const depthNote = qidianFixed ? '站点固定 20 条(移动端单页 20 条,站点分页接口在反爬后)' : info.hint
3369
+ /**
3370
+ * ★ 0.6.2:条数只对**适配器真读 depth** 的榜开放(宿主 catalog 的 canDepth 已经按口径算好)。
3371
+ * 派生榜再单独标一次:它连「扫本榜」都没意义(本地按快照算、0 请求)。
3372
+ */
3373
+ const derivedBoard = isDerived
3374
+ const depthLocked = qidianFixed || derivedBoard || info.can === false
3375
+ const depthNote = qidianFixed
3376
+ ? '站点固定 20 条(移动端单页 20 条,站点分页接口在反爬后)'
3377
+ : (info.hint || '该榜条数由站点/口径决定,不可调')
3372
3378
  const isOpen = function (r) { return !!(pick && pick.key === r.key) }
3373
3379
  /**
3374
3380
  * ★ 2026-10-23(点了没反应):详情卡原来挂在**整张列表之后** ⇒ 列表一长就在视口外
@@ -3476,30 +3482,44 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
3476
3482
  h('button', { className: 'rs-btn is-ghost', onClick: function () { setDayOpen(false) } }, '收起'),
3477
3483
  h('div', { style: { ...C.muted, flex: '1 1 100%' } }, '首订按 n-1 锚:选上架日 X ⇒ 请求数据日期 X+1(页面内容日期就是 X);保存后快照记在 X+1 名下。站点给的日期对不上会被拒绝,不写任何文件。')) : null,
3478
3484
  h('div', { style: { ...C.row, marginTop: '4px', flexWrap: 'wrap' } },
3479
- h('button', {
3485
+ // ★ 0.6.2:派生榜不发请求(本地按快照算),「扫描本榜」对它点了只会得到一条警告 ⇒ 直接不出现
3486
+ isDerived ? null : h('button', {
3480
3487
  className: 'rs-btn',
3481
3488
  disabled: props.scanBusy || busy,
3482
3489
  onClick: scanBoard,
3483
3490
  title: props.scanBusy ? '全局扫描进行中;请到概览点「停止本次」后再扫本榜' : '只抓当前这一榜,不动其它榜(联网)',
3484
3491
  }, scanning ? '扫描本榜中…' : (props.scanBusy ? '全局扫描进行中…' : '扫描本榜(联网)')),
3485
3492
  enrichMissing ? h('button', { className: 'rs-btn', disabled: busy || props.scanBusy, onClick: doEnrich, title: '补全当前榜缺失字段(联网:逐本进书页取,可能走缓存)' }, '补全缺失 ' + enrichMissing + ' 条') : null,
3486
- h('span', { style: { ...C.meta, flex: '1 1 auto' } }, '只抓当前这一榜;全局扫描/停止在概览')),
3493
+ /**
3494
+ * ★ 0.6.2c(使用者 2026-10-29「有必要用这么长的文字说明吗,要考虑 ui 观感」):
3495
+ * 操作条这一行**不再分叉成长句** —— 所有榜统一一句话;「条数为什么不能改」
3496
+ * 这种一次性信息放进 hover 提示(title),不占版面。
3497
+ * 派生榜没有扫描按钮,那一句对它不成立 ⇒ 换成 7 个字的短标签。
3498
+ */
3499
+ isDerived
3500
+ ? h('span', { style: C.meta, title: '本地派生榜:按候选池全量出' + ((data && data.rows) ? '(本次 ' + data.rows.length + ' 行)' : '') + ',不发请求' }, '本地派生 · 不发请求')
3501
+ : h('span', { style: { ...C.meta, flex: '1 1 auto' }, title: depthLocked ? depthNote : '' }, '只抓当前这一榜;全局扫描/停止在概览')),
3487
3502
  enrichMissing ? h(Banner, { tone: 'warn', live: false },
3488
3503
  h('span', null, '补全未完成:还缺 ' + enrichMissing + ' 条字段'),
3489
3504
  h('span', { style: C.muted }, '(榜页没给收藏/字数,要进书页取;点上面的「补全缺失」重试,或等定时续跑)')) : null,
3490
- h(Section, { title: '本榜设置', defaultOpen: false, summary: '每榜 ' + (fixedDepth != null ? fixedDepth : (depth || info.max || '—')) + ' 条' + (fixedDepth != null ? '(站点固定)' : '(上限 ' + (info.max || '—') + ')') },
3505
+ /**
3506
+ * ★ 0.6.2b(使用者 2026-10-29:「改不了的话是不是可以直接删了?显示在那里也没用啊」):
3507
+ * 条数**只对番茄分类榜 / 刺猬猫两个榜单**有意义(适配器真按 depth 翻页/截断)。
3508
+ * 其余榜的条数由站点或口径决定 ⇒ 与其留一个灰框,不如**整块不出现**,
3509
+ * 原因压成一行写在操作条(见下面那行说明),需要时一眼能看到,不占版面。
3510
+ */
3511
+ depthLocked ? null : h(Section, { title: '本榜设置', defaultOpen: false, summary: '每榜 ' + (depth || info.max || '—') + ' 条(上限 ' + (info.max || '—') + ')' },
3491
3512
  h('div', { style: { ...C.row, flexWrap: 'wrap' } },
3492
3513
  h('span', { style: C.muted }, '每榜取多少条'),
3493
3514
  h('input', {
3494
- type: 'number', min: 1, max: info.max, value: fixedDepth != null ? String(fixedDepth) : depth,
3495
- placeholder: String(fixedDepth != null ? fixedDepth : info.max), disabled: depthLocked || busy,
3496
- title: depthNote, onChange: function (e) { setDepth(e.target.value) },
3515
+ type: 'number', min: 1, max: info.max, value: depth, placeholder: String(info.max),
3516
+ disabled: busy, title: info.hint, onChange: function (e) { setDepth(e.target.value) },
3497
3517
  style: { ...C.input, width: '58px' },
3498
3518
  }),
3499
- h('span', { style: C.muted }, depthLocked ? '条 · ' + depthNote : '条(上限 ' + info.max + ')'),
3500
- h('button', { className: 'rs-btn', disabled: depthLocked || busy, onClick: function () { saveDepth(false) }, title: depthLocked ? depthNote : '只保存,下次扫描生效' }, '保存'),
3501
- h('button', { className: 'rs-btn', disabled: depthLocked || busy || props.scanBusy, onClick: function () { saveDepth(true) }, title: depthLocked ? depthNote : '保存后立刻抓一次这一榜(联网)' }, '保存并扫描本榜')),
3502
- !depthLocked && info.hint ? h('div', { style: C.muted }, info.hint) : null),
3519
+ h('span', { style: C.muted }, '条(上限 ' + info.max + ')'),
3520
+ h('button', { className: 'rs-btn', disabled: busy, onClick: function () { saveDepth(false) }, title: '只保存,下次扫描生效' }, '保存'),
3521
+ h('button', { className: 'rs-btn', disabled: busy || props.scanBusy, onClick: function () { saveDepth(true) }, title: '保存后立刻抓一次这一榜(联网)' }, '保存并扫描本榜')),
3522
+ info.hint ? h('div', { style: C.muted }, info.hint) : null),
3503
3523
  band ? h('div', { style: { ...C.sectionLabel, whiteSpace: 'normal', marginTop: '8px', marginBottom: '8px' } }, band) : null,
3504
3524
  viewDate ? h(Banner, { tone: 'warn' },
3505
3525
  h('span', { style: { fontWeight: 600 } }, '正在查看历史:' + viewDate),
package/lib/index.js CHANGED
@@ -39,7 +39,7 @@ import { minRequestIntervalMs, setMinRequestIntervalMs as applyRequestInterval }
39
39
  */
40
40
  import { readOwnVersion, probeMarket, fetchNpmLatest, normalizeOperation, buildUpdateView } from './scan/update.js';
41
41
  import { assertDataDate, dirSize, historyFor, listDataDates, listSlim, normalizeRetention, previousDataDate, readSlim, runRetention, sweepTmp, writeReport, writeSlim, } from './scan/files.js';
42
- import { DEFAULT_FALLBACK_TIME, DEFAULT_SITE_TIMES, hmOf, planSiteRuns, SITE_ORDER, siteOfBoard, validTime } from './scan/schedule.js';
42
+ import { DEFAULT_FALLBACK_TIME, DEFAULT_SITE_TIMES, hmOf, planSiteRuns, RETRY_COOLDOWN_MIN, SITE_ORDER, siteOfBoard, validTime } from './scan/schedule.js';
43
43
  import { cacheStats, cachedBook, clearCache, putCachedBooks } from './scan/qidian-cache.js';
44
44
  import { assignCachedStats, cacheStats as bookCacheStats, cachedEntry, putEntries } from './scan/book-cache.js';
45
45
  export const name = 'dsh-rank-scan';
@@ -63,6 +63,12 @@ export const name = 'dsh-rank-scan';
63
63
  */
64
64
  export const inject = ['timer', 'webServer'];
65
65
  const pad2 = (n) => String(n).padStart(2, '0');
66
+ /**
67
+ * ★ 2026-10-30(review 修):**配置架构版本号只在这里定义一次**。
68
+ * 以前迁移写 7、recordRun 仍写 6 ⇒ 每轮定时跑完都把版本降回 6,下次启动又跑一遍 v7 迁移;
69
+ * 使用者若刻意把菠萝包调回 09:30,会被再改掉一次 —— 与「调过的不动」自相矛盾。
70
+ */
71
+ const TIMER_SCHEMA_V = 7;
66
72
  function defaultState() {
67
73
  return {
68
74
  scanTime: '01:30',
@@ -76,6 +82,12 @@ function defaultState() {
76
82
  siteLastRun: {},
77
83
  /** ★ 2026-10-17:每站**定时**那次跑成功的时刻(ISO)。siteLastRun 只有日期,面板要显示「定时 08:30」 */
78
84
  siteLastTimerAt: {},
85
+ /**
86
+ * ★ 2026-10-30:每站**最近一次尝试**的时刻(ISO),**成功与失败都记**。
87
+ * 失败冷却(schedule.ts 的 RETRY_COOLDOWN_MIN)靠它算:siteLastTimerAt 只在成功时写,
88
+ * 整站抛错/宿主机刚醒时它不落地 ⇒ 会白等兜底 22:30。
89
+ */
90
+ siteLastAttemptAt: {},
79
91
  /** 每个榜最近一次扫描(含手动):面板可显示「这个榜上次什么时候抓的」 */
80
92
  boardLastScan: {},
81
93
  /**
@@ -440,6 +452,8 @@ export function apply(ctx, config) {
440
452
  previousRows: pd ? (pd.rows || []) : null,
441
453
  currentPeriodKey: periodKeyFromRows(nx.rows || []),
442
454
  previousPeriodKey: pd ? periodKeyFromRows(pd.rows || []) : null,
455
+ // ★ 2026-10-30:跨日版本复用(菠萝包旧代隔天复用回来时,只跟上一版比会漏)
456
+ history: recentTrustedVersions(b.boardId, rec.dataDate, 7),
443
457
  });
444
458
  /**
445
459
  * ★ 2026-10-25(换期 ≠ 换榜/降级):换榜判据必须先问「是不是同一期」。
@@ -952,6 +966,31 @@ export function apply(ctx, config) {
952
966
  }
953
967
  return out;
954
968
  }
969
+ /**
970
+ * ★ 2026-10-30:每站**今天最后一次尝试**距今多少分钟(失败冷却用:冷却到就当天补跑,不必等 22:30)。
971
+ * 取三者里最晚的一个:siteLastAttemptAt(**成功/失败都记**,2026-10-30 新增)→ siteLastTimerAt(只在成功时写)→
972
+ * boardLastScan.at(每次尝试都写,outcome = 五态)。所以「整站抛错、榜页还没落盘」这类失败也算一次尝试,
973
+ * 同时不会把「早上那次手动扫描」误当成「刚刚失败」⇒ 冷却既不会被绕过,也不会把失败站漏掉。
974
+ */
975
+ function minutesSinceAttemptAll(sites, today) {
976
+ const st = readState();
977
+ const bls = st.boardLastScan || {};
978
+ const now = clock.now().getTime();
979
+ const out = {};
980
+ for (const s of sites) {
981
+ // ★ 2026-10-30:优先用「最近一次尝试」的时刻(成功/失败都记),缺失才回落到「定时成功时刻」
982
+ let at = String((st.siteLastAttemptAt || {})[s] || (st.siteLastTimerAt || {})[s] || '');
983
+ for (const b of (st.boards || []).filter((x) => siteOfBoard(x) === s)) {
984
+ const hit = bls[b];
985
+ if (hit && hit.date === today && String(hit.at) > at)
986
+ at = String(hit.at);
987
+ }
988
+ const ms = at ? now - new Date(at).getTime() : NaN;
989
+ if (Number.isFinite(ms) && ms >= 0)
990
+ out[s] = Math.round(ms / 60000);
991
+ }
992
+ return out;
993
+ }
955
994
  /** 站 id → 中文名(面板/日志用) */
956
995
  const SITE_CN = { qidian: '起点', qidiantu: '起点图', ciweimao: '刺猬猫', sfacg: '菠萝包', fanqie: '番茄' };
957
996
  /** 现在这一刻的调度计划(只读;面板展示 + 集成测试都用它,零请求) */
@@ -969,6 +1008,7 @@ export function apply(ctx, config) {
969
1008
  failed: sitesFailedToday(sites, localDate(new Date()), st.siteTimes || DEFAULT_SITE_TIMES),
970
1009
  retried: st.siteRetry || {},
971
1010
  stale: SITE_ORDER.filter((s) => Object.keys(st.staleFlag || {}).some((b) => siteOfBoard(b) === s && st.staleFlag[b]?.date === localDate(new Date()))),
1011
+ minutesSinceAttempt: minutesSinceAttemptAll(sites, localDate(new Date())),
972
1012
  });
973
1013
  /**
974
1014
  * ★ 2026-10-16(疑问「关闭状态为什么显示今天已跑」):把「这个站今天抓过没、谁抓的、几点抓的」
@@ -1038,6 +1078,7 @@ export function apply(ctx, config) {
1038
1078
  failed: sitesFailedToday(sites, today, st.siteTimes || DEFAULT_SITE_TIMES),
1039
1079
  stale: staleSites,
1040
1080
  retried: st.siteRetry || {},
1081
+ minutesSinceAttempt: minutesSinceAttemptAll(sites, today),
1041
1082
  });
1042
1083
  const target = plan.due[0] || plan.fallback[0];
1043
1084
  if (!target) {
@@ -1084,7 +1125,7 @@ export function apply(ctx, config) {
1084
1125
  st2.lastTimerRunAt = startedAt;
1085
1126
  st2.lastTimerState = state;
1086
1127
  st2.lastTimerNote = note.slice(0, 300);
1087
- st2.timerSchemaV = 6;
1128
+ st2.timerSchemaV = Math.max(TIMER_SCHEMA_V, Number(st2.timerSchemaV) || 0);
1088
1129
  // ★ 按站分时:记「这个站今天跑过了」,下一个 tick 才会轮到别的站
1089
1130
  const slr = { ...(st2.siteLastRun || {}) };
1090
1131
  slr[target] = today;
@@ -1093,6 +1134,10 @@ export function apply(ctx, config) {
1093
1134
  * ★ 2026-10-17:分开记「定时那次成功的时刻」与「最近一次抓取(含手动)」——
1094
1135
  * 只有日期的话,面板上「今天已抓(手动 11:43)」会让人以为计划 08:30 没跑。
1095
1136
  */
1137
+ // ★ 2026-10-30:**每次都记尝试时刻**(成功/失败都记)—— 失败冷却靠它算
1138
+ const slat = { ...(st2.siteLastAttemptAt || {}) };
1139
+ slat[target] = startedAt;
1140
+ st2.siteLastAttemptAt = slat;
1096
1141
  if (state === 'ok') {
1097
1142
  const sla = { ...(st2.siteLastTimerAt || {}) };
1098
1143
  sla[target] = startedAt;
@@ -1152,7 +1197,7 @@ export function apply(ctx, config) {
1152
1197
  // v6(2026-10-16):补 staleFlag/siteRetry/installedAt/按站分时(**不翻开关**)
1153
1198
  const cur1 = readJson(statePath, {});
1154
1199
  // v6(2026-10-16):补 staleFlag/siteRetry/installedAt(老配置不视作「安装当天」、不翻开关)
1155
- if (cur1 && cur1.timerSchemaV !== 6) {
1200
+ if (cur1 && !(Number(cur1.timerSchemaV) >= 6)) {
1156
1201
  const st1 = readState();
1157
1202
  st1.siteTimes = { ...DEFAULT_SITE_TIMES, ...(st1.siteTimes || {}) };
1158
1203
  st1.fallbackTime = st1.fallbackTime || DEFAULT_FALLBACK_TIME;
@@ -1173,6 +1218,29 @@ export function apply(ctx, config) {
1173
1218
  writeState(st1);
1174
1219
  timerLog('v4 迁移:按站分时 = ' + JSON.stringify(st1.siteTimes) + '(兜底 ' + st1.fallbackTime + ';installedAt=' + st1.installedAt + ')');
1175
1220
  }
1221
+ /**
1222
+ * v7(2026-10-30):**按站分时改点** —— 菠萝包 09:30→14:30(首页整代对象,09:30 踩在换代的未测窗口里)、
1223
+ * 起点图 12:40→21:30(首订数值要到 首V+24h 才收盘,12:40 抓有 ~37% 未收盘)。
1224
+ * 只改**仍是旧默认值**的站:使用者自己调过的时刻一律不动。
1225
+ */
1226
+ const cur7 = readJson(statePath, {});
1227
+ if (cur7 && !(Number(cur7.timerSchemaV) >= TIMER_SCHEMA_V)) {
1228
+ const st7 = readState();
1229
+ const OLD = { sfacg: '09:30', qidiantu: '12:40' };
1230
+ const defs = DEFAULT_SITE_TIMES;
1231
+ const times = { ...defs, ...(st7.siteTimes || {}) };
1232
+ const moved = [];
1233
+ for (const s of Object.keys(OLD)) {
1234
+ if (times[s] === OLD[s]) {
1235
+ times[s] = defs[s];
1236
+ moved.push(SITE_CN[s] || s);
1237
+ }
1238
+ }
1239
+ st7.siteTimes = times;
1240
+ st7.timerSchemaV = TIMER_SCHEMA_V;
1241
+ writeState(st7);
1242
+ timerLog('v7 迁移:按站分时改点(只改仍是旧默认值的站)' + (moved.length ? ':' + moved.join('、') : '(无需改)') + ' ⇒ ' + JSON.stringify(times));
1243
+ }
1176
1244
  }
1177
1245
  catch { /* 迁移失败不该挡住接线 */ }
1178
1246
  timerApi = t;
@@ -1221,6 +1289,27 @@ export function apply(ctx, config) {
1221
1289
  return false;
1222
1290
  }
1223
1291
  }
1292
+ /**
1293
+ * ★ 2026-10-30:该榜最近 N 次**可信**快照(新→旧、不含当天),供「跨日版本复用」判据用。
1294
+ * N 按快照次数而不是日历天:抓失败/关机造成的缺日不该白占窗口。
1295
+ */
1296
+ function recentTrustedVersions(boardId, date, n = 7) {
1297
+ const st = new FileStore(root);
1298
+ const out = [];
1299
+ const ds = listDataDates(root);
1300
+ for (let k = ds.length - 1; k >= 0 && out.length < n; k--) {
1301
+ const d = ds[k];
1302
+ if (d >= date)
1303
+ continue;
1304
+ if (st.isUntrusted(d, boardId))
1305
+ continue;
1306
+ const s = st.readSnapshot(d, boardId);
1307
+ if (!s || !(s.rows || []).length)
1308
+ continue;
1309
+ out.push({ date: d, rows: s.rows, periodKey: periodKeyFromRows(s.rows) });
1310
+ }
1311
+ return out;
1312
+ }
1224
1313
  /**
1225
1314
  * ★ 工作包 A:**该榜自己的上一次可信成功数据日**(跨过缺日、跨过被拒快照)。
1226
1315
  * 旧口径只看「全局上一数据日期」:该榜那天没跑成功就判「首次采集」⇒ 变化整列空、
@@ -2393,6 +2482,33 @@ export function apply(ctx, config) {
2393
2482
  const captured = new Set(st.boards);
2394
2483
  const shown = new Set(st.display);
2395
2484
  const rows = [];
2485
+ /**
2486
+ * ★ 0.6.2「假设置」审计(使用者 2026-10-29):条数只对**适配器真读 depth** 的榜开放。
2487
+ * 判据看 `src/sites/*.ts`,不看「站点理论上能给多少」:
2488
+ * · 起点 —— 移动端单页固定 20 条,适配器写死(不读 depth)
2489
+ * · 起点图 —— 整页给出,适配器不读 depth(首订当日 20–35、三江 17)
2490
+ * · 刺猬猫首订(约)—— 第三方接口整批给出,depth 无意义
2491
+ * · 番茄派生榜 —— 本地算,按候选池全量出(240 行)
2492
+ * · 菠萝包 —— 首页 SSR 每 tab 固定 10
2493
+ * 其余(番茄分类榜、刺猬猫两个榜单)适配器真按 depth 翻页/截断,才给可调。
2494
+ * 注:canDepth=false 只是**不开放编辑**;config 里已有的旧值原样保留。
2495
+ */
2496
+ const depthLocked = (boardId) => boardId.startsWith('qidian.') || boardId.startsWith('qidiantu.') ||
2497
+ boardId === 'ciweimao.buy.latest' || boardId.startsWith('fanqie.derived.') ||
2498
+ boardId.startsWith('sfacg.');
2499
+ const depthHintOf = (site, boardId) => {
2500
+ if (site === 'qidian')
2501
+ return '移动端榜单单页固定 20 条(站点分页接口在反爬挑战后面,暂不可调)';
2502
+ if (boardId === 'ciweimao.buy.latest')
2503
+ return '第三方接口整批给出(不按条数截取)';
2504
+ if (boardId.startsWith('fanqie.derived.'))
2505
+ return '本地派生榜不设条数(按候选池全量出)';
2506
+ if (site === 'qidiantu')
2507
+ return '起点图整页给出条数(不按深度截取;首订当日榜 20–35 行、三江 17 行左右)';
2508
+ if (site === 'sfacg')
2509
+ return '首页 SSR 每个 tab 固定 10 条(不可调)';
2510
+ return '可调(每页 10 条,翻页取)';
2511
+ };
2396
2512
  const push = (site, siteName, group, boardId, label) => {
2397
2513
  const cap = site === 'qidian' ? 20 : site === 'sfacg' ? 10 : 100;
2398
2514
  rows.push({
@@ -2400,8 +2516,8 @@ export function apply(ctx, config) {
2400
2516
  captured: captured.has(boardId), displayed: shown.has(boardId),
2401
2517
  depth: (st.depths || {})[boardId] ?? defaultDepthFor(boardId),
2402
2518
  maxDepth: cap,
2403
- canDepth: cap > 10,
2404
- depthHint: site === 'qidian' ? '移动端榜单单页固定 20 条(站点分页接口在反爬挑战后面,暂不可调)' : site === 'sfacg' ? '首页 SSR 每个 tab 固定 10 条(不可调)' : site === 'qidiantu' ? '起点图站点自身决定条数(首订当日榜 20–35 条)' : '可调(每页 10 条,翻页取)',
2519
+ canDepth: !depthLocked(boardId),
2520
+ depthHint: depthHintOf(site, boardId),
2405
2521
  });
2406
2522
  };
2407
2523
  // 冻结口径:起点「全站」分类不纳入(cat -1 = 全站)
@@ -3619,7 +3735,7 @@ export function apply(ctx, config) {
3619
3735
  return send(400, { error: '兜底时间格式应为 HH:mm' });
3620
3736
  stT.fallbackTime = body.fallbackTime;
3621
3737
  }
3622
- stT.timerSchemaV = 6;
3738
+ stT.timerSchemaV = Math.max(TIMER_SCHEMA_V, Number(stT.timerSchemaV) || 0);
3623
3739
  writeState(stT);
3624
3740
  const on = stT.timerEnabled === true;
3625
3741
  // ★ 票 25:开关变化立刻接/断,不用等重启
@@ -3628,7 +3744,7 @@ export function apply(ctx, config) {
3628
3744
  ok: true, enabled: on, scanTime: stT.scanTime, siteTimes: stT.siteTimes, fallbackTime: stT.fallbackTime,
3629
3745
  siteLastRun: stT.siteLastRun || {}, siteLastTimerAt: stT.siteLastTimerAt || {}, plan: timerPlanNow(), armed,
3630
3746
  note: (on
3631
- ? '定时已开启(按站分时):' + SITE_ORDER.map((s) => (SITE_CN[s] || s) + ' ' + ((stT.siteTimes || {})[s] || '—')).join('、') + ';当天没跑成的站到 ' + (stT.fallbackTime || DEFAULT_FALLBACK_TIME) + ' 补跑'
3747
+ ? '定时已开启(按站分时):' + SITE_ORDER.map((s) => (SITE_CN[s] || s) + ' ' + ((stT.siteTimes || {})[s] || '—')).join('、') + ';当天没跑成的站冷却 ' + RETRY_COOLDOWN_MIN + ' 分钟后补跑一次(最晚 ' + (stT.fallbackTime || DEFAULT_FALLBACK_TIME) + ')'
3632
3748
  : '定时扫描已关闭(面板「立刻扫一次」仍可用)') + (on
3633
3749
  ? (armed ? ';定时器已接线' : ';注意:宿主 timer 服务不可用,暂未接线')
3634
3750
  : ';定时器已断开'),