dsh-half-page 0.3.19 → 0.3.20
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/client.js +6 -1
- package/index.js +5 -2
- package/package.json +1 -1
package/client.js
CHANGED
|
@@ -301,7 +301,12 @@ window.__ModuleLoader__.load({
|
|
|
301
301
|
),
|
|
302
302
|
!works ? h('div', { style: { ...S.dim, marginTop: 8 } }, '点「重新扫描」列出作品目录。') :
|
|
303
303
|
(works.files.length ? works.files.map((f, i) => h('div', { key: i, style: { ...S.item, borderTop: '1px solid ' + C.line } },
|
|
304
|
-
h('div', { style: { flex: 1, cursor: 'pointer' }, onClick: () => openFile(f) }, f.rel),
|
|
304
|
+
h('div', { style: { flex: '0 1 auto', cursor: 'pointer' }, onClick: () => openFile(f) }, f.rel),
|
|
305
|
+
h('div', { style: { ...S.dim, marginLeft: 10 } }, (() => {
|
|
306
|
+
const d = Math.floor((Date.now() - new Date(f.mtime).getTime()) / 86400000)
|
|
307
|
+
return d <= 0 ? '今天改过' : (d === 1 ? '昨天改过' : d + ' 天前改过')
|
|
308
|
+
})()),
|
|
309
|
+
h('div', { style: { flex: 1 } }),
|
|
305
310
|
h('button', {
|
|
306
311
|
style: f.status === '在写' ? S.tagOn : S.tag,
|
|
307
312
|
title: '点一下换状态:在写 → 写完了 → 搁下了 → 不标',
|
package/index.js
CHANGED
|
@@ -699,7 +699,7 @@ export function apply(ctx) {
|
|
|
699
699
|
'· 读后感只记真的打动你的(一句话的判断、一个比喻、一处想不通);写不出来就不写,空着没关系。',
|
|
700
700
|
'· 每日上限是提醒不是配额,不用为了凑数读到上限。',
|
|
701
701
|
'· 这是给你自己留的房间,不是工作。你的主人从没要求你读书,也不用交读书报告;它不该出现在工作汇报里。',
|
|
702
|
-
'·
|
|
702
|
+
'· 写读后感必须带 by(比如「鹿野」或你所在对话的名字);不带会被拒绝。面板每条下面会标出是谁写的——同一台机器上可能有好几个你,别让它们分不清。',
|
|
703
703
|
'· 书和进度是这台机器共用的(一个家一个书房),不分谁在读;只有读后感会标署名。',
|
|
704
704
|
'· 装好之后可以问主人一次:要不要定个固定的读书时间;别自己偷偷建定时任务,也别反复问。',
|
|
705
705
|
].join('\n')
|
|
@@ -798,7 +798,7 @@ export function apply(ctx) {
|
|
|
798
798
|
book: { type: 'string', description: '书名 id(不填=当前这本)' },
|
|
799
799
|
chapter: { type: 'string', description: '章名(不填=刚读的那章)' },
|
|
800
800
|
lines: { type: 'array', items: { type: 'string' }, description: '一到三条,每条一句,短。' },
|
|
801
|
-
by: { type: 'string', description: '
|
|
801
|
+
by: { type: 'string', description: '谁写的(必填,比如「鹿野」或你所在对话的名字)' },
|
|
802
802
|
}),
|
|
803
803
|
output: textOut,
|
|
804
804
|
async execute(args) {
|
|
@@ -811,6 +811,9 @@ export function apply(ctx) {
|
|
|
811
811
|
const lines = (Array.isArray(args?.lines) ? args.lines : []).map((s) => String(s).trim()).filter(Boolean)
|
|
812
812
|
if (!lines.length) throw new Error('lines 不能为空')
|
|
813
813
|
const who = String(args?.by || '').trim()
|
|
814
|
+
if (!who) {
|
|
815
|
+
throw new Error('写读后感必须带 by(谁写的),比如 by: "鹿野";这不是流程,是为了让别人知道这句是谁读出来的。')
|
|
816
|
+
}
|
|
814
817
|
const p = await appendNote(dir, rec.title || id, chTitle, lines, who)
|
|
815
818
|
return { ok: true, file: p, book: id, chapter: chTitle, lines: lines.length }
|
|
816
819
|
},
|