dsh-go-workbuddy 1.0.0 → 1.0.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/lib/index.js +4 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// --preserve-symlinks 起独立进程,直连插件的 WorkBuddyCredentialStore / UpstreamClient。
|
|
5
5
|
import { spawn } from 'node:child_process'
|
|
6
6
|
import { readFile, writeFile } from 'node:fs/promises'
|
|
7
|
-
import { readFileSync } from 'node:fs'
|
|
7
|
+
import { readFileSync, writeFileSync } from 'node:fs'
|
|
8
8
|
import { existsSync } from 'node:fs'
|
|
9
9
|
import { join, dirname } from 'node:path'
|
|
10
10
|
import { homedir } from 'node:os'
|
|
@@ -64,6 +64,8 @@ function runOnce(cmd, args, opts) {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
async function startBridge() {
|
|
67
|
+
// 每次先探活:桥进程若已死,缓存的 true 会挡住重启,这里放到前面保证自愈
|
|
68
|
+
if ((await health()) !== null) return true
|
|
67
69
|
if (bridgeReady !== null) return bridgeReady
|
|
68
70
|
bridgeReady = (async () => {
|
|
69
71
|
if ((await health()) !== null) return true
|
|
@@ -325,6 +327,7 @@ async function buildPatch(zh) {
|
|
|
325
327
|
totalText: credits === null ? '—' : fmt(total),
|
|
326
328
|
totalTone: credits === null ? 'warn' : total <= 0 ? 'bad' : 'good',
|
|
327
329
|
totalCaption: credits === null ? (zh ? '还没读到' : 'not read') : zh ? `共 ${packages.length} 个积分包` : `${packages.length} packages`,
|
|
330
|
+
regionText: region === 'cn' ? (zh ? '国内版' : 'CN') : (zh ? '国际版' : 'Global'),
|
|
328
331
|
accountText: sel === undefined ? '—' : clip(String(sel.accountName || sel.id || '—'), 18),
|
|
329
332
|
checkinText: checkin === null ? '—' : checkin.todayCheckedIn === true ? (zh ? '已签' : 'done') : (zh ? '未签' : 'pending'),
|
|
330
333
|
streakText: checkin === null ? '—' : `${Number(checkin.streakDays ?? 0)} 天`,
|