mirror of
https://github.com/hansjone/netxops.git
synced 2026-10-10 17:35:11 +08:00
Fix KB settings badge stuck on unconfigured after bind (0.1.38).
Reload Host kbRoot after browse/save so the status badge tracks the live package instead of a stale snapshot. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
0f31a6648a
commit
1b4c402723
9 changed files with 261 additions and 50 deletions
22
src/index.ts
22
src/index.ts
|
|
@ -624,6 +624,28 @@ export function apply(ctx: Context, config: Config = Config({})): void {
|
|||
if (endpoint === 'kb.status') {
|
||||
return { ok: true, value: getKbContext() }
|
||||
}
|
||||
if (endpoint === 'kb.reload') {
|
||||
// Re-read live settings and publish — used by the settings card after
|
||||
// browse/save so the badge does not stick on a stale unconfigured snapshot.
|
||||
const current = source()
|
||||
const kb = resolveKbRoot(current.kbRoot ?? '')
|
||||
publishKbContext(kb)
|
||||
applyKbEnv(kb)
|
||||
if (kb.status === 'configured') {
|
||||
connCtx.logger.info(
|
||||
'netxops: kb.reload → %s (%s / %s v%s)',
|
||||
kb.realRoot,
|
||||
kb.operatorName,
|
||||
kb.country,
|
||||
kb.version,
|
||||
)
|
||||
} else if (kb.status === 'error') {
|
||||
connCtx.logger.warn('netxops: kb.reload error — %s', kb.errorMessage)
|
||||
} else {
|
||||
connCtx.logger.info('netxops: kb.reload → unconfigured (kbRoot empty)')
|
||||
}
|
||||
return { ok: true, value: kb }
|
||||
}
|
||||
if (endpoint === 'kb.resolve') {
|
||||
const path = extractKbResolvePath(payload)
|
||||
return { ok: true, value: resolveKbRoot(path) }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue