dsh-rank-scan 0.6.0 → 0.6.2

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.0
21
+ # 钉版本:github:kilo-s/dsh-rank-scan#v0.6.2
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.0
40
+ # 钉版本:dsh-rank-scan@0.6.2
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.0**);面板「设置」页底部会读 npm 上的版本号提示有没有新版,装了 [dsh-market](https://github.com/dsh-market/dsh-market) 的话还能就地更新。
47
+ **更新**:重跑安装命令即可(链接直装取最新 `main`,registry 装取最新发布版;本版本为 **0.6.2**);面板「设置」页底部会读 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
 
package/lib/client.js CHANGED
@@ -768,7 +768,6 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
768
768
  days: 3, author: 4, fans: 4,
769
769
  cat: 5, score: 5,
770
770
  subCat: 6, settledDays: 6,
771
- updated: 7,
772
771
  }
773
772
  /** 优先级数字越大越先被丢;7 天增量的 daily0..6 排最后 */
774
773
  const colPrio = function (c) {
@@ -783,7 +782,6 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
783
782
  const colEst = function (c) {
784
783
  const k = String((c && c.key) || '')
785
784
  if (k === 'title') return 200
786
- if (k === 'updated') return 124
787
785
  if (k === 'rank') return 36
788
786
  if (k === 'delta') return 50
789
787
  if (/^daily\d+$/.test(k)) return 46
@@ -2297,13 +2295,11 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
2297
2295
  // ★ 2026-10-29 口径修正:三江这一列是「日期」(Unix 秒时间戳),不是「首日增量」⇒ 显示成 MM-DD HH:mm
2298
2296
  if (k === 'firstDay') return fmtStamp(ex.firstDay)
2299
2297
  if (k === 'firstV') return dash(ex.firstV)
2300
- if (k === 'update') return dash(ex.update)
2301
2298
  if (k === 'collect') return fmtRead(ex.collect)
2302
2299
  if (k === 'collectBase') return fmtRead(ex.collectBase)
2303
2300
  if (k === 'fans') return fmtRead(ex.fans)
2304
2301
  if (k === 'score') return dash(ex.score)
2305
2302
  if (k === 'words') return fmtWords(ex.wordsText !== undefined ? ex.wordsText : ex.wordsCnt !== undefined ? ex.wordsCnt : ex.wordNumber !== undefined ? ex.wordNumber : ex.words)
2306
- if (k === 'updated') return fmtTime(ex.lastChapterUpdateTime)
2307
2303
  if (k === 'subCat') return dash(ex.subCat)
2308
2304
  if (k === 'cat') return dash(ex.cat)
2309
2305
  if (k === 'days') return dash(r.days)
@@ -3330,12 +3326,12 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
3330
3326
  * 右半张桌子全空,被删掉的指标也没有别处可看。窄的时候改成**卡片行**:
3331
3327
  * 第一行 名次 · 书名 · 作者 · 星标;第二行把这一榜要看的指标做成 chip(放不下自动换行)。
3332
3328
  */
3333
- const CHIP_SKIP = { title: 1, rank: 1, author: 1, cat: 1, subCat: 1, updated: 1, days: 1 }
3329
+ const CHIP_SKIP = { title: 1, rank: 1, author: 1, cat: 1, subCat: 1, days: 1 }
3334
3330
  /**
3335
3331
  * 0.6 收尾:卡片第二行的中点串除了「按列序前 6 个」,还要**保证新补的四列在**里
3336
3332
  * (它们在列序里靠后,光靠 slice(0,6) 会被切掉);空值仍由渲染处跳过。
3337
3333
  */
3338
- const CHIP_ALWAYS = { shouding: 1, firstDay: 1, firstV: 1, update: 1 }
3334
+ const CHIP_ALWAYS = { shouding: 1, firstDay: 1, firstV: 1 }
3339
3335
  const chipCols = (function () {
3340
3336
  const all = ((data && data.columns) || []).filter(function (c) { return !CHIP_SKIP[c.key] })
3341
3337
  const head = all.slice(0, 6)
@@ -3349,7 +3345,7 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
3349
3345
  * 增量只能靠拉宽面板看)。这里算出「当前视图没显示的列」,在行详情里用**同一套 cell 渲染器**
3350
3346
  * 补全 —— 不截断真实字段,也不改现有列宽/收起策略。
3351
3347
  */
3352
- const SUMMARY_COLS = { title: 1, rank: 1, author: 1, words: 1, updated: 1 }
3348
+ const SUMMARY_COLS = { title: 1, rank: 1, author: 1, words: 1 }
3353
3349
  const shownColKeys = (function () {
3354
3350
  const m = {}
3355
3351
  if (cards) {
@@ -3370,9 +3366,15 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
3370
3366
  * 宿主的 catalog 校验留待 0.7(见交接)。
3371
3367
  */
3372
3368
  const qidianFixed = /^qidian\./.test(String(curBoard || ''))
3373
- const fixedDepth = qidianFixed ? 20 : null
3374
- const depthLocked = qidianFixed || info.can === false
3375
- 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 || '该榜条数由站点/口径决定,不可调')
3376
3378
  const isOpen = function (r) { return !!(pick && pick.key === r.key) }
3377
3379
  /**
3378
3380
  * ★ 2026-10-23(点了没反应):详情卡原来挂在**整张列表之后** ⇒ 列表一长就在视口外
@@ -3384,10 +3386,8 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
3384
3386
  return h('div', { style: { ...C.detail, marginTop: '4px' } },
3385
3387
  h('div', { style: { fontWeight: 600 } }, dash(r.title)),
3386
3388
  h('div', { style: C.muted }, '作者 ' + dash(r.author) + ' · 名次 ' + dash(r.rank) + ' · 字数 ' + fmtWords(ex.wordsText || ex.wordsCnt || ex.wordNumber || ex.words)),
3387
- // 「更新」只有番茄榜单页给(lastChapterUpdateTime);没这个字段的榜整行不渲染,不显示「更新 —」
3388
- ex.lastChapterUpdateTime != null && Number(ex.lastChapterUpdateTime) > 0
3389
- ? h('div', { style: C.muted }, '更新 ' + fmtTime(ex.lastChapterUpdateTime))
3390
- : null,
3389
+ // ★ 0.6.1(使用者 2026-10-29「统一去掉」):详情卡也不再显示「更新 …」——
3390
+ // 它和榜单列的「更新时间」是同一个字段(番茄 `lastChapterUpdateTime`),留着就还是不一致。
3391
3391
  // 简介:只有真有 desc 的行才渲染(没有就整块不出现,不显示「—」)
3392
3392
  h(BoardDesc, { text: ex.desc }),
3393
3393
  // 被当前宽度收起的列:在这里逐条列出(label + 与表格完全相同的渲染)
@@ -3482,30 +3482,44 @@ const LS_OPEN = 'rank-scan-panel:open:v1'
3482
3482
  h('button', { className: 'rs-btn is-ghost', onClick: function () { setDayOpen(false) } }, '收起'),
3483
3483
  h('div', { style: { ...C.muted, flex: '1 1 100%' } }, '首订按 n-1 锚:选上架日 X ⇒ 请求数据日期 X+1(页面内容日期就是 X);保存后快照记在 X+1 名下。站点给的日期对不上会被拒绝,不写任何文件。')) : null,
3484
3484
  h('div', { style: { ...C.row, marginTop: '4px', flexWrap: 'wrap' } },
3485
- h('button', {
3485
+ // ★ 0.6.2:派生榜不发请求(本地按快照算),「扫描本榜」对它点了只会得到一条警告 ⇒ 直接不出现
3486
+ isDerived ? null : h('button', {
3486
3487
  className: 'rs-btn',
3487
3488
  disabled: props.scanBusy || busy,
3488
3489
  onClick: scanBoard,
3489
3490
  title: props.scanBusy ? '全局扫描进行中;请到概览点「停止本次」后再扫本榜' : '只抓当前这一榜,不动其它榜(联网)',
3490
3491
  }, scanning ? '扫描本榜中…' : (props.scanBusy ? '全局扫描进行中…' : '扫描本榜(联网)')),
3491
3492
  enrichMissing ? h('button', { className: 'rs-btn', disabled: busy || props.scanBusy, onClick: doEnrich, title: '补全当前榜缺失字段(联网:逐本进书页取,可能走缓存)' }, '补全缺失 ' + enrichMissing + ' 条') : null,
3492
- 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 : '' }, '只抓当前这一榜;全局扫描/停止在概览')),
3493
3502
  enrichMissing ? h(Banner, { tone: 'warn', live: false },
3494
3503
  h('span', null, '补全未完成:还缺 ' + enrichMissing + ' 条字段'),
3495
3504
  h('span', { style: C.muted }, '(榜页没给收藏/字数,要进书页取;点上面的「补全缺失」重试,或等定时续跑)')) : null,
3496
- 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 || '—') + ')' },
3497
3512
  h('div', { style: { ...C.row, flexWrap: 'wrap' } },
3498
3513
  h('span', { style: C.muted }, '每榜取多少条'),
3499
3514
  h('input', {
3500
- type: 'number', min: 1, max: info.max, value: fixedDepth != null ? String(fixedDepth) : depth,
3501
- placeholder: String(fixedDepth != null ? fixedDepth : info.max), disabled: depthLocked || busy,
3502
- 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) },
3503
3517
  style: { ...C.input, width: '58px' },
3504
3518
  }),
3505
- h('span', { style: C.muted }, depthLocked ? '条 · ' + depthNote : '条(上限 ' + info.max + ')'),
3506
- h('button', { className: 'rs-btn', disabled: depthLocked || busy, onClick: function () { saveDepth(false) }, title: depthLocked ? depthNote : '只保存,下次扫描生效' }, '保存'),
3507
- h('button', { className: 'rs-btn', disabled: depthLocked || busy || props.scanBusy, onClick: function () { saveDepth(true) }, title: depthLocked ? depthNote : '保存后立刻抓一次这一榜(联网)' }, '保存并扫描本榜')),
3508
- !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),
3509
3523
  band ? h('div', { style: { ...C.sectionLabel, whiteSpace: 'normal', marginTop: '8px', marginBottom: '8px' } }, band) : null,
3510
3524
  viewDate ? h(Banner, { tone: 'warn' },
3511
3525
  h('span', { style: { fontWeight: 600 } }, '正在查看历史:' + viewDate),
package/lib/index.js CHANGED
@@ -19,7 +19,7 @@ import { authorFromBookTitle, makeSfacgSite, SFACG_BOARDS } from './sites/sfacg.
19
19
  import { CIWEIMAO_BOARDS, CIWEIMAO_BUY_URL } from './sites/ciweimao.js';
20
20
  import { FANQIE_MALE } from './sites/fanqie.js';
21
21
  import { CATEGORIES as QIDIAN_CATEGORIES } from './sites/qidian-mobile.js';
22
- import { deriveFanqieViews } from './scan/derive.js';
22
+ import { deriveFanqieViews, poolDateOf } from './scan/derive.js';
23
23
  import { decodePua, hasPua, learnPair, loadFontMap, saveFontMap } from './scan/fontmap.js';
24
24
  import { applyColumnPolicy, batchKeyOf, batchKindOf, batchLabelOf, boardMeta, columnsFor, compareDesc, defaultSortFor, defaultSortKeyFor, enrichAttemptPolicy, enrichMissingCount, groupBySite, groupChanges, isBatchBoard, isEnrichableBoard, saleRangeOf, shouldShowDays, usesRankDelta, withFanqieCat } from './scan/view.js';
25
25
  import { BookmarkService, BookmarkStore } from './scan/bookmark.js';
@@ -1889,7 +1889,26 @@ export function apply(ctx, config) {
1889
1889
  if (boardId.startsWith('fanqie.derived.')) {
1890
1890
  const read = (b, d) => store.readSnapshot(d, b);
1891
1891
  const pool = st.boards.filter((b) => b.startsWith('fanqie.m.'));
1892
- const views = deriveFanqieViews(read, { date: latest, poolBoards: pool, dataDates: dates });
1892
+ /**
1893
+ * ★ 0.6.1(使用者 2026-10-29「番茄在读周榜有时候卡住显示不了内容」):
1894
+ * 原来拿**全局最新数据日** latest 建池。今天的目录可能只有别的站(实测 2026-10-29 只有起点
1895
+ * 三个榜,番茄 0 个快照)⇒ 池子为空 ⇒ 0 行,而 note 照常输出「已结算 N/7 天」,
1896
+ * 看上去就像面板卡住没内容。
1897
+ * 现在:算池子的日期 = **最新一个番茄真有快照的日期**;全局最新日另有提示。
1898
+ */
1899
+ const hasPoolRows = (d) => pool.some((b) => {
1900
+ const s = store.readSnapshot(d, b);
1901
+ return !!(s && s.rows && s.rows.length);
1902
+ });
1903
+ const poolDates = dates.filter(hasPoolRows);
1904
+ const poolDate = poolDateOf(dates, hasPoolRows);
1905
+ const calcDate = poolDate || latest;
1906
+ const lagNote = !poolDate
1907
+ ? '番茄还没有任何本地快照(' + latest + ' 也没有):先在「设置 → 抓取范围」里勾上番茄,或等下次扫描'
1908
+ : poolDate !== latest
1909
+ ? '番茄最新快照是 ' + poolDate + '(' + latest + ' 还没有番茄快照),本榜按 ' + poolDate + ' 算'
1910
+ : null;
1911
+ const views = deriveFanqieViews(read, { date: calcDate, poolBoards: pool, dataDates: poolDates });
1893
1912
  const v = views.find((x) => x.boardId === boardId) || views[0];
1894
1913
  // 派生榜行自带 extra.periodDelta / gain / settledDays;days 位给「池内天数」(列被 hideColumnsFor 隐藏,仅作诊断)
1895
1914
  let rows = (v ? v.rows : []).map((r) => ({ ...r, days: r.extra && r.extra.inPoolDays != null ? r.extra.inPoolDays : null }));
@@ -1905,7 +1924,7 @@ export function apply(ctx, config) {
1905
1924
  defaultSortKey,
1906
1925
  sortOptions: sortOptionsFor(boardId, meta, { hasHistory }),
1907
1926
  depth: (st.depths || {})[boardId] ?? 30,
1908
- dataDate: latest,
1927
+ dataDate: calcDate,
1909
1928
  dates: datesFor,
1910
1929
  // 期首 = 本期周一(自然周口径);面板「基期」显示的就是它
1911
1930
  baselineDate: v ? v.periodStart : null,
@@ -1914,9 +1933,10 @@ export function apply(ctx, config) {
1914
1933
  settledDays: v ? v.settledDays : 0,
1915
1934
  elapsed: v ? v.elapsed : 0,
1916
1935
  datesLabel: v ? v.datesLabel : '',
1917
- firstEver: dates.length < 2,
1936
+ firstEver: poolDates.length < 2,
1918
1937
  rows,
1919
- note: v ? v.note : null,
1938
+ // 池子不是按「全局最新日」算的时候,必须说清用的是哪天(不然空表看不出原因)
1939
+ note: [lagNote, v ? v.note : null].filter(Boolean).join(';') || null,
1920
1940
  };
1921
1941
  }
1922
1942
  let snap = store.readSnapshot(date, boardId);
@@ -2373,6 +2393,33 @@ export function apply(ctx, config) {
2373
2393
  const captured = new Set(st.boards);
2374
2394
  const shown = new Set(st.display);
2375
2395
  const rows = [];
2396
+ /**
2397
+ * ★ 0.6.2「假设置」审计(使用者 2026-10-29):条数只对**适配器真读 depth** 的榜开放。
2398
+ * 判据看 `src/sites/*.ts`,不看「站点理论上能给多少」:
2399
+ * · 起点 —— 移动端单页固定 20 条,适配器写死(不读 depth)
2400
+ * · 起点图 —— 整页给出,适配器不读 depth(首订当日 20–35、三江 17)
2401
+ * · 刺猬猫首订(约)—— 第三方接口整批给出,depth 无意义
2402
+ * · 番茄派生榜 —— 本地算,按候选池全量出(240 行)
2403
+ * · 菠萝包 —— 首页 SSR 每 tab 固定 10
2404
+ * 其余(番茄分类榜、刺猬猫两个榜单)适配器真按 depth 翻页/截断,才给可调。
2405
+ * 注:canDepth=false 只是**不开放编辑**;config 里已有的旧值原样保留。
2406
+ */
2407
+ const depthLocked = (boardId) => boardId.startsWith('qidian.') || boardId.startsWith('qidiantu.') ||
2408
+ boardId === 'ciweimao.buy.latest' || boardId.startsWith('fanqie.derived.') ||
2409
+ boardId.startsWith('sfacg.');
2410
+ const depthHintOf = (site, boardId) => {
2411
+ if (site === 'qidian')
2412
+ return '移动端榜单单页固定 20 条(站点分页接口在反爬挑战后面,暂不可调)';
2413
+ if (boardId === 'ciweimao.buy.latest')
2414
+ return '第三方接口整批给出(不按条数截取)';
2415
+ if (boardId.startsWith('fanqie.derived.'))
2416
+ return '本地派生榜不设条数(按候选池全量出)';
2417
+ if (site === 'qidiantu')
2418
+ return '起点图整页给出条数(不按深度截取;首订当日榜 20–35 行、三江 17 行左右)';
2419
+ if (site === 'sfacg')
2420
+ return '首页 SSR 每个 tab 固定 10 条(不可调)';
2421
+ return '可调(每页 10 条,翻页取)';
2422
+ };
2376
2423
  const push = (site, siteName, group, boardId, label) => {
2377
2424
  const cap = site === 'qidian' ? 20 : site === 'sfacg' ? 10 : 100;
2378
2425
  rows.push({
@@ -2380,8 +2427,8 @@ export function apply(ctx, config) {
2380
2427
  captured: captured.has(boardId), displayed: shown.has(boardId),
2381
2428
  depth: (st.depths || {})[boardId] ?? defaultDepthFor(boardId),
2382
2429
  maxDepth: cap,
2383
- canDepth: cap > 10,
2384
- depthHint: site === 'qidian' ? '移动端榜单单页固定 20 条(站点分页接口在反爬挑战后面,暂不可调)' : site === 'sfacg' ? '首页 SSR 每个 tab 固定 10 条(不可调)' : site === 'qidiantu' ? '起点图站点自身决定条数(首订当日榜 20–35 条)' : '可调(每页 10 条,翻页取)',
2430
+ canDepth: !depthLocked(boardId),
2431
+ depthHint: depthHintOf(site, boardId),
2385
2432
  });
2386
2433
  };
2387
2434
  // 冻结口径:起点「全站」分类不纳入(cat -1 = 全站)