@inventec/dsh-onetree-log 0.1.3 → 0.1.4
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 +9 -2
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -23,7 +23,7 @@ import { pipeline } from 'node:stream/promises'
|
|
|
23
23
|
import { DumpStore } from './store.js'
|
|
24
24
|
|
|
25
25
|
export const name = '@inventec/dsh-onetree-log'
|
|
26
|
-
export const inject = ['webServer'
|
|
26
|
+
export const inject = ['webServer'] /* LOCAL-PATCH 2026-10-18 (know-how 035): 0.2.1 host removed webRuntime (→webStartup); trusted-hosts now resolved per-request via non-throwing dual-service fallback */
|
|
27
27
|
|
|
28
28
|
const MAX_UPLOAD_BYTES = 512 * 1024 * 1024
|
|
29
29
|
const PREVIEW_BYTES = 256 * 1024
|
|
@@ -247,7 +247,14 @@ export function apply(ctx) {
|
|
|
247
247
|
store = new DumpStore()
|
|
248
248
|
ctx.logger?.info?.(`[dsh-onetree-log] store at ${store.dumpsDir},已登记 ${store.list().length} 个 dump`)
|
|
249
249
|
|
|
250
|
-
|
|
250
|
+
/* LOCAL-PATCH 2026-10-18 (know-how 035): was `ctx.webRuntime?.trustedHosts` (0.2.1 host removed webRuntime; cordis Local throws on un-injected property access, `?.` cannot protect). 034 pattern: non-throwing ctx.get lookup, webStartup (0.2.1+) → webRuntime (≤0.2.0) → []. */
|
|
251
|
+
const resolveTrustedHosts = () => {
|
|
252
|
+
let startup, runtime
|
|
253
|
+
try { startup = ctx?.get?.('webStartup') } catch {}
|
|
254
|
+
try { runtime = ctx?.get?.('webRuntime') } catch {}
|
|
255
|
+
return startup?.trustedHosts ?? runtime?.trustedHosts ?? []
|
|
256
|
+
}
|
|
257
|
+
const trustedHostsOf = () => resolveTrustedHosts()
|
|
251
258
|
try {
|
|
252
259
|
ctx.effect(() => ctx.webServer.register({
|
|
253
260
|
kind: 'prefix',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inventec/dsh-onetree-log",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "AMI MegaRAC OneTree 一键日志(OpenBMC dreport dump)上传与分析框架:设置面板「OneTree 日志」上传压缩包或登记服务器本地路径,安全解包、自动探测 dump 根、文件清单分类,为第二阶段逐域解析提供内核。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|