dsh-cookie-cleaner 0.1.0 → 0.1.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/CHANGELOG.md +39 -1
- package/README.md +117 -27
- package/dsh.plugin.json +2 -2
- package/locale/de.json +6 -0
- package/locale/en.json +6 -0
- package/locale/es.json +6 -0
- package/locale/fr.json +6 -0
- package/locale/it.json +6 -0
- package/locale/ja.json +6 -0
- package/locale/ko.json +6 -0
- package/locale/ru.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +12 -3
- package/scripts/gen-locales.mjs +82 -0
- package/scripts/sync-hosts.mjs +10 -1
- package/src/cli.js +68 -30
- package/src/core.js +132 -46
- package/src/i18n.js +139 -0
- package/src/index.js +8 -2
- package/src/locales-advise-owner.js +39 -0
- package/src/locales-dict.js +216 -0
- package/src/locales-dict2.js +210 -0
- package/src/report.js +40 -24
package/src/cli.js
CHANGED
|
@@ -2,31 +2,43 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* dsh-cookie-cleaner — 独立清理脚本(可在 npm 全局/任意 shell 下直接执行)。
|
|
4
4
|
*
|
|
5
|
-
* 为什么独立成脚本:cookie 库在客户端运行期间被 Chromium
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* 为什么独立成脚本:cookie 库在客户端运行期间被 Chromium 独占(实测写入必须等退出),
|
|
6
|
+
* 所以清理只能发生在「客户端已完全退出」的时刻——那时宿主插件根本不存在,
|
|
7
|
+
* 执行体必须是这个包里的脚本。
|
|
8
8
|
*
|
|
9
9
|
* 包是 ESM(宿主装载与 npm bin 都走 ESM),core 只有一份实现,两边共用。
|
|
10
|
+
* 输出语言:--lang > DSH_COOKIE_LANG/DSH_LANG > LC_ALL/LANG > 系统 locale > zh。
|
|
10
11
|
*/
|
|
11
12
|
import path from 'node:path'
|
|
13
|
+
import process from 'node:process'
|
|
12
14
|
import * as core from './core.js'
|
|
15
|
+
import { LANGS, detectLang, normalize, translator } from './i18n.js'
|
|
13
16
|
|
|
14
|
-
|
|
17
|
+
function usage() {
|
|
18
|
+
return `dsh-cookie-cleaner — 清理 DSH 客户端留在 cookie 库里的本地登录凭据(dsh-auth-*)
|
|
15
19
|
|
|
16
|
-
|
|
17
|
-
dsh-cookie-cleaner
|
|
18
|
-
dsh-cookie-cleaner --clean
|
|
19
|
-
dsh-cookie-cleaner --clean --expired-only
|
|
20
|
-
dsh-cookie-cleaner --clean --dry-run
|
|
21
|
-
dsh-cookie-cleaner --db=<完整路径>
|
|
20
|
+
用法(务必先${core.exitInstruction()}):
|
|
21
|
+
dsh-cookie-cleaner 查看现状:库在哪、多少条 dsh-auth-*、多少已过期
|
|
22
|
+
dsh-cookie-cleaner --clean 删除回环域(127.0.0.1/localhost/[::1])下全部 dsh-auth-*
|
|
23
|
+
dsh-cookie-cleaner --clean --expired-only 保守档:只删已过期的
|
|
24
|
+
dsh-cookie-cleaner --clean --dry-run 只看会删几条,不写盘
|
|
25
|
+
dsh-cookie-cleaner --db=<完整路径> 手动指定 cookie 库(非默认安装/flatpak/snap 用)
|
|
22
26
|
|
|
23
|
-
|
|
24
|
-
|
|
27
|
+
库位置默认按平台惯例推导(也可用 DSH_USER_DATA / DSH_COOKIE_DB 覆盖):
|
|
28
|
+
Windows %APPDATA%\\@deepseek-ai\\dsh-desktop\\Network\\Cookies
|
|
29
|
+
macOS ~/Library/Application Support/@deepseek-ai/dsh-desktop/Network/Cookies
|
|
30
|
+
Linux ~/.config/@deepseek-ai/dsh-desktop/Network/Cookies
|
|
31
|
+
|
|
32
|
+
其它:--no-backup 不产出 .bak 副本;--no-vacuum 不做 VACUUM 收缩;
|
|
33
|
+
--lang <${LANGS.join('|')}> 指定输出语言(缺省跟随系统 locale)
|
|
34
|
+
退出码:0 成功;1 失败(库被占用/无权限/没找到/参数非法)
|
|
25
35
|
`
|
|
36
|
+
}
|
|
26
37
|
|
|
27
38
|
function parseArgs(argv) {
|
|
28
|
-
const options = { clean: false, expiredOnly: false, dryRun: false, noBackup: false, noVacuum: false, db: '', help: false }
|
|
29
|
-
for (
|
|
39
|
+
const options = { clean: false, expiredOnly: false, dryRun: false, noBackup: false, noVacuum: false, db: '', lang: '', help: false }
|
|
40
|
+
for (let i = 0; i < argv.length; i++) {
|
|
41
|
+
const arg = argv[i]
|
|
30
42
|
if (arg === '--clean') options.clean = true
|
|
31
43
|
else if (arg === '--expired-only') options.expiredOnly = true
|
|
32
44
|
else if (arg === '--dry-run') options.dryRun = true
|
|
@@ -34,8 +46,10 @@ function parseArgs(argv) {
|
|
|
34
46
|
else if (arg === '--no-vacuum') options.noVacuum = true
|
|
35
47
|
else if (arg === '--help' || arg === '-h') options.help = true
|
|
36
48
|
else if (arg.startsWith('--db=')) options.db = arg.slice('--db='.length)
|
|
49
|
+
else if (arg === '--lang') options.lang = normalize(argv[++i] ?? '')
|
|
50
|
+
else if (arg.startsWith('--lang=')) options.lang = normalize(arg.slice('--lang='.length))
|
|
37
51
|
else {
|
|
38
|
-
process.stderr.write(`未知参数:${arg}\n\n${
|
|
52
|
+
process.stderr.write(`未知参数:${arg}\n\n${usage()}`)
|
|
39
53
|
process.exitCode = 1
|
|
40
54
|
return undefined
|
|
41
55
|
}
|
|
@@ -46,8 +60,10 @@ function parseArgs(argv) {
|
|
|
46
60
|
function main() {
|
|
47
61
|
const options = parseArgs(process.argv.slice(2))
|
|
48
62
|
if (options === undefined) return
|
|
63
|
+
const lang = options.lang || detectLang(process.env)
|
|
64
|
+
core.setLang(lang)
|
|
49
65
|
if (options.help) {
|
|
50
|
-
process.stdout.write(
|
|
66
|
+
process.stdout.write(usage())
|
|
51
67
|
return
|
|
52
68
|
}
|
|
53
69
|
const explicitPath = options.db ? path.resolve(options.db) : ''
|
|
@@ -56,12 +72,20 @@ function main() {
|
|
|
56
72
|
if (!options.clean) {
|
|
57
73
|
const stat = core.statCookies({ explicitPath, env })
|
|
58
74
|
process.stdout.write(core.describeStat(stat) + '\n')
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
75
|
+
const exit = core.exitInstruction()
|
|
76
|
+
if (stat.reason === 'busy') {
|
|
77
|
+
process.stdout.write(nextLine('nextCliRerun', { exit }) + '\n')
|
|
78
|
+
} else if (stat.reason === 'permission') {
|
|
79
|
+
process.stdout.write(nextLine('nextCliPermission', {}) + '\n')
|
|
80
|
+
} else if (stat.reason === 'missing') {
|
|
81
|
+
// 文件不存在时提“关客户端”是误引导,直接给 --db 形式
|
|
82
|
+
process.stdout.write(msg('nextCliPermission', {}) + '\n')
|
|
83
|
+
} else if (stat.verdict === 'warn') {
|
|
84
|
+
process.stdout.write(nextLine('nextCliClean', { exit }) + '\n')
|
|
63
85
|
}
|
|
64
|
-
|
|
86
|
+
// 退出码用黑名单:只有「真读到内容」的档位才是 0。白名单写法会把新档误归成成功。
|
|
87
|
+
const okReason = stat.reason === 'has-stale-entries' || stat.reason === 'nothing-to-clean' || stat.verdict === 'ok'
|
|
88
|
+
process.exitCode = okReason ? 0 : 1
|
|
65
89
|
return
|
|
66
90
|
}
|
|
67
91
|
const result = core.cleanCookies({
|
|
@@ -78,20 +102,34 @@ function main() {
|
|
|
78
102
|
return
|
|
79
103
|
}
|
|
80
104
|
if (result.dryRun) {
|
|
81
|
-
process.stdout.write(
|
|
105
|
+
process.stdout.write(msg('dryRun', { count: result.wouldDelete, path: result.path }) + '\n' + msg('dryRunTail', {}) + '\n')
|
|
82
106
|
return
|
|
83
107
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
108
|
+
const lines = [
|
|
109
|
+
msg('deleted', { count: result.deleted, scope: result.expiredOnly ? msg('scopeExpired', {}) : msg('scopeAll', {}) }),
|
|
110
|
+
msg('dbSize', { path: result.path, before: result.beforeBytes, after: result.afterBytes }),
|
|
111
|
+
]
|
|
112
|
+
if (result.backup) {
|
|
113
|
+
lines.push(msg('backup', { backup: result.backup }) + ((result.backupSidecars ?? []).length ? msg('backupWith', { sidecars: result.backupSidecars.join(', ') }) : ''))
|
|
114
|
+
if ((result.skippedSidecars ?? []).length) lines.push(msg('backupWarn', { sidecars: result.skippedSidecars.join(', ') }))
|
|
115
|
+
} else {
|
|
116
|
+
lines.push(msg('backupSkipped', {}))
|
|
117
|
+
}
|
|
118
|
+
lines.push(msg('untouched', {}))
|
|
119
|
+
process.stdout.write(lines.join('\n') + '\n')
|
|
90
120
|
} catch (e) {
|
|
91
|
-
const busy = e && e.code === 'cookie-busy'
|
|
92
|
-
process.stderr.write((busy ? '' : '
|
|
121
|
+
const busy = e && (e.code === 'cookie-busy' || e.code === 'cookie-permission')
|
|
122
|
+
process.stderr.write((busy ? '' : msg('cleanFailed', {})) + (e && e.message ? e.message : String(e)) + '\n')
|
|
93
123
|
process.exitCode = 1
|
|
94
124
|
}
|
|
95
125
|
}
|
|
96
126
|
|
|
127
|
+
/** 取当前语言的词条(core 内部也按同一语言出文案,保持一致)。 */
|
|
128
|
+
function msg(key, vars) {
|
|
129
|
+
return translator(core.activeLang())(key, vars)
|
|
130
|
+
}
|
|
131
|
+
function nextLine(key, vars) {
|
|
132
|
+
return msg(key, vars)
|
|
133
|
+
}
|
|
134
|
+
|
|
97
135
|
main()
|
package/src/core.js
CHANGED
|
@@ -4,10 +4,11 @@
|
|
|
4
4
|
* 为什么清理动作不能在插件运行期做(2026-11-04 对本机 0.2.1-rc.5 客户端实测):
|
|
5
5
|
* - Host 是 Electron 的纯 Node 模式子进程(`ELECTRON_RUN_AS_NODE=1`),拿不到
|
|
6
6
|
* `session.cookies`,只能落到磁盘上的 Chromium cookie 库;
|
|
7
|
-
* - 客户端在跑时该库被 Chromium
|
|
8
|
-
* `readOnly`
|
|
9
|
-
* 而系统 node 22
|
|
10
|
-
*
|
|
7
|
+
* - 客户端在跑时该库被 Chromium 周期性持有:Host runtime(Electron 44 / Node 24)
|
|
8
|
+
* 连 `readOnly` 打开都报 `unable to open database file`,`fs.copyFileSync` 同样被拒;
|
|
9
|
+
* 而系统 node 22 在相近时刻却能读。**能否打开随时间漂移,而且只报一个笼统错,
|
|
10
|
+
* 所以不能拿错误码分档(POSIX 权限不足也不给 EACCES),只能自己探文件。**
|
|
11
|
+
* 因此本模块把「独占写锁」当作唯一的安全闸:拿不到锁就一律拒绝,
|
|
11
12
|
* 拿到锁即意味着此刻没有其它写者,删除是原子的、不会留中间态。
|
|
12
13
|
*
|
|
13
14
|
* 删了会不会掉登录?不会(源码依据):
|
|
@@ -22,6 +23,8 @@ import fs from 'node:fs'
|
|
|
22
23
|
import os from 'node:os'
|
|
23
24
|
import path from 'node:path'
|
|
24
25
|
import { createRequire } from 'node:module'
|
|
26
|
+
import { exitFor, translator } from './i18n.js'
|
|
27
|
+
import './locales-dict.js'
|
|
25
28
|
|
|
26
29
|
/** Cookie 名前缀:宿主 client-connection 生成(`COOKIE_PREFIX + sha256(authority)`)。 */
|
|
27
30
|
export const AUTH_COOKIE_PREFIX = 'dsh-auth-'
|
|
@@ -35,6 +38,28 @@ const WINDOWS_EPOCH_OFFSET_MICROSECONDS = 11_644_473_600_000_000
|
|
|
35
38
|
/** 打包的 desktop 应用名(Electron 由 package.json 的 name 派生 userData 目录)。 */
|
|
36
39
|
const PRODUCT_DIR_NAMES = Object.freeze(['@deepseek-ai/dsh-desktop', 'DSH Desktop', 'deepseek-harness'])
|
|
37
40
|
|
|
41
|
+
/**
|
|
42
|
+
* Chromium 在 POSIX 平台上用 WAL 日志(Windows 上用 rollback journal):
|
|
43
|
+
* 备份只拷主文件会丢掉 `-wal` 里尚未 checkpoint 的行,恢复时反而把库写小。
|
|
44
|
+
*/
|
|
45
|
+
const SIDECAR_SUFFIXES = Object.freeze(['-wal', '-shm', '-journal'])
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* 退出客户端的人话指引(托盘只在 Windows 存在;macOS 叫 Quit)。
|
|
49
|
+
* `lang` 缺省走当前激活语言(由 setLang 设定),文本按 9 语字典出。'zh' 是无探测时的底。
|
|
50
|
+
*/
|
|
51
|
+
export function exitInstruction(platform = process.platform, lang = activeLang()) {
|
|
52
|
+
return exitFor(platform, translator(lang))
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* 当前输出语言。调用方(CLI / 宿主命令)负责先探测再 setLang;
|
|
57
|
+
* 没设过时默认 zh,保证行为与 0.1.0 一致(不因为探测把一个中文用户推到英文)。
|
|
58
|
+
*/
|
|
59
|
+
let lang = 'zh'
|
|
60
|
+
export function setLang(next) { if (typeof next === 'string' && next) lang = next; return lang }
|
|
61
|
+
export function activeLang() { return lang }
|
|
62
|
+
|
|
38
63
|
const require = createRequire(import.meta.url)
|
|
39
64
|
|
|
40
65
|
/** Windows epoch 下的「现在」,用于和 `expires_utc` 同量纲比较。 */
|
|
@@ -76,15 +101,18 @@ export function candidateCookieDbs(userDataRoot = '', platform = process.platfor
|
|
|
76
101
|
}
|
|
77
102
|
const roots = []
|
|
78
103
|
if (env.DSH_USER_DATA) roots.push(String(env.DSH_USER_DATA).trim())
|
|
79
|
-
|
|
104
|
+
// home 从注入的 env 取(方便单测/多用户场景),真跑时才回退到 os.homedir()。
|
|
105
|
+
const home = env.HOME || env.USERPROFILE || os.homedir()
|
|
80
106
|
if (platform === 'win32') {
|
|
81
107
|
if (env.APPDATA) for (const name of PRODUCT_DIR_NAMES) roots.push(pathModule.join(env.APPDATA, name))
|
|
82
108
|
} else if (platform === 'darwin') {
|
|
83
|
-
for (const name of PRODUCT_DIR_NAMES) roots.push(pathModule.join(
|
|
109
|
+
for (const name of PRODUCT_DIR_NAMES) roots.push(pathModule.join(home, 'Library', 'Application Support', name))
|
|
84
110
|
} else {
|
|
85
|
-
for (const name of PRODUCT_DIR_NAMES) roots.push(pathModule.join(env.XDG_CONFIG_HOME || pathModule.join(
|
|
111
|
+
for (const name of PRODUCT_DIR_NAMES) roots.push(pathModule.join(env.XDG_CONFIG_HOME || pathModule.join(home, '.config'), name))
|
|
86
112
|
}
|
|
87
113
|
const out = []
|
|
114
|
+
// DSH_COOKIE_DB 是库文件本身:直接当首选候选,不拆根重组(拆错了就永远命不中)。
|
|
115
|
+
if (env.DSH_COOKIE_DB) out.push(pathModule.resolve(env.DSH_COOKIE_DB))
|
|
88
116
|
for (const root of roots) {
|
|
89
117
|
if (!root) continue
|
|
90
118
|
// Chromium ≥88 把网络状态收敛到 <userData>/Network/,更早的版本直接放根下。
|
|
@@ -113,6 +141,11 @@ function sizeOf(file) {
|
|
|
113
141
|
} catch { return 0 }
|
|
114
142
|
}
|
|
115
143
|
|
|
144
|
+
/** sidecar 存在性(journal/wal 可能是 0 字节,但仍是恢复现场的一部分)。 */
|
|
145
|
+
function existsFile(file) {
|
|
146
|
+
try { return fs.statSync(file).isFile() } catch { return false }
|
|
147
|
+
}
|
|
148
|
+
|
|
116
149
|
function loadSqlite(explicit) {
|
|
117
150
|
if (explicit) return explicit
|
|
118
151
|
try {
|
|
@@ -123,18 +156,52 @@ function loadSqlite(explicit) {
|
|
|
123
156
|
}
|
|
124
157
|
}
|
|
125
158
|
|
|
126
|
-
/**
|
|
159
|
+
/**
|
|
160
|
+
* 打不开时的真实归因。
|
|
161
|
+
*
|
|
162
|
+
* 为什么不看错误码:实测(Linux / node:sqlite)chmod 000 与权限不足都只报
|
|
163
|
+
* `ERR_SQLITE_ERROR: unable to open database file`,根本不出 EACCES——按码分档会永远走不到
|
|
164
|
+
* 权限档,把人误报成“客户端在跑”。所以自己探:可读性 → 属主 → 才能回到“占用”。
|
|
165
|
+
* @returns {'busy'|'unreadable'|'not-owned'|'missing'}
|
|
166
|
+
*/
|
|
167
|
+
export function classifyOpenFailure(filePath) {
|
|
168
|
+
let stat
|
|
169
|
+
try {
|
|
170
|
+
const probed = fs.statSync(filePath)
|
|
171
|
+
stat = probed.isFile() ? probed : null
|
|
172
|
+
} catch {
|
|
173
|
+
stat = null
|
|
174
|
+
}
|
|
175
|
+
if (stat === null) return 'missing'
|
|
176
|
+
try {
|
|
177
|
+
fs.accessSync(filePath, fs.constants.R_OK)
|
|
178
|
+
} catch {
|
|
179
|
+
return 'unreadable'
|
|
180
|
+
}
|
|
181
|
+
if (process.platform !== 'win32' && typeof process.getuid === 'function' && stat && typeof stat.uid === 'number') {
|
|
182
|
+
if (stat.uid !== process.getuid()) return 'not-owned'
|
|
183
|
+
}
|
|
184
|
+
return 'busy'
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* 打不开 = 库被占用、路径不对或权限不够。文案带处置指引,避免用户回头找 AI 解析。
|
|
189
|
+
* 分档靠 {@link classifyOpenFailure}(不是错误码);EPERM 等 ambiguous 码仍走占用档。
|
|
190
|
+
*/
|
|
127
191
|
export class CookieBusyError extends Error {
|
|
128
|
-
constructor(filePath, cause) {
|
|
192
|
+
constructor(filePath, cause, platform = process.platform, classify = classifyOpenFailure) {
|
|
193
|
+
const t = translator(lang)
|
|
194
|
+
const exit = exitFor(platform, t)
|
|
195
|
+
const kind = classify(filePath)
|
|
196
|
+
const key = kind === 'missing' ? 'adviseMissing' : kind === 'unreadable' ? 'advisePermission' : kind === 'not-owned' ? 'adviseOwner' : 'adviseBusy'
|
|
129
197
|
super(
|
|
130
|
-
|
|
131
|
-
` 原因:${cause && cause.message ? cause.message : String(cause)}\n` +
|
|
132
|
-
' 处置:这个库在客户端运行期间被 Chromium 独占。请完全退出 DSH 客户端' +
|
|
133
|
-
'(托盘图标 → 退出,并确认进程列表里已无 DeepSeek Harness),再执行本命令。',
|
|
198
|
+
t('openFailed', { path: filePath }) + '\n' + t('reason', { reason: cause && cause.message ? cause.message : String(cause) }) + '\n' + t(key, { exit }),
|
|
134
199
|
{ cause },
|
|
135
200
|
)
|
|
136
201
|
this.name = 'CookieBusyError'
|
|
137
|
-
|
|
202
|
+
// 只有真占用才是 busy;其余三档都是「找错地方/错用户」,处置不同
|
|
203
|
+
this.code = kind === 'busy' ? 'cookie-busy' : 'cookie-' + kind
|
|
204
|
+
this.kind = kind
|
|
138
205
|
this.path = filePath
|
|
139
206
|
this.cause = cause
|
|
140
207
|
}
|
|
@@ -146,22 +213,22 @@ export class CookieBusyError extends Error {
|
|
|
146
213
|
* 统一开 `readBigInts`:真实的 `expires_utc`(~1.34e16 微秒)超过 2^53,
|
|
147
214
|
* 默认按 Number 读会直接 `ERR_OUT_OF_RANGE`。
|
|
148
215
|
*/
|
|
149
|
-
export function openDatabase(filePath, { write = false, sqlite, timeoutMs = 150 } = {}) {
|
|
216
|
+
export function openDatabase(filePath, { write = false, sqlite, timeoutMs = 150, platform = process.platform, classify } = {}) {
|
|
150
217
|
const { DatabaseSync } = loadSqlite(sqlite)
|
|
151
218
|
if (!sizeOf(filePath)) {
|
|
152
|
-
throw new CookieBusyError(filePath, new Error('
|
|
219
|
+
throw new CookieBusyError(filePath, new Error(translator(lang)('missingFile')), platform, classify)
|
|
153
220
|
}
|
|
154
221
|
const options = { timeout: timeoutMs, readBigInts: true }
|
|
155
222
|
let handle
|
|
156
223
|
try {
|
|
157
224
|
handle = write ? new DatabaseSync(filePath, options) : new DatabaseSync(filePath, { ...options, readOnly: true })
|
|
158
225
|
} catch (e) {
|
|
159
|
-
// 老运行时可能不认 readBigInts
|
|
160
|
-
if (!/readBigInts/.test(String(e && e.message))) throw new CookieBusyError(filePath, e)
|
|
226
|
+
// 老运行时可能不认 readBigInts:降级重试一次,仍失败才算占用/权限。
|
|
227
|
+
if (!/readBigInts/.test(String(e && e.message))) throw new CookieBusyError(filePath, e, platform, classify)
|
|
161
228
|
try {
|
|
162
229
|
handle = write ? new DatabaseSync(filePath) : new DatabaseSync(filePath, { readOnly: true })
|
|
163
230
|
} catch (e2) {
|
|
164
|
-
throw new CookieBusyError(filePath, e2)
|
|
231
|
+
throw new CookieBusyError(filePath, e2, platform, classify)
|
|
165
232
|
}
|
|
166
233
|
}
|
|
167
234
|
if (write) {
|
|
@@ -169,8 +236,7 @@ export function openDatabase(filePath, { write = false, sqlite, timeoutMs = 150
|
|
|
169
236
|
handle.exec('BEGIN IMMEDIATE')
|
|
170
237
|
} catch (e) {
|
|
171
238
|
try { handle.close() } catch { /* 忽略二次错误 */ }
|
|
172
|
-
throw new CookieBusyError(filePath, e)
|
|
173
|
-
}
|
|
239
|
+
throw new CookieBusyError(filePath, e, platform, classify) }
|
|
174
240
|
}
|
|
175
241
|
return handle
|
|
176
242
|
}
|
|
@@ -209,17 +275,20 @@ function assertCookieSchema(handle) {
|
|
|
209
275
|
}
|
|
210
276
|
|
|
211
277
|
/** 只读统计。客户端在跑时可能抛 CookieBusyError → 降级成 verdict:'warn'/busy。 */
|
|
212
|
-
export function statCookies({ userDataRoot = '', explicitPath = '', env = process.env, sqlite, timeoutMs } = {}) {
|
|
213
|
-
const candidates = explicitPath ? [{ path: explicitPath, bytes: sizeOf(explicitPath) }] : resolveCookieDbs({ userDataRoot, env })
|
|
278
|
+
export function statCookies({ userDataRoot = '', explicitPath = '', env = process.env, sqlite, timeoutMs, platform = process.platform } = {}) {
|
|
279
|
+
const candidates = explicitPath ? [{ path: explicitPath, bytes: sizeOf(explicitPath) }] : resolveCookieDbs({ userDataRoot, platform, env })
|
|
214
280
|
if (candidates.length === 0) {
|
|
215
|
-
return { verdict: 'skipped', reason: 'not-found', candidates: candidateCookieDbs(userDataRoot,
|
|
281
|
+
return { verdict: 'skipped', reason: 'not-found', candidates: candidateCookieDbs(userDataRoot, platform, env) }
|
|
216
282
|
}
|
|
217
283
|
const target = candidates[0]
|
|
218
284
|
let handle
|
|
219
285
|
try {
|
|
220
|
-
handle = openDatabase(target.path, { write: false, sqlite, timeoutMs })
|
|
286
|
+
handle = openDatabase(target.path, { write: false, sqlite, timeoutMs, platform })
|
|
221
287
|
} catch (e) {
|
|
222
|
-
if (e instanceof CookieBusyError)
|
|
288
|
+
if (e instanceof CookieBusyError) {
|
|
289
|
+
const reason = e.kind === 'busy' ? 'busy' : e.kind === 'missing' ? 'missing' : 'permission'
|
|
290
|
+
return { verdict: 'warn', reason, ...target, candidates }
|
|
291
|
+
}
|
|
223
292
|
throw e
|
|
224
293
|
}
|
|
225
294
|
try {
|
|
@@ -256,26 +325,28 @@ export function statCookies({ userDataRoot = '', explicitPath = '', env = proces
|
|
|
256
325
|
|
|
257
326
|
/**
|
|
258
327
|
* 执行清理。默认档删掉回环域下**全部** `dsh-auth-*`(含未过期,安全性见文件头);
|
|
259
|
-
* `expiredOnly` 为保守档。写盘前先落 `.bak-<ts
|
|
260
|
-
*
|
|
328
|
+
* `expiredOnly` 为保守档。写盘前先落 `.bak-<ts>`:主库副本失败即整单放弃(全有或全无),
|
|
329
|
+
* sidecar(-wal/-shm/journal)拷不上只记为跳过,不拦停。
|
|
330
|
+
* @param {{expiredOnly?:boolean,noBackup?:boolean,noVacuum?:boolean,dryRun?:boolean,explicitPath?:string,userDataRoot?:string,env?:object,sqlite?:object,timestamp?:() => string,platform?:string,copyFile?:(from:string,to:string)=>void}} options
|
|
261
331
|
*/
|
|
262
332
|
export function cleanCookies(options = {}) {
|
|
263
333
|
const {
|
|
264
334
|
expiredOnly = false, noBackup = false, noVacuum = false, dryRun = false,
|
|
265
335
|
explicitPath = '', userDataRoot = '', env = process.env, sqlite,
|
|
266
|
-
timestamp = () => defaultTimestamp(),
|
|
336
|
+
timestamp = () => defaultTimestamp(), platform = process.platform,
|
|
337
|
+
copyFile = (from, to) => fs.copyFileSync(from, to),
|
|
267
338
|
} = options
|
|
268
|
-
const found = explicitPath ? [{ path: explicitPath, bytes: sizeOf(explicitPath) }] : resolveCookieDbs({ userDataRoot, env })
|
|
339
|
+
const found = explicitPath ? [{ path: explicitPath, bytes: sizeOf(explicitPath) }] : resolveCookieDbs({ userDataRoot, platform, env })
|
|
269
340
|
if (found.length === 0) {
|
|
270
341
|
return {
|
|
271
342
|
ok: false, code: 'not-found',
|
|
272
|
-
message: `没找到 cookie 库。候选路径:\n ${candidateCookieDbs(userDataRoot,
|
|
343
|
+
message: `没找到 cookie 库。候选路径:\n ${candidateCookieDbs(userDataRoot, platform, env).join('\n ')}\n可用 --db=<完整路径> 指定。`,
|
|
273
344
|
}
|
|
274
345
|
}
|
|
275
346
|
const target = found[0]
|
|
276
347
|
const { sql, values } = buildDeleteStatement({ expiredOnly })
|
|
277
348
|
const selectSql = sql.replace('DELETE FROM', 'SELECT COUNT(*) AS c FROM')
|
|
278
|
-
const handle = openDatabase(target.path, { write: true, sqlite })
|
|
349
|
+
const handle = openDatabase(target.path, { write: true, sqlite, platform })
|
|
279
350
|
try {
|
|
280
351
|
assertCookieSchema(handle)
|
|
281
352
|
const wouldDelete = Number(handle.prepare(selectSql).get(...values).c)
|
|
@@ -284,14 +355,30 @@ export function cleanCookies(options = {}) {
|
|
|
284
355
|
return { ok: true, dryRun: true, path: target.path, bytes: target.bytes, wouldDelete, sql, expiredOnly }
|
|
285
356
|
}
|
|
286
357
|
let backup = ''
|
|
358
|
+
const backupSidecars = []
|
|
359
|
+
const skippedSidecars = []
|
|
287
360
|
if (!noBackup) {
|
|
288
|
-
|
|
361
|
+
const stamp = timestamp()
|
|
362
|
+
backup = `${target.path}.bak-${stamp}`
|
|
289
363
|
try {
|
|
290
|
-
|
|
364
|
+
copyFile(target.path, backup)
|
|
291
365
|
} catch (e) {
|
|
292
366
|
handle.exec('ROLLBACK')
|
|
293
367
|
throw new Error(`备份失败,已放弃写入(未做任何修改):${e.message}`, { cause: e })
|
|
294
368
|
}
|
|
369
|
+
// 连 WAL/journal 一起拷:POSIX 上未 checkpoint 的行在 -wal 里,只拷主文件是个残副本。
|
|
370
|
+
// 但 sidecar 失败不能反过来拦停清理:-shm 只是可再生的一致性索引,-wal 在拿到独占写锁后
|
|
371
|
+
// 已无并发写者,拷不上顶多丢失少量尚未落盘的会话 cookie,而主库副本是完整的。
|
|
372
|
+
for (const suffix of SIDECAR_SUFFIXES) {
|
|
373
|
+
const side = `${target.path}${suffix}`
|
|
374
|
+
if (!existsFile(side)) continue
|
|
375
|
+
try {
|
|
376
|
+
copyFile(side, `${backup}${suffix}`)
|
|
377
|
+
backupSidecars.push(suffix)
|
|
378
|
+
} catch {
|
|
379
|
+
skippedSidecars.push(suffix)
|
|
380
|
+
}
|
|
381
|
+
}
|
|
295
382
|
}
|
|
296
383
|
const deleted = Number(handle.prepare(sql).run(...values).changes)
|
|
297
384
|
handle.exec('COMMIT')
|
|
@@ -304,7 +391,7 @@ export function cleanCookies(options = {}) {
|
|
|
304
391
|
}
|
|
305
392
|
return {
|
|
306
393
|
ok: true, dryRun: false, path: target.path, beforeBytes: target.bytes, afterBytes,
|
|
307
|
-
deleted, backup, sql, expiredOnly,
|
|
394
|
+
deleted, backup, backupSidecars, skippedSidecars, sql, expiredOnly,
|
|
308
395
|
}
|
|
309
396
|
} catch (e) {
|
|
310
397
|
try { handle.exec('ROLLBACK') } catch { /* 事务已结束,忽略 */ }
|
|
@@ -320,15 +407,14 @@ function defaultTimestamp() {
|
|
|
320
407
|
|
|
321
408
|
/** 给 CLI / 命令共用的「现在是什么状况」一句话(把处置说全,避免二次求助)。 */
|
|
322
409
|
export function describeStat(stat) {
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
}
|
|
326
|
-
if (stat.reason === '
|
|
327
|
-
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
+ `分布在 ${stat.byHost.length} 个 host_key,库大小 ${stat.bytes} B:${stat.path}`
|
|
410
|
+
const t = translator(lang)
|
|
411
|
+
if (stat.verdict === 'skipped') return t('skipped')
|
|
412
|
+
if (stat.reason === 'busy') return t('statBusy', { path: stat.path })
|
|
413
|
+
if (stat.reason === 'permission') return t('statPermission', { path: stat.path })
|
|
414
|
+
if (stat.reason === 'missing') return t('statMissing', { path: stat.path })
|
|
415
|
+
if (stat.verdict === 'ok') return t('statClean', { path: stat.path, total: stat.totalCookies })
|
|
416
|
+
return t('statFound', {
|
|
417
|
+
count: stat.authCookies, expired: stat.authExpired, live: stat.authLive,
|
|
418
|
+
hosts: stat.byHost.length, bytes: stat.bytes, path: stat.path,
|
|
419
|
+
})
|
|
334
420
|
}
|
package/src/i18n.js
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dsh-cookie-cleaner — 运行时文案 i18n(9 语)。
|
|
3
|
+
*
|
|
4
|
+
* 为什么自己做一层:本插件没有 client 半(运维工具,界面在终端),
|
|
5
|
+
* 宿主规范的 `src/client/locales.ts` 那条路走不到;而 `locale/<lang>.json`
|
|
6
|
+
* 只管市场卡标题/描述,管不到命令行输出。所以消息字典放在这里,
|
|
7
|
+
* 由 CLI / 宿主命令共用。
|
|
8
|
+
*
|
|
9
|
+
* 纪律:
|
|
10
|
+
* - `zh` 是键集真理源,其余 8 语必须与之完全同键(测试机械核对);
|
|
11
|
+
* - 占位符({path} / {count} 等)逐语言保留,不翻译花括号内的名字;
|
|
12
|
+
* - 语言探测优先级:显式参数 → DSH_LANG → LANG/LC_ALL/LC → 系统 locale → zh;
|
|
13
|
+
* - 未知语言回落 zh,绝不因为取不到词条而崩或吞掉输出。
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/** 支持的语言(与 locale/*.json 的 9 语一致)。 */
|
|
17
|
+
export const LANGS = Object.freeze(['zh', 'en', 'ja', 'ko', 'fr', 'de', 'it', 'ru', 'es'])
|
|
18
|
+
|
|
19
|
+
const zh = Object.freeze({
|
|
20
|
+
skipped: '未定位到 cookie 库——如果你用的是 Web 版而非桌面客户端,浏览器自身的 cookie 不由本工具管理,无需清理。',
|
|
21
|
+
skippedCandidates: '候选路径:',
|
|
22
|
+
skippedHint: '若你用的是 Web 版(浏览器直连宿主),本地没有这个库,无需清理;桌面版可用 userDataRoot 或 --db 指定。',
|
|
23
|
+
busy: 'cookie 库此刻读不到(客户端正在运行,被 Chromium 独占):{path}',
|
|
24
|
+
busyWhy: '宿主插件无法在运行期清理这个库 —— 这是操作系统的文件占用,不是本工具的限制。',
|
|
25
|
+
permission: 'cookie 库读不了:权限不够(文件不属于当前用户,或 flatpak/snap 安装的库不在常规位置):{path}',
|
|
26
|
+
permissionHint: '处置:确认用哪个用户跑命令,或直接把库指出来:',
|
|
27
|
+
dbRequired: '--db=<完整路径>',
|
|
28
|
+
exitWin: '完全退出 DSH 客户端(托盘图标 → 退出,并确认进程列表里已无 DeepSeek Harness)',
|
|
29
|
+
exitMac: '完全退出 DSH 客户端(Cmd+Q 或菜单 → Quit;Dock 上图标消失还不够,确认 ps 里已无 DeepSeek Harness)',
|
|
30
|
+
exitLinux: '完全退出 DSH 客户端(关闭主窗口后确认进程列表里已无 DeepSeek Harness / dsh-desktop)',
|
|
31
|
+
dbLine: 'cookie 库:{path}({bytes} B,共 {total} 条)',
|
|
32
|
+
ok: '状态:ok —— 没有 dsh-auth-* 残留,无需清理。',
|
|
33
|
+
found: '状态:发现 {count} 条 dsh-auth-*(已过期 {expired} / 未过期 {live})',
|
|
34
|
+
span: '过期时间跨度:{oldest} ~ {newest}',
|
|
35
|
+
hostLine: 'host_key 分布:',
|
|
36
|
+
note: '说明:dsh-auth-* 的名字按 host:port 哈希,每换一次端口就留一条,未过期的会一直躺到 30 天到期;它们不影响登录(主窗口用内存态凭据、鉴权只认当前端口那一条),也不涉及账号凭据/会话/插件配置。',
|
|
37
|
+
nextStatus: '下一步:{exit}后,在终端执行(先看会删几条可加 --dry-run):',
|
|
38
|
+
nextClean: '清理命令(务必先{exit},运行期做不到):',
|
|
39
|
+
cleanFooter: ' 默认档删全部 dsh-auth-*;--expired-only 只删已过期的;写盘前自动留 .bak 副本。',
|
|
40
|
+
statClean: '干净:{path}(共 {total} 条 cookie,无 dsh-auth-* 残留)',
|
|
41
|
+
statBusy: '无法读取(客户端正在运行,库被 Chromium 独占):{path}',
|
|
42
|
+
|
|
43
|
+
statMissing: 'cookie 库不在这个位置(客户端从未起过、或装在了别处):{path}',
|
|
44
|
+
statPermission: '无权限读取 cookie 库(目录位置不对或文件不属于当前用户):{path}',
|
|
45
|
+
statFound: '发现 {count} 条 dsh-auth-*(已过期 {expired} / 未过期 {live}),分布在 {hosts} 个 host_key,库大小 {bytes} B:{path}',
|
|
46
|
+
deleted: '已删除 {count} 条 dsh-auth-*({scope})',
|
|
47
|
+
scopeAll: '全部',
|
|
48
|
+
scopeExpired: '仅已过期',
|
|
49
|
+
dbSize: ' 库:{path} {before} B → {after} B',
|
|
50
|
+
backup: ' 备份:{backup}',
|
|
51
|
+
backupWith: '(含 {sidecars})',
|
|
52
|
+
backupSkipped: ' 备份:已按 --no-backup 跳过',
|
|
53
|
+
backupWarn: ' 注意:{sidecars} 拷不上(被占),主库副本仍完整,不影响本次删除。',
|
|
54
|
+
untouched: ' 账号凭据、会话、插件配置均未触碰;下次启动会重新换发本地 cookie。',
|
|
55
|
+
dryRun: '[dry-run] 将删除 {count} 条:{path}',
|
|
56
|
+
dryRunTail: '未写盘。去掉 --dry-run 即可执行。',
|
|
57
|
+
notFound: '没找到 cookie 库。候选路径:{candidates} 可用 --db=<完整路径> 指定。',
|
|
58
|
+
nextCliClean: '下一步:{exit}后执行 `dsh-cookie-cleaner --clean`(默认会连未过期的一起删,不影响登录,见 README)。',
|
|
59
|
+
nextCliRerun: '下一步:{exit}后重跑本命令。',
|
|
60
|
+
nextCliPermission: '下一步:确认跑命令的用户拥有该文件,或用 --db=<完整路径> 指向你的库。',
|
|
61
|
+
openFailed: '无法打开 cookie 库:{path}',
|
|
62
|
+
reason: ' 原因:{reason}',
|
|
63
|
+
adviseBusy: ' 处置:这个库在客户端运行期间被 Chromium 独占。请{exit},再执行本命令。',
|
|
64
|
+
|
|
65
|
+
adviseMissing: ' 处置:文件不在这里(可能路径变了、客户端从未起过、或被标记删除)。用 --db=<完整路径> 指向实际的 cookie 库。',
|
|
66
|
+
advisePermission: ' 处置:当前用户读不了这个文件(权限或属主问题)。确认它属于跑本命令的账号;flatpak/snap 安装的库不在常规位置,用 --db=<完整路径> 指出。',
|
|
67
|
+
adviseOwner: ' 处置:这个文件属于另一个用户(不是跑本命令的你)。用那个账号跑,或用 --db=<完整路径> 指向你自己那份库。',
|
|
68
|
+
missingFile: '文件不存在(或被标记删除)',
|
|
69
|
+
cleanFailed: '清理失败:',
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
/** zh 键集的静态清单(i18n.test.js 用它核对其余 8 语,缺键即测试红)。 */
|
|
73
|
+
export const zhKeys = Object.freeze(Object.keys(zh))
|
|
74
|
+
export { zh }
|
|
75
|
+
|
|
76
|
+
/** 语言→字典。`zh` 开机即,其余 8 语由 locales-dict.js 注册进来(避开单文件过大)。 */
|
|
77
|
+
export const dictionaries = { zh }
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* 注册一种语言的字典(仅 locales-dict.js 用)。
|
|
81
|
+
* 键集必须与 zh 同串同数,否则插值会默默回落中文。
|
|
82
|
+
* @param {string} lang
|
|
83
|
+
* @param {Record<string,string>} dict
|
|
84
|
+
*/
|
|
85
|
+
export function registerDictionary(lang, dict) {
|
|
86
|
+
if (!LANGS.includes(lang)) throw new Error(`不支持的语言:${lang}`)
|
|
87
|
+
const missing = zhKeys.filter((key) => typeof dict[key] !== 'string')
|
|
88
|
+
if (missing.length > 0) throw new Error(`${lang} 缺键:${missing.join(', ')}`)
|
|
89
|
+
const extra = Object.keys(dict).filter((key) => !zhKeys.includes(key))
|
|
90
|
+
if (extra.length > 0) throw new Error(`${lang} 多余键(zh 里没有):${extra.join(', ')}`)
|
|
91
|
+
dictionaries[lang] = Object.freeze(dict)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** 取某语言在 Windows 下的进程名提示(文案里出现,需按平台正确)。 */
|
|
95
|
+
export function detectLang(candidates = process.env, systemLocale = safeSystemLocale()) {
|
|
96
|
+
const explicit = String(candidates.DSH_COOKIE_LANG || candidates.DSH_LANG || '').trim()
|
|
97
|
+
if (explicit) return normalize(explicit)
|
|
98
|
+
const fromEnv = String(candidates.LC_ALL || candidates.LC_MESSAGES || candidates.LANG || '').trim()
|
|
99
|
+
if (fromEnv) return normalize(fromEnv)
|
|
100
|
+
return normalize(systemLocale)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function safeSystemLocale() {
|
|
104
|
+
try {
|
|
105
|
+
return Intl.DateTimeFormat().resolvedOptions().locale || ''
|
|
106
|
+
} catch {
|
|
107
|
+
return ''
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** BCP-47 → 我们支持的 9 个短码;认不出来就落 zh(本工具的原生语言)。 */
|
|
112
|
+
export function normalize(tag) {
|
|
113
|
+
const raw = String(tag || '').toLowerCase()
|
|
114
|
+
// POSIX 中性 locale(C / C.UTF-8 / POSIX)不是中文环境,落英文比落中文合理。
|
|
115
|
+
if (/^(c|posix)(\.[\w-]+)?$/.test(raw)) return 'en'
|
|
116
|
+
const base = raw.split(/[-_]/)[0]
|
|
117
|
+
return LANGS.includes(base) ? base : 'zh'
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** 退出客户端的平台化指引。 */
|
|
121
|
+
export function exitFor(platform, t) {
|
|
122
|
+
if (platform === 'darwin') return t('exitMac')
|
|
123
|
+
if (platform === 'win32') return t('exitWin')
|
|
124
|
+
return t('exitLinux')
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* 造一个翻译函数:{name} 形式的插值,缺键回落 zh 原文。
|
|
129
|
+
* @param {string} lang
|
|
130
|
+
*/
|
|
131
|
+
export function translator(lang) {
|
|
132
|
+
const dict = dictionaries[lang] ?? zh
|
|
133
|
+
return (key, vars) => fill(dict[key] ?? zh[key] ?? key, vars)
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function fill(text, vars) {
|
|
137
|
+
if (vars === undefined || vars === null) return text
|
|
138
|
+
return text.replace(/\{(\w+)\}/g, (whole, name) => (name in vars ? String(vars[name]) : whole))
|
|
139
|
+
}
|
package/src/index.js
CHANGED
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
* 在客户端关闭、宿主插件不存在的那个时间窗里执行。
|
|
13
13
|
*/
|
|
14
14
|
import z from '@deepseek-ai/schemastery'
|
|
15
|
-
import { cookieCleanerCommandText, cleanCookies, statCookies } from './report.js'
|
|
15
|
+
import { cookieCleanerCommandText, cleanCookies, setLang, statCookies } from './report.js'
|
|
16
|
+
import { LANGS, detectLang, normalize } from './i18n.js'
|
|
16
17
|
import { installSettingsWaist } from './settings-waist.js'
|
|
17
18
|
|
|
18
19
|
/** Cordis 插件名(与 cordis.patch.yml 的 id 一致)。 */
|
|
@@ -23,11 +24,13 @@ export const inject = []
|
|
|
23
24
|
export const DEFAULT_SETTINGS = Object.freeze({
|
|
24
25
|
userDataRoot: '', // 覆盖 Electron userData 根(多实例/非默认安装位置用)
|
|
25
26
|
expiredOnly: false, // 保守档:命令与脚本默认只把「已过期」当作可清理对象
|
|
27
|
+
lang: '', // 输出语言(zh/en/ja/ko/fr/de/it/ru/es);空=跟环境探测,探不到则 zh
|
|
26
28
|
})
|
|
27
29
|
|
|
28
30
|
export const Config = z.object({
|
|
29
31
|
userDataRoot: z.string().default(DEFAULT_SETTINGS.userDataRoot).volatile().description('覆盖 Electron userData 根目录(默认按平台惯例自动定位)'),
|
|
30
32
|
expiredOnly: z.boolean().default(DEFAULT_SETTINGS.expiredOnly).volatile().description('保守档:只统计/只提示已过期的 dsh-auth cookie'),
|
|
33
|
+
lang: z.string().default(DEFAULT_SETTINGS.lang).volatile().description(`输出语言:${LANGS.join('/')}(留空=自动探测)`),
|
|
31
34
|
})
|
|
32
35
|
|
|
33
36
|
/** volatile 字段/字段级活引用解引出普通值。 */
|
|
@@ -70,13 +73,16 @@ export function apply(ctx, config = {}) {
|
|
|
70
73
|
/** 只读现状 + 处置文案。overrides 可临时换档(`mode:'clean'` 只换措辞,仍不写盘)。 */
|
|
71
74
|
function status(overrides = {}) {
|
|
72
75
|
const cfg = { ...current(), ...overrides }
|
|
76
|
+
// 设置里显式指定则优先,否则按环境探测(探不到落 zh)。
|
|
77
|
+
const lang = normalize(cfg.lang || '')
|
|
78
|
+
setLang(cfg.lang ? lang : detectLang())
|
|
73
79
|
let stat
|
|
74
80
|
try {
|
|
75
81
|
stat = statCookies({ userDataRoot: cfg.userDataRoot })
|
|
76
82
|
} catch (e) {
|
|
77
83
|
stat = { verdict: 'error', message: e && e.message ? e.message : String(e) }
|
|
78
84
|
}
|
|
79
|
-
return { stat, text: cookieCleanerCommandText(stat, cfg) }
|
|
85
|
+
return { stat, text: cookieCleanerCommandText(stat, { ...cfg, lang: undefined }) }
|
|
80
86
|
}
|
|
81
87
|
|
|
82
88
|
// ── 三代设置 waist(0.1.2/0.1.5 installSection、0.1.0/0.1.1 register、0.1.7+ volatile 托管)──
|