fix(app): scope header overrides to gateway URLs only
- The session.webRequest.onHeadersReceived was stripping X-Frame-Options and modifying CSP for ALL responses including the Vite dev server, which could break the main app rendering. Now only applies to gateway URLs (127.0.0.1:18789 / localhost:18789). - Dashboard: only fetch channels/skills when gateway is running - Dashboard: guard against non-array channels/skills data - Gateway store: use dynamic import() instead of require() for chat store to avoid ESM/CJS issues in Vite
This commit is contained in:
@@ -62,13 +62,18 @@ export const useGatewayStore = create<GatewayState>((set, get) => ({
|
||||
|
||||
// Listen for chat events from the gateway and forward to chat store
|
||||
window.electron.ipcRenderer.on('gateway:chat-message', (data) => {
|
||||
const { useChatStore } = require('./chat');
|
||||
const chatData = data as { message?: Record<string, unknown> } | Record<string, unknown>;
|
||||
// The event payload may be nested under 'message' or directly on data
|
||||
const event = ('message' in chatData && typeof chatData.message === 'object')
|
||||
? chatData.message as Record<string, unknown>
|
||||
: chatData as Record<string, unknown>;
|
||||
useChatStore.getState().handleChatEvent(event);
|
||||
try {
|
||||
// Dynamic import to avoid circular dependency
|
||||
import('./chat').then(({ useChatStore }) => {
|
||||
const chatData = data as { message?: Record<string, unknown> } | Record<string, unknown>;
|
||||
const event = ('message' in chatData && typeof chatData.message === 'object')
|
||||
? chatData.message as Record<string, unknown>
|
||||
: chatData as Record<string, unknown>;
|
||||
useChatStore.getState().handleChatEvent(event);
|
||||
});
|
||||
} catch (err) {
|
||||
console.warn('Failed to forward chat event:', err);
|
||||
}
|
||||
});
|
||||
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user