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:
Haze
2026-02-06 03:40:47 +08:00
Unverified
parent 71409042cb
commit f67370ce03
3 changed files with 34 additions and 18 deletions

View File

@@ -26,15 +26,19 @@ export function Dashboard() {
const { channels, fetchChannels } = useChannelsStore();
const { skills, fetchSkills } = useSkillsStore();
// Fetch data on mount
useEffect(() => {
fetchChannels();
fetchSkills();
}, [fetchChannels, fetchSkills]);
const isGatewayRunning = gatewayStatus.state === 'running';
// Calculate statistics
const connectedChannels = channels.filter((c) => c.status === 'connected').length;
const enabledSkills = skills.filter((s) => s.enabled).length;
// Fetch data only when gateway is running
useEffect(() => {
if (isGatewayRunning) {
fetchChannels();
fetchSkills();
}
}, [fetchChannels, fetchSkills, isGatewayRunning]);
// Calculate statistics safely
const connectedChannels = Array.isArray(channels) ? channels.filter((c) => c.status === 'connected').length : 0;
const enabledSkills = Array.isArray(skills) ? skills.filter((s) => s.enabled).length : 0;
// Calculate uptime
const uptime = gatewayStatus.connectedAt