dsh-file-activity 0.5.14 → 0.5.15
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 +7 -0
- package/lib/client.js +8 -2
- package/lib/index.js +4 -3
- package/lib/parts/i18n.part.js +8 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
本文件记录 dsh-file-activity 的所有版本变更。格式遵循 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/),版本号遵循 [语义化版本](https://semver.org/lang/zh-CN/)。
|
|
4
4
|
|
|
5
5
|
|
|
6
|
+
## [0.5.15] - 2026-10-17
|
|
7
|
+
|
|
8
|
+
### 变更
|
|
9
|
+
|
|
10
|
+
- fix(i18n): 插件文案优先跟随宿主 html lang
|
|
11
|
+
- fix(compat): 适配 DSH 0.2.1 移除 webRuntime 服务
|
|
12
|
+
|
|
6
13
|
## [0.5.14] - 2026-10-17
|
|
7
14
|
|
|
8
15
|
### 变更
|
package/lib/client.js
CHANGED
|
@@ -55,9 +55,15 @@ window.__ModuleLoader__.load({
|
|
|
55
55
|
'use strict'
|
|
56
56
|
// ── i18n ──────────────────────────────────────────────────────────────
|
|
57
57
|
function isZh() {
|
|
58
|
+
// 宿主 locale(dsh-client-locale 同步到 <html lang>)优先;空则回退浏览器语言。
|
|
58
59
|
try {
|
|
59
|
-
const
|
|
60
|
-
return
|
|
60
|
+
const host = (document.documentElement.lang || '').toLowerCase()
|
|
61
|
+
if (host !== '') return host.startsWith('zh')
|
|
62
|
+
} catch {
|
|
63
|
+
/* 非浏览器环境(node 渲染)无 document */
|
|
64
|
+
}
|
|
65
|
+
try {
|
|
66
|
+
return (navigator.language || 'en').toLowerCase().startsWith('zh')
|
|
61
67
|
} catch {
|
|
62
68
|
return false
|
|
63
69
|
}
|
package/lib/index.js
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* 旧实现每次防抖全量重写,写放大 3,665×)。入口三维上限(会话 / 每会话路径 /
|
|
18
18
|
* 全局路径)超限按 LRU 淘汰并告警 —— 内存与状态文件均有界。
|
|
19
19
|
*/
|
|
20
|
-
import {
|
|
20
|
+
import { createTrustFence } from 'dsh-shared';
|
|
21
21
|
import { createApiHandler } from './api-route.js';
|
|
22
22
|
import { createMediaHandler } from './media-route.js';
|
|
23
23
|
import { createFsObserver } from './observer.js';
|
|
@@ -25,7 +25,7 @@ import { createStore } from './store.js';
|
|
|
25
25
|
import { parseBashFileOps } from './bash-parse.js';
|
|
26
26
|
import { sessionCwdOf } from './cwd.js';
|
|
27
27
|
export const name = 'dsh-file-activity';
|
|
28
|
-
export const inject = ['webServer', 'sessions'
|
|
28
|
+
export const inject = ['webServer', 'sessions'];
|
|
29
29
|
/** 观察型监听:只读取 bash 命令隐含的文件操作并上报,不拦截(返回 next())。 */
|
|
30
30
|
function observeBashIntents(exec, ctx, store) {
|
|
31
31
|
const sessionId = bashSessionOf(exec);
|
|
@@ -70,7 +70,8 @@ export function apply(ctx) {
|
|
|
70
70
|
return next();
|
|
71
71
|
});
|
|
72
72
|
// ── routes ──────────────────────────────────────────────────────────────
|
|
73
|
-
|
|
73
|
+
// 信任源:webStartup.trustedHosts + webServer.host(DSH 0.2.1 移除了 webRuntime)
|
|
74
|
+
const fence = createTrustFence(ctx);
|
|
74
75
|
ctx.effect(() => ctx.webServer.register({
|
|
75
76
|
kind: 'prefix',
|
|
76
77
|
path: '/file-activity/api',
|
package/lib/parts/i18n.part.js
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
// ── i18n ──────────────────────────────────────────────────────────────
|
|
3
3
|
function isZh() {
|
|
4
|
+
// 宿主 locale(dsh-client-locale 同步到 <html lang>)优先;空则回退浏览器语言。
|
|
4
5
|
try {
|
|
5
|
-
const
|
|
6
|
-
return
|
|
6
|
+
const host = (document.documentElement.lang || '').toLowerCase()
|
|
7
|
+
if (host !== '') return host.startsWith('zh')
|
|
8
|
+
} catch {
|
|
9
|
+
/* 非浏览器环境(node 渲染)无 document */
|
|
10
|
+
}
|
|
11
|
+
try {
|
|
12
|
+
return (navigator.language || 'en').toLowerCase().startsWith('zh')
|
|
7
13
|
} catch {
|
|
8
14
|
return false
|
|
9
15
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-file-activity",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.15",
|
|
4
4
|
"description": "DSH 侧边栏文件活动插件:按 LRU 记录文件读取/新增/修改事件(最近访问),按绝对路径树形统计(文件统计),点击文件浮窗预览(代码高亮/Markdown/图片/PDF)。DSH web plugin: file activity tracker — LRU recent-access list plus per-file read/create/modify counts in a folder tree, with floating preview.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|