@leiyi-works/dsh-session-tmpdir 0.9.7 → 0.9.8
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 +3 -1
- package/index.js +16 -14
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -224,4 +224,6 @@ v0.9.5 变更(2026-11-16):**复制/移动类命令不再判源路径**。`
|
|
|
224
224
|
|
|
225
225
|
v0.9.6 变更(2026-11-16):**`Start-Process` 不再默认算写命令**。它只是启动外部程序,参数里的路径通常是程序要打开的文件(读)。现在只有带 `-RedirectStandardOutput` / `-RedirectStandardError`(真正写文件)时才参与路径判定;`Start-Process notepad C:\缺失.txt` 这类不再误拦。
|
|
226
226
|
|
|
227
|
-
v0.9.7 变更(2026-11-16
|
|
227
|
+
v0.9.7 变更(2026-11-16):白名单曾改为按机器名分文件(`session-tmpdir-approvals-<机器名>.json`),意图是避免跨机同步互相覆盖。**该前提判断有误**,见 0.9.8。
|
|
228
|
+
|
|
229
|
+
v0.9.8 变更(2026-11-16):**白名单恢复通用文件名**。核对云端同步源码(`sync.js`:`data/session-tmpdir-*` 直接跳过)后确认:白名单文件本来就**不参与云端同步**,因此不会跨机覆盖、也不会每台机器多出别的机器的文件。改回固定路径 `<DSH_HOME>/data/session-tmpdir-approvals.json`(每台机器只有这一个文件);0.9.7 的按机器名文件只作为**读取回退**,写入统一回到通用文件。白名单语义:本机有效、同机重启后保留、跨机不共享(本来也不同步)。
|
package/index.js
CHANGED
|
@@ -1306,32 +1306,34 @@ export function resolveDshHome() { const fromEnv = process.env.DSH_HOME && proc
|
|
|
1306
1306
|
const APPROVALS_FILE = 'session-tmpdir-approvals.json'
|
|
1307
1307
|
|
|
1308
1308
|
/**
|
|
1309
|
-
*
|
|
1310
|
-
*
|
|
1309
|
+
* 白名单是本机文件:云端同步的排除名单包含 `data/session-tmpdir-*`
|
|
1310
|
+
* (cloud-sync: `rel.slice(5).startsWith('session-tmpdir-')` 直接跳过),
|
|
1311
|
+
* 因此固定用通用文件名即可,不会跨机同步、不会按机器产生多份文件。
|
|
1311
1312
|
*/
|
|
1312
|
-
function
|
|
1313
|
+
function machineApprovalsPathV097() {
|
|
1313
1314
|
let raw = ''
|
|
1314
1315
|
try {
|
|
1315
1316
|
raw = String(hostname() ?? '')
|
|
1316
1317
|
} catch {
|
|
1317
1318
|
raw = ''
|
|
1318
1319
|
}
|
|
1319
|
-
const safe =
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1320
|
+
const safe =
|
|
1321
|
+
raw
|
|
1322
|
+
.toLowerCase()
|
|
1323
|
+
.replace(/[^a-z0-9._-]+/g, '-')
|
|
1324
|
+
.replace(/^-+|-+$/g, '')
|
|
1325
|
+
.slice(0, 40) || 'machine'
|
|
1326
|
+
return join(resolveDshHome(), 'data', `session-tmpdir-approvals-${safe}.json`)
|
|
1325
1327
|
}
|
|
1326
1328
|
|
|
1327
|
-
/** Absolute path of
|
|
1329
|
+
/** Absolute path of the whitelist store (machine-local; never cloud-synced). */
|
|
1328
1330
|
export function approvalsFilePath() {
|
|
1329
|
-
return join(resolveDshHome(), 'data',
|
|
1331
|
+
return join(resolveDshHome(), 'data', APPROVALS_FILE)
|
|
1330
1332
|
}
|
|
1331
1333
|
|
|
1332
|
-
/**
|
|
1334
|
+
/** v0.9.8: 0.9.7 曾按机器名分文件;仅作读取回退,写入统一回到通用文件。 */
|
|
1333
1335
|
export function legacyApprovalsFilePath() {
|
|
1334
|
-
return
|
|
1336
|
+
return machineApprovalsPathV097()
|
|
1335
1337
|
}
|
|
1336
1338
|
|
|
1337
1339
|
/** Load the whitelist; a missing or corrupt file means an empty whitelist. */
|
|
@@ -2224,7 +2226,7 @@ export function apply(ctx, config) {
|
|
|
2224
2226
|
'',
|
|
2225
2227
|
'### Whitelist panel',
|
|
2226
2228
|
'',
|
|
2227
|
-
`Every approval is stored in
|
|
2229
|
+
`Every approval is stored in the machine-local file \`<DSH_HOME>/data/session-tmpdir-approvals.json\` (files under \`data/session-tmpdir-*\` are excluded from cloud sync, so nothing is shared across machines) and shown in the left sidebar panel 「临时目录」 (display + remove only). Approvals survive a restart of the same session; entries whose session was deleted are pruned by the cleanup tick, and entries whose target no longer exists are pruned when the panel refreshes.`,
|
|
2228
2230
|
].join('\n'),
|
|
2229
2231
|
}),
|
|
2230
2232
|
)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leiyi-works/dsh-session-tmpdir",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Per-session task temp folder with a long-term write guard. v0.9 (方案3): creating a new file outside _tmp requires the user's approval (per file by default, per directory with mode=dir), overwriting an existing file is allowed without asking, every write channel is guarded (write/edit, shell including ffmpeg/pandoc/Export-*/IO APIs, publish copies, code runtimes, unknown tools), and the persisted whitelist is shown in a left-sidebar panel「临时目录」 where entries can be removed. Every session also gets _tmp/<session title>/ in its working directory, cleaned 7 days after the session is deleted; the same tick reclaims the attachment store.",
|
|
6
6
|
"exports": {
|