@kanadego/dsh-heartbeat 2.1.1 → 2.2.0
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 +15 -16
- package/client.js +275 -60
- package/dist/bili-login-XQVEE4M6.js +32 -0
- package/dist/{chunk-HE6IF6OU.js → chunk-F2XVKX55.js} +14 -1
- package/dist/chunk-F2XVKX55.js.map +1 -0
- package/dist/{chunk-63E5OYSI.js → chunk-N6SMIGYJ.js} +46 -19
- package/dist/chunk-N6SMIGYJ.js.map +1 -0
- package/dist/chunk-OCBE2AKW.js +25 -0
- package/dist/chunk-OCBE2AKW.js.map +1 -0
- package/dist/chunk-SIY3YHFY.js +221 -0
- package/dist/chunk-SIY3YHFY.js.map +1 -0
- package/dist/{chunk-XCMGPIUQ.js → chunk-WF7ZBW5C.js} +196 -70
- package/dist/chunk-WF7ZBW5C.js.map +1 -0
- package/dist/{chunk-LPPRI53J.js → chunk-XYBII5PR.js} +2 -2
- package/dist/cli/index.js +47 -14
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +11 -0
- package/dist/index.js +368 -29
- package/dist/index.js.map +1 -1
- package/dist/{orchestrator-MNFCPH43.js → orchestrator-QE2XVVM6.js} +12 -4
- package/dist/{pool-MAABBHC4.js → pool-76VLAZER.js} +4 -2
- package/dist/pool-76VLAZER.js.map +1 -0
- package/package.json +5 -3
- package/dist/chunk-63E5OYSI.js.map +0 -1
- package/dist/chunk-HE6IF6OU.js.map +0 -1
- package/dist/chunk-XCMGPIUQ.js.map +0 -1
- /package/dist/{orchestrator-MNFCPH43.js.map → bili-login-XQVEE4M6.js.map} +0 -0
- /package/dist/{chunk-LPPRI53J.js.map → chunk-XYBII5PR.js.map} +0 -0
- /package/dist/{pool-MAABBHC4.js.map → orchestrator-QE2XVVM6.js.map} +0 -0
package/client.js
CHANGED
|
@@ -4,8 +4,10 @@
|
|
|
4
4
|
// types on 0.1.1-rc.2; reworked for 0.1.7-rc.2 in v1.7.0):
|
|
5
5
|
// - the client module is applied as a CLIENT-SIDE cordis plugin; the
|
|
6
6
|
// ModuleLoader factory must return an object with an "apply" method;
|
|
7
|
-
// - the panel is
|
|
8
|
-
//
|
|
7
|
+
// - the panel is registered on 'plugins.bundle.config' under BOTH the short
|
|
8
|
+
// key 'dsh-heartbeat' and the scoped key '@kanadego/dsh-heartbeat'
|
|
9
|
+
// (install key differs between file: installs and npm installs; same
|
|
10
|
+
// component, two keys); the old settings.section
|
|
9
11
|
// card was retired in v2.1.0;
|
|
10
12
|
// - the rhythm editor rides the /api RPC channel (host persists to
|
|
11
13
|
// data/settings/ui.json and applies live) — no host settings API needed;
|
|
@@ -84,6 +86,10 @@ const PANEL_CSS = [
|
|
|
84
86
|
".hb-ok{font-size:12px;color:#2fbf7f;border:1px solid rgba(61,220,151,.5);border-radius:9px;padding:6px 10px;word-break:break-all;background:rgba(61,220,151,.08)}",
|
|
85
87
|
".hb-scroll{max-height:340px;overflow-y:auto;padding:2px}",
|
|
86
88
|
".hb-pre{margin:0;font-family:ui-monospace,Consolas,monospace;font-size:11px;line-height:1.6;white-space:pre-wrap;word-break:break-word;max-height:320px;overflow:auto;border-radius:9px;padding:8px 10px;background:rgba(127,127,127,.10)}",
|
|
89
|
+
// B站扫码登录弹层(v2.3.0):全屏半透明遮罩 + 居中小卡,二维码放白底上保证对比度
|
|
90
|
+
".hb-modalMask{position:fixed;inset:0;z-index:1000;display:flex;align-items:center;justify-content:center;background:rgba(0,0,0,.45)}",
|
|
91
|
+
".hb-modal{display:flex;flex-direction:column;align-items:center;gap:10px;max-width:320px;padding:18px 20px;border-radius:14px;border:1px solid var(--dsw-alias-border-l2,rgba(127,127,127,.25));background:var(--dsw-alias-bg-layer-1,#fff);box-shadow:0 18px 50px rgba(0,0,0,.35)}",
|
|
92
|
+
".hb-qrImg{width:240px;height:240px;border-radius:8px;background:#fff;padding:8px;box-sizing:border-box}",
|
|
87
93
|
].join("");
|
|
88
94
|
function ensurePanelStyle() {
|
|
89
95
|
try {
|
|
@@ -176,9 +182,29 @@ const LOCALE_NS = "heartbeat";
|
|
|
176
182
|
"seeds.hintTopic": "浏览流、手写、画像喂进来的:随机挑,可重复用",
|
|
177
183
|
"seeds.emptyArchived": "(这类还没有归档条目)",
|
|
178
184
|
"seeds.empty": "(这类还没有条目)",
|
|
185
|
+
"seeds.filterPlaceholder": "关键字过滤(匹配 文本 / 标签 / 来源)",
|
|
186
|
+
"seeds.filterClear": "清除",
|
|
187
|
+
"seeds.filterNoMatch": "没有匹配关键字的条目,换个词试试",
|
|
188
|
+
"seeds.filterHint": "过滤后剩 {n} 条",
|
|
189
|
+
"seeds.usedCount": "已用 {n} 次",
|
|
179
190
|
"seeds.restore": "恢复",
|
|
180
191
|
"seeds.archive": "归档",
|
|
181
192
|
"seeds.used": " used:{used}",
|
|
193
|
+
"bili.sourceTitle": "素材来源",
|
|
194
|
+
"bili.status.loggedIn": "B站 · 已登录(保存于 {time})",
|
|
195
|
+
"bili.status.notLoggedIn": "B站 · 未登录",
|
|
196
|
+
"bili.loginButton": "扫码登录",
|
|
197
|
+
"bili.reloginButton": "重新登录",
|
|
198
|
+
"bili.state.starting": "正在获取二维码…",
|
|
199
|
+
"bili.state.waiting": "等待扫码…",
|
|
200
|
+
"bili.state.scanned": "已扫码,请在手机上确认",
|
|
201
|
+
"bili.state.success": "登录成功",
|
|
202
|
+
"bili.state.expired": "二维码已过期,请重新获取",
|
|
203
|
+
"bili.state.error": "登录失败",
|
|
204
|
+
"bili.state.errorDetail": "失败原因:{error}",
|
|
205
|
+
"bili.qrHeading": "B站扫码登录",
|
|
206
|
+
"bili.qrHint": "用 B站 App 扫码,登录后才能抓取 B站素材",
|
|
207
|
+
"bili.cancel": "取消",
|
|
182
208
|
"interests.added": "已添加",
|
|
183
209
|
"interests.addFailed": "添加失败:{error}",
|
|
184
210
|
"interests.deleted": "已删除",
|
|
@@ -192,6 +218,8 @@ const LOCALE_NS = "heartbeat";
|
|
|
192
218
|
"interests.to": "到",
|
|
193
219
|
"interests.addWindow": "加一个时段",
|
|
194
220
|
"interests.saveWindows": "保存时段",
|
|
221
|
+
"interests.stats": "当前兴趣 {n} 条 · 浏览时段 {m} 个",
|
|
222
|
+
"interests.statsNote": "面板暂无法区分出厂默认与已改过(接口未返回该标记),以上为当前生效条数",
|
|
195
223
|
"profile.tabInterest": "兴趣",
|
|
196
224
|
"profile.tabProjects": "进行中",
|
|
197
225
|
"profile.tabComm": "沟通偏好",
|
|
@@ -211,12 +239,16 @@ const LOCALE_NS = "heartbeat";
|
|
|
211
239
|
"profile.stale": " 久未验证",
|
|
212
240
|
"profile.updated": " 更新 {date}",
|
|
213
241
|
"profile.exportMarkdown": "导出 Markdown",
|
|
242
|
+
"profile.expand": "展开全文",
|
|
243
|
+
"profile.collapse": "收起",
|
|
214
244
|
"config.saved": "已保存(即时生效,无需重启)",
|
|
215
245
|
"config.saveFailed": "保存失败:{error}",
|
|
216
246
|
"config.interval": "心跳间隔(分钟)",
|
|
217
247
|
"config.cap": "每日表达上限(条)",
|
|
218
248
|
"config.timeInject": "时间注入间隔(分钟)",
|
|
219
249
|
"config.timeInjectOff": "0 = 关闭",
|
|
250
|
+
"config.quietHours": "静默时段",
|
|
251
|
+
"config.quietHoursHint": "这段时间内不主动出声;保存后下一跳生效",
|
|
220
252
|
"config.statusbar": "状态栏",
|
|
221
253
|
"config.statusbarHint": "日常会话中的心跳状态感知(会额外消耗token)",
|
|
222
254
|
"config.idle": "闲着模式",
|
|
@@ -233,8 +265,19 @@ const LOCALE_NS = "heartbeat";
|
|
|
233
265
|
"config.focusPaused": "已暂停至 {clock}",
|
|
234
266
|
"config.focusMinutes": "分钟",
|
|
235
267
|
"config.focusFailed": "操作失败:{error}",
|
|
268
|
+
"config.group.rhythm": "节律",
|
|
269
|
+
"config.group.rhythmDesc": "心跳多久跳一次、一天最多说几条。",
|
|
270
|
+
"config.group.time": "时间与状态栏",
|
|
271
|
+
"config.group.timeDesc": "给日常会话注入精确时间、在会话里挂一条心跳状态。",
|
|
272
|
+
"config.group.express": "表达",
|
|
273
|
+
"config.group.expressDesc": "心跳说话的方式与开销。",
|
|
274
|
+
"config.group.focus": "专注模式",
|
|
275
|
+
"config.group.focusDesc": "需要安静时手动暂停心跳,到点自动恢复。它是即时生效的独立开关:点按钮立刻暂停/恢复,不走下面的「保存」。",
|
|
276
|
+
"config.effect.now": "多久生效:保存后定时器立刻按新间隔重排,下一次心跳就按新间隔走(无需重启)。",
|
|
277
|
+
"config.effect.next": "多久生效:保存后从下一跳开始生效(无需重启)。",
|
|
236
278
|
"weekly.intro": "每 7 天生成一份:本周表达与静默、新认识、账本、素材池与活跃高峰。报告只陈述事实,由后台「心跳」署名。",
|
|
237
279
|
"weekly.empty": "(还没有周报——装好一周后自动出第一期)",
|
|
280
|
+
"weekly.showBody": "展开查看报告正文",
|
|
238
281
|
"migrate.processing": "处理中…",
|
|
239
282
|
"migrate.failed": "失败:{error}",
|
|
240
283
|
"migrate.pwMismatch": "两次口令不一致或为空",
|
|
@@ -250,6 +293,8 @@ const LOCALE_NS = "heartbeat";
|
|
|
250
293
|
"migrate.filePlaceholder": "迁移包完整路径(.hbmig)",
|
|
251
294
|
"migrate.pwPlaceholderShort": "口令",
|
|
252
295
|
"migrate.importButton": "导入",
|
|
296
|
+
"migrate.confirmImport": "确认导入(覆盖本机数据)",
|
|
297
|
+
"migrate.confirmHint": "⚠ 危险操作:导入会用迁移包覆盖本机的心跳数据(被替换的文件会自动备份)。确认路径和口令无误后,再点一次「确认导入」才会执行。",
|
|
253
298
|
"section.status": "心跳状态",
|
|
254
299
|
"section.sessions": "会话绑定",
|
|
255
300
|
"section.seeds": "素材池",
|
|
@@ -357,9 +402,29 @@ const LOCALE_NS = "heartbeat";
|
|
|
357
402
|
"seeds.hintTopic": "From browsing, handwriting, and the profile: picked at random and reusable",
|
|
358
403
|
"seeds.emptyArchived": "(No archived entries of this kind yet)",
|
|
359
404
|
"seeds.empty": "(No entries of this kind yet)",
|
|
405
|
+
"seeds.filterPlaceholder": "Keyword filter (matches text / tag / source)",
|
|
406
|
+
"seeds.filterClear": "Clear",
|
|
407
|
+
"seeds.filterNoMatch": "No entries match this keyword — try another word",
|
|
408
|
+
"seeds.filterHint": "{n} entries after filtering",
|
|
409
|
+
"seeds.usedCount": "Used {n} times",
|
|
360
410
|
"seeds.restore": "Restore",
|
|
361
411
|
"seeds.archive": "Archive",
|
|
362
412
|
"seeds.used": " used: {used}",
|
|
413
|
+
"bili.sourceTitle": "Material sources",
|
|
414
|
+
"bili.status.loggedIn": "Bilibili · logged in (saved {time})",
|
|
415
|
+
"bili.status.notLoggedIn": "Bilibili · not logged in",
|
|
416
|
+
"bili.loginButton": "Scan to log in",
|
|
417
|
+
"bili.reloginButton": "Log in again",
|
|
418
|
+
"bili.state.starting": "Fetching QR code…",
|
|
419
|
+
"bili.state.waiting": "Waiting for scan…",
|
|
420
|
+
"bili.state.scanned": "Scanned — confirm on your phone",
|
|
421
|
+
"bili.state.success": "Logged in",
|
|
422
|
+
"bili.state.expired": "QR code expired — please start again",
|
|
423
|
+
"bili.state.error": "Login failed",
|
|
424
|
+
"bili.state.errorDetail": "Reason: {error}",
|
|
425
|
+
"bili.qrHeading": "Bilibili QR login",
|
|
426
|
+
"bili.qrHint": "Scan with the Bilibili app; the login is used for fetching Bilibili material",
|
|
427
|
+
"bili.cancel": "Cancel",
|
|
363
428
|
"interests.added": "Added",
|
|
364
429
|
"interests.addFailed": "Failed to add: {error}",
|
|
365
430
|
"interests.deleted": "Deleted",
|
|
@@ -373,6 +438,8 @@ const LOCALE_NS = "heartbeat";
|
|
|
373
438
|
"interests.to": "to",
|
|
374
439
|
"interests.addWindow": "Add a window",
|
|
375
440
|
"interests.saveWindows": "Save windows",
|
|
441
|
+
"interests.stats": "{n} interests · {m} browsing windows",
|
|
442
|
+
"interests.statsNote": "The panel cannot tell factory defaults from edited entries (the API does not expose that marker); the counts above are what is currently in effect",
|
|
376
443
|
"profile.tabInterest": "Interests",
|
|
377
444
|
"profile.tabProjects": "In progress",
|
|
378
445
|
"profile.tabComm": "Communication preferences",
|
|
@@ -392,12 +459,16 @@ const LOCALE_NS = "heartbeat";
|
|
|
392
459
|
"profile.stale": " · not verified for a while",
|
|
393
460
|
"profile.updated": " · updated {date}",
|
|
394
461
|
"profile.exportMarkdown": "Export Markdown",
|
|
462
|
+
"profile.expand": "Show full text",
|
|
463
|
+
"profile.collapse": "Collapse",
|
|
395
464
|
"config.saved": "Saved (takes effect immediately, no restart needed)",
|
|
396
465
|
"config.saveFailed": "Failed to save: {error}",
|
|
397
466
|
"config.interval": "Heartbeat interval (minutes)",
|
|
398
467
|
"config.cap": "Daily expression limit",
|
|
399
468
|
"config.timeInject": "Time injection interval (minutes)",
|
|
400
469
|
"config.timeInjectOff": "0 = off",
|
|
470
|
+
"config.quietHours": "Quiet hours",
|
|
471
|
+
"config.quietHoursHint": "No proactive messages during this window; takes effect on the next beat after saving",
|
|
401
472
|
"config.statusbar": "Status bar",
|
|
402
473
|
"config.statusbarHint": "Show heartbeat status in everyday conversations (uses extra tokens)",
|
|
403
474
|
"config.idle": "Idle mode",
|
|
@@ -414,8 +485,19 @@ const LOCALE_NS = "heartbeat";
|
|
|
414
485
|
"config.focusPaused": "Paused until {clock}",
|
|
415
486
|
"config.focusMinutes": "min",
|
|
416
487
|
"config.focusFailed": "Failed: {error}",
|
|
488
|
+
"config.group.rhythm": "Rhythm",
|
|
489
|
+
"config.group.rhythmDesc": "How often the heartbeat beats, and how many messages it may send per day.",
|
|
490
|
+
"config.group.time": "Time & status bar",
|
|
491
|
+
"config.group.timeDesc": "Inject precise time into everyday sessions and pin a heartbeat status there.",
|
|
492
|
+
"config.group.express": "Expression",
|
|
493
|
+
"config.group.expressDesc": "How the heartbeat talks, and what it costs.",
|
|
494
|
+
"config.group.focus": "Focus mode",
|
|
495
|
+
"config.group.focusDesc": "Pause the heartbeat manually when you need quiet; it resumes automatically when time is up. This is an instant, independent switch: clicking the button pauses/resumes right away, without going through Save below.",
|
|
496
|
+
"config.effect.now": "When it takes effect: after saving, the timer is rescheduled to the new interval immediately, so the very next heartbeat follows it (no restart needed).",
|
|
497
|
+
"config.effect.next": "When it takes effect: after saving, changes apply from the next heartbeat on (no restart needed).",
|
|
417
498
|
"weekly.intro": "Generated every 7 days: this week's expressions and silences, new acquaintances, ledger, material pool, and activity peaks. The report states facts only and is signed by the background Heartbeat.",
|
|
418
499
|
"weekly.empty": "(No weekly report yet — the first one appears a week after installation)",
|
|
500
|
+
"weekly.showBody": "Show report body",
|
|
419
501
|
"migrate.processing": "Working…",
|
|
420
502
|
"migrate.failed": "Failed: {error}",
|
|
421
503
|
"migrate.pwMismatch": "The two passphrases do not match, or are empty",
|
|
@@ -431,6 +513,8 @@ const LOCALE_NS = "heartbeat";
|
|
|
431
513
|
"migrate.filePlaceholder": "Full path to the migration package (.hbmig)",
|
|
432
514
|
"migrate.pwPlaceholderShort": "Passphrase",
|
|
433
515
|
"migrate.importButton": "Import",
|
|
516
|
+
"migrate.confirmImport": "Confirm import (overwrites local data)",
|
|
517
|
+
"migrate.confirmHint": "⚠ Dangerous operation: importing overwrites this machine's heartbeat data with the migration package (replaced files are backed up automatically). Once the path and passphrase are verified, click Confirm import one more time to proceed.",
|
|
434
518
|
"section.status": "Heartbeat status",
|
|
435
519
|
"section.sessions": "Session bindings",
|
|
436
520
|
"section.seeds": "Material pool",
|
|
@@ -548,6 +632,15 @@ const LOCALE_NS = "heartbeat";
|
|
|
548
632
|
return d.toLocaleString(localeTag(), { hour12: false });
|
|
549
633
|
} catch { return String(iso); }
|
|
550
634
|
};
|
|
635
|
+
// MM-DD HH:mm(本地时区),用于「保存于 …」这类紧凑时间戳
|
|
636
|
+
const fmtMonthDayClock = (ms) => {
|
|
637
|
+
try {
|
|
638
|
+
const d = new Date(ms);
|
|
639
|
+
if (Number.isNaN(d.getTime())) return String(ms);
|
|
640
|
+
const two = (n) => String(n).padStart(2, "0");
|
|
641
|
+
return two(d.getMonth() + 1) + "-" + two(d.getDate()) + " " + two(d.getHours()) + ":" + two(d.getMinutes());
|
|
642
|
+
} catch { return String(ms); }
|
|
643
|
+
};
|
|
551
644
|
|
|
552
645
|
// ── 心跳状态卡片 ──────────────────────────────────────────────
|
|
553
646
|
function StatusCard() {
|
|
@@ -696,17 +789,137 @@ const LOCALE_NS = "heartbeat";
|
|
|
696
789
|
);
|
|
697
790
|
}
|
|
698
791
|
|
|
792
|
+
// ── 素材来源:B站扫码登录(v2.3.0)─────────────────────────────
|
|
793
|
+
// 素材 tab 顶部的登录入口:状态行走 bili.status;扫码流程走
|
|
794
|
+
// bili.login.start 拿 dataURL 二维码(弹层展示),之后每 2 秒
|
|
795
|
+
// bili.login.poll 轮询一次。成功/过期/出错即停表并收起弹层,
|
|
796
|
+
// 成功后刷新登录状态;弹层有「取消」按钮、点遮罩空白也能关。
|
|
797
|
+
// 卸载时清掉轮询定时器。所有文案走 DICT。
|
|
798
|
+
function BiliLoginCard() {
|
|
799
|
+
const [status, setStatus] = React.useState(null);
|
|
800
|
+
const [phase, setPhase] = React.useState("idle"); // idle|starting|waiting|scanned|success|expired|error
|
|
801
|
+
const [errMsg, setErrMsg] = React.useState("");
|
|
802
|
+
const [qrDataUrl, setQrDataUrl] = React.useState(null);
|
|
803
|
+
const [modal, setModal] = React.useState(false);
|
|
804
|
+
const pollTimer = React.useRef(null);
|
|
805
|
+
// 竞态守卫:sessionRef 记当前有效的 sessionId,startSeqRef 给每次 start
|
|
806
|
+
// 发号。连点/旧流程晚归时,过期的 start 结果与 poll 回调一律忽略,
|
|
807
|
+
// 不会误关新弹层。
|
|
808
|
+
const sessionRef = React.useRef(null);
|
|
809
|
+
const startSeqRef = React.useRef(0);
|
|
810
|
+
const stopPolling = React.useCallback(() => {
|
|
811
|
+
if (pollTimer.current !== null) { clearInterval(pollTimer.current); pollTimer.current = null; }
|
|
812
|
+
}, []);
|
|
813
|
+
// 组件卸载:轮询定时器必须跟着走,不留后台请求
|
|
814
|
+
React.useEffect(() => () => stopPolling(), [stopPolling]);
|
|
815
|
+
const reload = React.useCallback(() => {
|
|
816
|
+
rpc("bili.status").then(setStatus, () => setStatus({ loggedIn: false, savedAt: null }));
|
|
817
|
+
}, []);
|
|
818
|
+
React.useEffect(() => { reload(); }, [reload]);
|
|
819
|
+
const closeLogin = (next, message) => {
|
|
820
|
+
stopPolling();
|
|
821
|
+
sessionRef.current = null;
|
|
822
|
+
setQrDataUrl(null);
|
|
823
|
+
setModal(false);
|
|
824
|
+
setPhase(next);
|
|
825
|
+
setErrMsg(message || "");
|
|
826
|
+
if (next === "success") reload();
|
|
827
|
+
};
|
|
828
|
+
// 用户主动放弃:会话留在服务端内存里自然过期,不为此新增 rpc 调用
|
|
829
|
+
const cancelLogin = () => {
|
|
830
|
+
stopPolling();
|
|
831
|
+
startSeqRef.current += 1; // 让在途的 start 结果作废
|
|
832
|
+
sessionRef.current = null;
|
|
833
|
+
setQrDataUrl(null);
|
|
834
|
+
setModal(false);
|
|
835
|
+
setPhase("idle");
|
|
836
|
+
setErrMsg("");
|
|
837
|
+
};
|
|
838
|
+
const startLogin = async () => {
|
|
839
|
+
stopPolling();
|
|
840
|
+
const seq = ++startSeqRef.current;
|
|
841
|
+
setErrMsg("");
|
|
842
|
+
setPhase("starting");
|
|
843
|
+
let v;
|
|
844
|
+
try {
|
|
845
|
+
v = await rpc("bili.login.start");
|
|
846
|
+
} catch (e) {
|
|
847
|
+
if (startSeqRef.current !== seq) return; // 已被更新的启动/取消取代
|
|
848
|
+
setPhase("error");
|
|
849
|
+
setErrMsg(String(e).slice(0, 80));
|
|
850
|
+
return;
|
|
851
|
+
}
|
|
852
|
+
if (startSeqRef.current !== seq) return; // 晚归的旧结果:丢弃
|
|
853
|
+
sessionRef.current = v.sessionId;
|
|
854
|
+
setQrDataUrl(v.qrDataUrl);
|
|
855
|
+
setModal(true);
|
|
856
|
+
setPhase("waiting");
|
|
857
|
+
stopPolling();
|
|
858
|
+
pollTimer.current = setInterval(() => {
|
|
859
|
+
rpc("bili.login.poll", { sessionId: v.sessionId }).then(
|
|
860
|
+
(r) => {
|
|
861
|
+
if (sessionRef.current !== v.sessionId) return; // 非当前会话:忽略
|
|
862
|
+
if (r.state === "waiting" || r.state === "scanned") { setPhase(r.state); return; }
|
|
863
|
+
if (r.state === "success") closeLogin("success");
|
|
864
|
+
else if (r.state === "expired") closeLogin("expired");
|
|
865
|
+
else closeLogin("error", r.message || "");
|
|
866
|
+
},
|
|
867
|
+
(e) => {
|
|
868
|
+
if (sessionRef.current !== v.sessionId) return;
|
|
869
|
+
closeLogin("error", String(e).slice(0, 80));
|
|
870
|
+
},
|
|
871
|
+
);
|
|
872
|
+
}, 2000);
|
|
873
|
+
};
|
|
874
|
+
const loggedIn = !!(status && status.loggedIn);
|
|
875
|
+
const savedAt = status && status.loggedIn && typeof status.savedAt === "number" ? status.savedAt : null;
|
|
876
|
+
const stateLine = status === null ? t("common.loading")
|
|
877
|
+
: loggedIn ? L("bili.status.loggedIn", { time: savedAt !== null ? fmtMonthDayClock(savedAt) : t("common.unknown") })
|
|
878
|
+
: t("bili.status.notLoggedIn");
|
|
879
|
+
const phaseText = phase === "starting" ? t("bili.state.starting")
|
|
880
|
+
: phase === "waiting" ? t("bili.state.waiting")
|
|
881
|
+
: phase === "scanned" ? t("bili.state.scanned")
|
|
882
|
+
: phase === "success" ? t("bili.state.success")
|
|
883
|
+
: phase === "expired" ? t("bili.state.expired")
|
|
884
|
+
: phase === "error" ? t("bili.state.error")
|
|
885
|
+
: null;
|
|
886
|
+
const badgeCls = loggedIn ? "hb-badge hb-badgeOk" : "hb-badge hb-badgeOff";
|
|
887
|
+
return React.createElement(
|
|
888
|
+
"div",
|
|
889
|
+
{ className: "hb-card" },
|
|
890
|
+
React.createElement("div", { className: "hb-cardHead" },
|
|
891
|
+
React.createElement("span", { className: "hb-cardTitle" }, t("bili.sourceTitle")),
|
|
892
|
+
React.createElement("span", { className: badgeCls },
|
|
893
|
+
React.createElement("i", { className: "hb-dot" }),
|
|
894
|
+
stateLine)),
|
|
895
|
+
React.createElement("div", { className: "hb-row" },
|
|
896
|
+
React.createElement("button", {
|
|
897
|
+
className: phase === "starting" ? "hb-btn" : "hb-btn hb-btnPrimary",
|
|
898
|
+
disabled: phase === "starting",
|
|
899
|
+
onClick: () => { void startLogin(); },
|
|
900
|
+
}, loggedIn ? t("bili.reloginButton") : t("bili.loginButton")),
|
|
901
|
+
phaseText ? React.createElement("span", { className: phase === "error" ? "hb-err" : "hb-ok" },
|
|
902
|
+
phase === "error" && errMsg ? L("bili.state.errorDetail", { error: errMsg }) : phaseText) : null),
|
|
903
|
+
modal ? React.createElement(
|
|
904
|
+
"div",
|
|
905
|
+
{ className: "hb-modalMask", onClick: (e) => { if (e.target === e.currentTarget) cancelLogin(); } },
|
|
906
|
+
React.createElement(
|
|
907
|
+
"div",
|
|
908
|
+
{ className: "hb-modal" },
|
|
909
|
+
React.createElement("div", { className: "hb-cardTitle" }, t("bili.qrHeading")),
|
|
910
|
+
React.createElement("img", { className: "hb-qrImg", src: qrDataUrl, alt: t("bili.qrHeading") }),
|
|
911
|
+
React.createElement("div", { className: "hb-hint" },
|
|
912
|
+
phase === "scanned" ? t("bili.state.scanned") : t("bili.state.waiting")),
|
|
913
|
+
React.createElement("div", { className: "hb-hint" }, t("bili.qrHint")),
|
|
914
|
+
React.createElement("button", { className: "hb-btn", onClick: cancelLogin }, t("bili.cancel")),
|
|
915
|
+
),
|
|
916
|
+
) : null,
|
|
917
|
+
);
|
|
918
|
+
}
|
|
919
|
+
|
|
699
920
|
// ── 素材池(v1.9.3 三版):话题 / 聊天 × 活跃 / 归档,四个按钮各看一类 ──
|
|
700
921
|
// 和画像分区同一套 tab 交互,风格统一;一次只看一类。
|
|
701
922
|
function SeedsSection() {
|
|
702
|
-
// 面板版新增文案(不改 DICT,仅本函数使用)
|
|
703
|
-
const TXT = {
|
|
704
|
-
filterPlaceholder: "关键字过滤(匹配 文本 / 标签 / 来源)",
|
|
705
|
-
filterClear: "清除",
|
|
706
|
-
filterNoMatch: "没有匹配关键字的条目,换个词试试",
|
|
707
|
-
filterHint: (n) => "过滤后剩 " + n + " 条",
|
|
708
|
-
used: (n) => "已用 " + n + " 次",
|
|
709
|
-
};
|
|
710
923
|
const [data, setData] = React.useState(null);
|
|
711
924
|
const [error, setError] = React.useState(null);
|
|
712
925
|
const [tab, setTab] = React.useState("topic");
|
|
@@ -728,7 +941,7 @@ const LOCALE_NS = "heartbeat";
|
|
|
728
941
|
React.createElement("div", { style: { display: "flex", alignItems: "center", gap: 6, flexWrap: "wrap", marginBottom: 2 } },
|
|
729
942
|
React.createElement("span", { style: chip }, String(s.tag)),
|
|
730
943
|
React.createElement("span", { style: chip }, String(s.source)),
|
|
731
|
-
React.createElement("span", { style: hintStyle },
|
|
944
|
+
React.createElement("span", { style: hintStyle }, t("seeds.usedCount", { n: s.used || 0 })),
|
|
732
945
|
),
|
|
733
946
|
React.createElement("div", { style: { fontSize: 12.5, wordBreak: "break-word", color: "var(--dsw-alias-label-secondary)" }, title: s.text },
|
|
734
947
|
String(s.text || "").length > 80 ? String(s.text).slice(0, 80) + "…" : String(s.text || "")),
|
|
@@ -769,8 +982,8 @@ const LOCALE_NS = "heartbeat";
|
|
|
769
982
|
null,
|
|
770
983
|
React.createElement("div", { style: hintStyle }, L("seeds.activeSummary", { active: data.active.length, cap: data.cap, archived: data.archived.length })),
|
|
771
984
|
React.createElement("div", { style: rowStyle },
|
|
772
|
-
React.createElement("input", { style: { ...inputStyle, width: "100%", boxSizing: "border-box" }, placeholder:
|
|
773
|
-
kw ? React.createElement("button", { style: buttonGhost, onClick: () => setFilter("") },
|
|
985
|
+
React.createElement("input", { style: { ...inputStyle, width: "100%", boxSizing: "border-box" }, placeholder: t("seeds.filterPlaceholder"), value: filter, onChange: (e) => setFilter(e.target.value) }),
|
|
986
|
+
kw ? React.createElement("button", { style: buttonGhost, onClick: () => setFilter("") }, t("seeds.filterClear")) : null,
|
|
774
987
|
),
|
|
775
988
|
React.createElement("div", { style: tabRow },
|
|
776
989
|
tabButton("topic", t("seeds.tabTopic"), topics.length),
|
|
@@ -784,9 +997,9 @@ const LOCALE_NS = "heartbeat";
|
|
|
784
997
|
? React.createElement("div", { style: hintStyle },
|
|
785
998
|
categoryEmpty
|
|
786
999
|
? (archived ? t("seeds.emptyArchived") : t("seeds.empty"))
|
|
787
|
-
:
|
|
1000
|
+
: t("seeds.filterNoMatch"))
|
|
788
1001
|
: React.createElement("div", { style: scrollBox },
|
|
789
|
-
kw ? React.createElement("div", { style: { ...hintStyle, padding: "2px 0" } },
|
|
1002
|
+
kw ? React.createElement("div", { style: { ...hintStyle, padding: "2px 0" } }, t("seeds.filterHint", { n: list.length })) : null,
|
|
790
1003
|
list.map((s) => row(s, archived))),
|
|
791
1004
|
);
|
|
792
1005
|
}
|
|
@@ -795,12 +1008,6 @@ const LOCALE_NS = "heartbeat";
|
|
|
795
1008
|
// 首编继承出厂:第一次增删/存时段时,插件自动把出厂 interests.json
|
|
796
1009
|
// 完整复制进 data/settings/interests.json,之后卡片就是唯一入口。
|
|
797
1010
|
function InterestsSection() {
|
|
798
|
-
// 面板版新增文案(不改 DICT,仅本函数使用)
|
|
799
|
-
const TXT = {
|
|
800
|
-
stats: (n, m) => "当前兴趣 " + n + " 条 · 浏览时段 " + m + " 个",
|
|
801
|
-
// 如实说明:rpc 没有返回「出厂默认 / 已改过」标记字段,只能显示当前生效条数
|
|
802
|
-
statsNote: "面板暂无法区分出厂默认与已改过(接口未返回该标记),以上为当前生效条数",
|
|
803
|
-
};
|
|
804
1011
|
const [data, setData] = React.useState(null);
|
|
805
1012
|
const [error, setError] = React.useState(null);
|
|
806
1013
|
const [status, setStatus] = React.useState("");
|
|
@@ -841,8 +1048,8 @@ const LOCALE_NS = "heartbeat";
|
|
|
841
1048
|
"div",
|
|
842
1049
|
null,
|
|
843
1050
|
React.createElement("div", { style: { ...hintStyle, fontWeight: 600, color: "var(--dsw-alias-label-secondary)" } },
|
|
844
|
-
|
|
845
|
-
React.createElement("div", { style: hintStyle },
|
|
1051
|
+
t("interests.stats", { n: interests.length, m: windowsCount })),
|
|
1052
|
+
React.createElement("div", { style: hintStyle }, t("interests.statsNote")),
|
|
846
1053
|
React.createElement("div", { style: hintStyle }, t("interests.hint")),
|
|
847
1054
|
interests.map((item) => React.createElement("div", { key: item, style: rowList },
|
|
848
1055
|
React.createElement("span", { style: { flex: 1, fontSize: 12 } }, item),
|
|
@@ -890,8 +1097,6 @@ const LOCALE_NS = "heartbeat";
|
|
|
890
1097
|
// 「引擎室输入」视图。新增:单条正文过长(约超 4 行)时默认收起,
|
|
891
1098
|
// 点「展开全文」看全文;刷新 / 导出按钮保留。
|
|
892
1099
|
function ProfileSection() {
|
|
893
|
-
// 面板版新增文案(不改 DICT,仅本函数使用)
|
|
894
|
-
const TXT = { expand: "展开全文", collapse: "收起" };
|
|
895
1100
|
const [data, setData] = React.useState(null);
|
|
896
1101
|
const [digest, setDigest] = React.useState(null);
|
|
897
1102
|
const [tab, setTab] = React.useState("interest");
|
|
@@ -938,7 +1143,7 @@ const LOCALE_NS = "heartbeat";
|
|
|
938
1143
|
isLong(e.content) ? React.createElement("button", {
|
|
939
1144
|
style: { ...buttonGhost, height: 20, fontSize: 11, padding: "0 8px", marginTop: 2 },
|
|
940
1145
|
onClick: () => setExpanded((m) => ({ ...m, [key]: !open })),
|
|
941
|
-
}, open ?
|
|
1146
|
+
}, open ? t("profile.collapse") : t("profile.expand")) : null,
|
|
942
1147
|
);
|
|
943
1148
|
};
|
|
944
1149
|
const om = (digest && digest.omitted) || { tact: 0, topic: 0, wander: 0 };
|
|
@@ -992,6 +1197,9 @@ const LOCALE_NS = "heartbeat";
|
|
|
992
1197
|
const idleMode = !!value && value.idleMode === true;
|
|
993
1198
|
const tokenSaver = !!value && value.tokenSaver === true;
|
|
994
1199
|
const psyEnabled = !!value && value.psyEnabled === true;
|
|
1200
|
+
// 静默时段(v2.2):policy 用户层字段(gate.quietHours),保存后下一跳生效。
|
|
1201
|
+
const quietStart = value && typeof value.quietStart === "string" ? value.quietStart : "01:30";
|
|
1202
|
+
const quietEnd = value && typeof value.quietEnd === "string" ? value.quietEnd : "06:30";
|
|
995
1203
|
const [draftInterval, setDraftInterval] = React.useState(interval);
|
|
996
1204
|
const [draftCap, setDraftCap] = React.useState(cap);
|
|
997
1205
|
const [draftTimeInject, setDraftTimeInject] = React.useState(timeInject);
|
|
@@ -999,22 +1207,16 @@ const LOCALE_NS = "heartbeat";
|
|
|
999
1207
|
const [draftIdle, setDraftIdle] = React.useState(idleMode);
|
|
1000
1208
|
const [draftTokenSaver, setDraftTokenSaver] = React.useState(tokenSaver);
|
|
1001
1209
|
const [draftPsy, setDraftPsy] = React.useState(psyEnabled);
|
|
1210
|
+
const [draftQuietStart, setDraftQuietStart] = React.useState(quietStart);
|
|
1211
|
+
const [draftQuietEnd, setDraftQuietEnd] = React.useState(quietEnd);
|
|
1002
1212
|
const [status, setStatus] = React.useState("");
|
|
1003
|
-
React.useEffect(() => { setDraftInterval(interval); setDraftCap(cap); setDraftTimeInject(timeInject); setDraftStatusbar(statusbar); setDraftIdle(idleMode); setDraftTokenSaver(tokenSaver); setDraftPsy(psyEnabled); }, [interval, cap, timeInject, statusbar, idleMode, tokenSaver, psyEnabled]);
|
|
1004
|
-
// v2.1.0
|
|
1005
|
-
const GROUP_RHYTHM = "节律";
|
|
1006
|
-
const GROUP_RHYTHM_DESC = "心跳多久跳一次、一天最多说几条。";
|
|
1007
|
-
const GROUP_TIME = "时间与状态栏";
|
|
1008
|
-
const GROUP_TIME_DESC = "给日常会话注入精确时间、在会话里挂一条心跳状态。";
|
|
1009
|
-
const GROUP_EXPRESS = "表达";
|
|
1010
|
-
const GROUP_EXPRESS_DESC = "心跳说话的方式与开销。";
|
|
1011
|
-
const GROUP_FOCUS = "专注模式";
|
|
1012
|
-
const GROUP_FOCUS_DESC = "需要安静时手动暂停心跳,到点自动恢复。它是即时生效的独立开关:点按钮立刻暂停/恢复,不走下面的「保存」。";
|
|
1213
|
+
React.useEffect(() => { setDraftInterval(interval); setDraftCap(cap); setDraftTimeInject(timeInject); setDraftStatusbar(statusbar); setDraftIdle(idleMode); setDraftTokenSaver(tokenSaver); setDraftPsy(psyEnabled); setDraftQuietStart(quietStart); setDraftQuietEnd(quietEnd); }, [interval, cap, timeInject, statusbar, idleMode, tokenSaver, psyEnabled, quietStart, quietEnd]);
|
|
1214
|
+
// v2.1.0 面板改造:分组小节文案走 DICT 的 config.group.*。
|
|
1013
1215
|
// 「多久生效」依据 src/rpc.ts 的 config.set 实现判定:
|
|
1014
1216
|
// intervalMin → applyHeartbeatInterval 立即重排定时器(保存后立刻生效);
|
|
1015
1217
|
// 其余字段写入活引用/运行时 policy,每跳判定时读取(下一跳生效)。详见 manifest.md。
|
|
1016
|
-
const EFFECT_NOW = "
|
|
1017
|
-
const EFFECT_NEXT = "
|
|
1218
|
+
const EFFECT_NOW = t("config.effect.now");
|
|
1219
|
+
const EFFECT_NEXT = t("config.effect.next");
|
|
1018
1220
|
// 专注模式(v2.1.0 ①):即时动作,不走「保存」,和上面那堆参数分开。
|
|
1019
1221
|
// 状态取 rpc 合并值(内存 + data/focus.json),所以 CLI 设的暂停这里也看得见。
|
|
1020
1222
|
const [focus, setFocus] = React.useState(null);
|
|
@@ -1053,6 +1255,8 @@ const LOCALE_NS = "heartbeat";
|
|
|
1053
1255
|
idleMode: !!draftIdle,
|
|
1054
1256
|
tokenSaver: !!draftTokenSaver,
|
|
1055
1257
|
psyEnabled: !!draftPsy,
|
|
1258
|
+
quietStart: draftQuietStart,
|
|
1259
|
+
quietEnd: draftQuietEnd,
|
|
1056
1260
|
});
|
|
1057
1261
|
setValue(v);
|
|
1058
1262
|
setStatus(t("config.saved"));
|
|
@@ -1081,7 +1285,7 @@ const LOCALE_NS = "heartbeat";
|
|
|
1081
1285
|
"div",
|
|
1082
1286
|
null,
|
|
1083
1287
|
// ── 节律 ──
|
|
1084
|
-
groupTitle(
|
|
1288
|
+
groupTitle(t("config.group.rhythm"), t("config.group.rhythmDesc")),
|
|
1085
1289
|
paramRow(t("config.interval"),
|
|
1086
1290
|
React.createElement("input", { style: inputStyle, type: "number", min: 1, max: 1440, value: draftInterval, onChange: (e) => setDraftInterval(e.target.value) }),
|
|
1087
1291
|
null, EFFECT_NOW),
|
|
@@ -1089,18 +1293,26 @@ const LOCALE_NS = "heartbeat";
|
|
|
1089
1293
|
React.createElement("input", { style: inputStyle, type: "number", min: 1, max: 50, value: draftCap, onChange: (e) => setDraftCap(e.target.value) }),
|
|
1090
1294
|
null, EFFECT_NEXT),
|
|
1091
1295
|
// ── 时间与状态栏 ──
|
|
1092
|
-
groupTitle(
|
|
1296
|
+
groupTitle(t("config.group.time"), t("config.group.timeDesc")),
|
|
1093
1297
|
paramRow(t("config.timeInject"),
|
|
1094
1298
|
React.createElement("input", { style: inputStyle, type: "number", min: 0, max: 1440, value: draftTimeInject, onChange: (e) => setDraftTimeInject(e.target.value) }),
|
|
1095
1299
|
t("config.timeInjectOff"), EFFECT_NEXT),
|
|
1300
|
+
paramRow(t("config.quietHours"),
|
|
1301
|
+
React.createElement(
|
|
1302
|
+
"span",
|
|
1303
|
+
null,
|
|
1304
|
+
React.createElement("input", { style: inputStyle, type: "time", value: draftQuietStart, onChange: (e) => setDraftQuietStart(e.target.value) }),
|
|
1305
|
+
"–",
|
|
1306
|
+
React.createElement("input", { style: inputStyle, type: "time", value: draftQuietEnd, onChange: (e) => setDraftQuietEnd(e.target.value) })),
|
|
1307
|
+
t("config.quietHoursHint"), EFFECT_NEXT),
|
|
1096
1308
|
paramRow(t("config.statusbar"), toggleBtn(draftStatusbar, setDraftStatusbar), t("config.statusbarHint"), EFFECT_NEXT),
|
|
1097
1309
|
// ── 表达 ──
|
|
1098
|
-
groupTitle(
|
|
1310
|
+
groupTitle(t("config.group.express"), t("config.group.expressDesc")),
|
|
1099
1311
|
paramRow(t("config.tokenSaver"), toggleBtn(draftTokenSaver, setDraftTokenSaver), t("config.tokenSaverHint"), EFFECT_NEXT),
|
|
1100
1312
|
paramRow(t("config.psy"), toggleBtn(draftPsy, setDraftPsy), t("config.psyHint"), EFFECT_NEXT),
|
|
1101
1313
|
paramRow(t("config.idle"), toggleBtn(draftIdle, setDraftIdle), t("config.idleHint"), EFFECT_NEXT),
|
|
1102
1314
|
// ── 专注模式:即时动作,不进 draft 体系 ──
|
|
1103
|
-
groupTitle(
|
|
1315
|
+
groupTitle(t("config.group.focus"), t("config.group.focusDesc")),
|
|
1104
1316
|
React.createElement("div", { style: rowStyle },
|
|
1105
1317
|
React.createElement("span", { style: labelStyle }, t("config.focus")),
|
|
1106
1318
|
React.createElement("input", { style: inputStyle, type: "number", min: 1, max: 1440, value: draftFocusMin, onChange: (e) => setDraftFocusMin(e.target.value) }),
|
|
@@ -1125,7 +1337,6 @@ const LOCALE_NS = "heartbeat";
|
|
|
1125
1337
|
const [selected, setSelected] = React.useState("");
|
|
1126
1338
|
const [text, setText] = React.useState(null);
|
|
1127
1339
|
// v2.1.0 面板改造:正文收进「展开查看」折叠块,默认收起;列表与加载逻辑原样保留。
|
|
1128
|
-
const WEEKLY_SHOW = "展开查看报告正文";
|
|
1129
1340
|
const loadReport = React.useCallback((file) => {
|
|
1130
1341
|
setSelected(file);
|
|
1131
1342
|
rpc("weekly.get", { file }).then((r) => setText(r.text), (e) => setError(String(e).slice(0, 100)));
|
|
@@ -1156,7 +1367,7 @@ const LOCALE_NS = "heartbeat";
|
|
|
1156
1367
|
}, r.end.slice(0, 10))),
|
|
1157
1368
|
) : null,
|
|
1158
1369
|
text ? React.createElement("details", { style: { margin: "4px 0" } },
|
|
1159
|
-
React.createElement("summary", { style: summaryStyle },
|
|
1370
|
+
React.createElement("summary", { style: summaryStyle }, t("weekly.showBody")),
|
|
1160
1371
|
React.createElement("pre", { style: { whiteSpace: "pre-wrap", margin: "4px 0", fontSize: 12 } }, text),
|
|
1161
1372
|
) : null,
|
|
1162
1373
|
React.createElement("div", { style: rowStyle },
|
|
@@ -1176,8 +1387,6 @@ const LOCALE_NS = "heartbeat";
|
|
|
1176
1387
|
const busy = React.useRef(false);
|
|
1177
1388
|
// v2.1.0 面板改造:导入是危险操作(会用迁移包覆盖本机数据),加二次确认——
|
|
1178
1389
|
// 第一次点只亮红色确认态并提示,再点一次才真正执行。
|
|
1179
|
-
const IMPORT_CONFIRM_LABEL = "确认导入(覆盖本机数据)";
|
|
1180
|
-
const IMPORT_CONFIRM_HINT = "⚠ 危险操作:导入会用迁移包覆盖本机的心跳数据(被替换的文件会自动备份)。确认路径和口令无误后,再点一次「确认导入」才会执行。";
|
|
1181
1390
|
const [confirmImport, setConfirmImport] = React.useState(false);
|
|
1182
1391
|
const run = (fn) => {
|
|
1183
1392
|
if (busy.current) return;
|
|
@@ -1200,7 +1409,7 @@ const LOCALE_NS = "heartbeat";
|
|
|
1200
1409
|
const onImportClick = () => {
|
|
1201
1410
|
if (!confirmImport) {
|
|
1202
1411
|
setConfirmImport(true);
|
|
1203
|
-
setStatus(
|
|
1412
|
+
setStatus(t("migrate.confirmHint"));
|
|
1204
1413
|
return;
|
|
1205
1414
|
}
|
|
1206
1415
|
setConfirmImport(false);
|
|
@@ -1221,7 +1430,7 @@ const LOCALE_NS = "heartbeat";
|
|
|
1221
1430
|
React.createElement("input", { style: { ...inputStyle, width: 220 }, placeholder: t("migrate.filePlaceholder"), value: importFile, onChange: (e) => { setImportFile(e.target.value); setConfirmImport(false); } }),
|
|
1222
1431
|
React.createElement("input", { style: inputStyle, type: "password", placeholder: t("migrate.pwPlaceholderShort"), value: importPw, onChange: (e) => { setImportPw(e.target.value); setConfirmImport(false); } }),
|
|
1223
1432
|
confirmImport
|
|
1224
|
-
? React.createElement("button", { style: { ...buttonStyle, background: "#e5484d" }, onClick: onImportClick },
|
|
1433
|
+
? React.createElement("button", { style: { ...buttonStyle, background: "#e5484d" }, onClick: onImportClick }, t("migrate.confirmImport"))
|
|
1225
1434
|
: React.createElement("button", { style: buttonStyle, onClick: onImportClick }, t("migrate.importButton")),
|
|
1226
1435
|
),
|
|
1227
1436
|
status ? React.createElement("div", { style: hintStyle }, status) : null,
|
|
@@ -1305,7 +1514,12 @@ const LOCALE_NS = "heartbeat";
|
|
|
1305
1514
|
React.createElement("div", { className: "hb-body" },
|
|
1306
1515
|
tab === "status" ? React.createElement(StatusCard, null) : null,
|
|
1307
1516
|
tab === "sessions" ? card(t("panel.tab.sessions"), React.createElement(SessionsSection, null)) : null,
|
|
1308
|
-
tab === "seeds" ? card(t("panel.tab.seeds"), React.createElement(
|
|
1517
|
+
tab === "seeds" ? card(t("panel.tab.seeds"), React.createElement(
|
|
1518
|
+
"div",
|
|
1519
|
+
null,
|
|
1520
|
+
React.createElement(BiliLoginCard, { key: "bili-login" }),
|
|
1521
|
+
React.createElement(SeedsSection, null),
|
|
1522
|
+
)) : null,
|
|
1309
1523
|
tab === "interests" ? card(t("panel.tab.interests"), React.createElement(InterestsSection, null)) : null,
|
|
1310
1524
|
tab === "profile" ? card(t("panel.tab.profile"), React.createElement(ProfileSection, null)) : null,
|
|
1311
1525
|
tab === "weekly" ? card(t("panel.tab.weekly"), React.createElement(WeeklySection, null)) : null,
|
|
@@ -1328,17 +1542,18 @@ const LOCALE_NS = "heartbeat";
|
|
|
1328
1542
|
}
|
|
1329
1543
|
|
|
1330
1544
|
try {
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1545
|
+
// 同时注册短名 + npm 全名:宿主 listBundles() 的 bundle 名取决于 profile 依赖的 key,
|
|
1546
|
+
// file: 安装时是短名 'dsh-heartbeat',npm 安装时是 scoped 全名 '@kanadego/dsh-heartbeat'。
|
|
1547
|
+
// 双注册保证面板在两种安装方式下都不消失(v2.1.0 单短名只覆盖 file:,v2.1.1 单全名只覆盖 npm)。
|
|
1548
|
+
for (const key of ["dsh-heartbeat", "@kanadego/dsh-heartbeat"]) {
|
|
1549
|
+
ctx.slots.inject("plugins.bundle.config", function () {
|
|
1550
|
+
const disposer = ctx.slots.register(
|
|
1551
|
+
{ name: "plugins.bundle.config", key },
|
|
1552
|
+
HeartbeatSection,
|
|
1553
|
+
);
|
|
1554
|
+
return disposer;
|
|
1555
|
+
});
|
|
1556
|
+
}
|
|
1342
1557
|
} catch (e) {
|
|
1343
1558
|
// v2.1.0 起旧设置页面板退役:不再往 settings.section 挂第二份 UI。
|
|
1344
1559
|
// 宿主 0.2.1 起就有 plugins.bundle.config,宿主过旧时面板不可用,
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BILI_SESSION_FILE_NAME,
|
|
3
|
+
GENERATE_URL,
|
|
4
|
+
POLL_URL,
|
|
5
|
+
bilibiliSessionFilePath,
|
|
6
|
+
createBiliLoginService,
|
|
7
|
+
openImageProduction,
|
|
8
|
+
renderQrPngProduction,
|
|
9
|
+
runBiliLogin,
|
|
10
|
+
saveBiliSession,
|
|
11
|
+
sessdataFromCookies,
|
|
12
|
+
sessdataFromUrl,
|
|
13
|
+
tryOpenImage
|
|
14
|
+
} from "./chunk-SIY3YHFY.js";
|
|
15
|
+
import "./chunk-OCBE2AKW.js";
|
|
16
|
+
import "./chunk-M72T5MZU.js";
|
|
17
|
+
import "./chunk-IBBAISSW.js";
|
|
18
|
+
export {
|
|
19
|
+
BILI_SESSION_FILE_NAME,
|
|
20
|
+
GENERATE_URL,
|
|
21
|
+
POLL_URL,
|
|
22
|
+
bilibiliSessionFilePath,
|
|
23
|
+
createBiliLoginService,
|
|
24
|
+
openImageProduction,
|
|
25
|
+
renderQrPngProduction,
|
|
26
|
+
runBiliLogin,
|
|
27
|
+
saveBiliSession,
|
|
28
|
+
sessdataFromCookies,
|
|
29
|
+
sessdataFromUrl,
|
|
30
|
+
tryOpenImage
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=bili-login-XQVEE4M6.js.map
|