mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 21:10:43 +00:00
fix(ui): respect section filters for virtual config sections and reconcile push state with gateway
Virtual sections (__appearance__, __notifications__) now respect includeSections/excludeSections filters so they only appear in their intended tabs. Push initialization re-registers the local subscription with the gateway to handle state-dir loss scenarios.
This commit is contained in:
committed by
Val Alexander
parent
b079b36677
commit
c02e527dff
@@ -963,7 +963,25 @@ export class OpenClawApp extends LitElement {
|
||||
try {
|
||||
const { getExistingSubscription } = await import("./push-subscription.ts");
|
||||
const existing = await getExistingSubscription();
|
||||
this.webPushSubscribed = existing !== null;
|
||||
if (existing && this.client) {
|
||||
// Re-register with the gateway to reconcile local/server state.
|
||||
// Handles the case where the gateway lost the subscription (e.g.
|
||||
// state-dir reset) but the browser still has one locally.
|
||||
const subJson = existing.toJSON();
|
||||
if (subJson.endpoint && subJson.keys?.p256dh && subJson.keys?.auth) {
|
||||
try {
|
||||
await this.client.request("push.web.subscribe", {
|
||||
endpoint: subJson.endpoint,
|
||||
keys: { p256dh: subJson.keys.p256dh, auth: subJson.keys.auth },
|
||||
});
|
||||
} catch {
|
||||
// Best-effort — don't block init if gateway is unreachable.
|
||||
}
|
||||
}
|
||||
this.webPushSubscribed = true;
|
||||
} else {
|
||||
this.webPushSubscribed = existing !== null;
|
||||
}
|
||||
} catch {
|
||||
// ignore — just means we can't check
|
||||
}
|
||||
|
||||
@@ -969,16 +969,15 @@ export function renderConfig(props: ConfigProps) {
|
||||
const schemaProps = analysis.schema?.properties ?? {};
|
||||
|
||||
const VIRTUAL_SECTIONS = new Set(["__appearance__", "__notifications__"]);
|
||||
const visibleCategories = SECTION_CATEGORIES.map((cat) =>
|
||||
Object.assign({}, cat, {
|
||||
sections: cat.sections.filter(
|
||||
(s) =>
|
||||
((includeVirtualSections && VIRTUAL_SECTIONS.has(s.key)) || s.key in schemaProps) &&
|
||||
(!include || include.has(s.key)) &&
|
||||
(!exclude || !exclude.has(s.key)),
|
||||
),
|
||||
}),
|
||||
).filter((cat) => cat.sections.length > 0);
|
||||
const visibleCategories = SECTION_CATEGORIES.map((cat) => ({
|
||||
...cat,
|
||||
sections: cat.sections.filter(
|
||||
(s) =>
|
||||
((includeVirtualSections && VIRTUAL_SECTIONS.has(s.key)) || s.key in schemaProps) &&
|
||||
(!include || include.has(s.key)) &&
|
||||
(!exclude || !exclude.has(s.key)),
|
||||
),
|
||||
})).filter((cat) => cat.sections.length > 0);
|
||||
|
||||
// Catch any schema keys not in our categories
|
||||
const extraSections = Object.keys(schemaProps)
|
||||
|
||||
Reference in New Issue
Block a user