@iasiv5/dsh-obmc-web 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
|
@@ -59,7 +59,7 @@ import os from 'node:os'
|
|
|
59
59
|
import path from 'node:path'
|
|
60
60
|
|
|
61
61
|
export const name = '@iasiv5/dsh-obmc-web'
|
|
62
|
-
export const inject = ['webServer'
|
|
62
|
+
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 */
|
|
63
63
|
|
|
64
64
|
const UP_HOST = '127.0.0.1'
|
|
65
65
|
const DEFAULT_RELAY_PORT = 18443
|
|
@@ -731,7 +731,14 @@ export function apply(ctx) {
|
|
|
731
731
|
if (createdTemplate) ctx.logger?.info?.(`[dsh-obmc-web] first start: wrote a commented config template to ${ENV_FILE} — configure it in Settings → BMC 控制台`)
|
|
732
732
|
Object.assign(envConfig, readEnvConfig())
|
|
733
733
|
bmcState.target = envConfig.bmcTarget
|
|
734
|
-
|
|
734
|
+
/* 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) → []. */
|
|
735
|
+
const resolveTrustedHosts = () => {
|
|
736
|
+
let startup, runtime
|
|
737
|
+
try { startup = ctx?.get?.('webStartup') } catch {}
|
|
738
|
+
try { runtime = ctx?.get?.('webRuntime') } catch {}
|
|
739
|
+
return startup?.trustedHosts ?? runtime?.trustedHosts ?? []
|
|
740
|
+
}
|
|
741
|
+
const trustedHostsOf = () => resolveTrustedHosts()
|
|
735
742
|
const fence = req => trustedRequest(req, trustedHostsOf())
|
|
736
743
|
const guarded = handler => (req, res) => {
|
|
737
744
|
if (!fence(req)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iasiv5/dsh-obmc-web",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "OpenBMC 控制台入口:设置一级菜单「BMC 控制台」面板一键在顶层标签页打开 BMC Web UI,同源代理经 SSH 本地转发 relay(obmc-web-relay)抵达 BMC,BMC IP 变化自动探测并重定向隧道;需 SSH 跳板机可达 BMC。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|