From e25a1b4fec682908a215e5753f870713d9b7db15 Mon Sep 17 00:00:00 2001 From: Agent Zero Date: Sun, 16 Aug 2026 13:50:39 +0200 Subject: [PATCH] =?UTF-8?q?fix(ui):=20CommandPalette=20outside=20Router=20?= =?UTF-8?q?context=20=E2=80=94=20white=20page=20fix;=20remove=20PWA;=20fix?= =?UTF-8?q?=20CSP=20for=20Google=20Fonts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/core/middleware.py | 4 +- frontend/src/App.tsx | 4 +- .../src/components/layout/StartLayout.tsx | 2 + frontend/vite.config.ts | 52 ------------------- 4 files changed, 5 insertions(+), 57 deletions(-) diff --git a/app/core/middleware.py b/app/core/middleware.py index 07b31d1..a00d0ad 100644 --- a/app/core/middleware.py +++ b/app/core/middleware.py @@ -37,9 +37,9 @@ class SecurityHeadersMiddleware(BaseHTTPMiddleware): response.headers["Content-Security-Policy"] = ( "default-src 'self'; " "script-src 'self'; " - "style-src 'self' 'unsafe-inline'; " + "style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; " "img-src 'self' data: blob:; " - "font-src 'self'; " + "font-src 'self' https://fonts.gstatic.com; " "connect-src 'self' wss: ws:; " "frame-ancestors 'none'; " "base-uri 'self'; " diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index dac982d..cf3ce82 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -7,8 +7,7 @@ import { useThemeStore } from '@/store/themeStore'; import { ErrorBoundary } from '@/components/common/ErrorBoundary'; import { useToast } from '@/components/ui/Toast'; import { useOnlineStatus } from '@/hooks/useOnlineStatus'; -import { CommandPalette } from '@/components/search/CommandPalette'; -import { useCommandPalette } from '@/hooks/useCommandPalette'; + function QueryClientWrapper({ children }: { children: React.ReactNode }) { const toast = useToast(); @@ -81,7 +80,6 @@ export default function App() { - ); } diff --git a/frontend/src/components/layout/StartLayout.tsx b/frontend/src/components/layout/StartLayout.tsx index 99132ad..740a291 100644 --- a/frontend/src/components/layout/StartLayout.tsx +++ b/frontend/src/components/layout/StartLayout.tsx @@ -9,6 +9,7 @@ import { ToastContainer } from '@/components/ui/Toast'; import { PluginRegistry } from '@/components/plugins/PluginRegistry'; import { ErrorBoundary } from '@/components/common/ErrorBoundary'; import { Outlet } from 'react-router-dom'; +import { CommandPalette } from '@/components/search/CommandPalette'; export function StartLayout() { return ( @@ -22,6 +23,7 @@ export function StartLayout() { + ); diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index fa1ace0..4194d2b 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -1,62 +1,10 @@ import { defineConfig } from 'vite'; import react from '@vitejs/plugin-react'; -import { VitePWA } from 'vite-plugin-pwa'; import { resolve } from 'path'; export default defineConfig({ plugins: [ react(), - VitePWA({ - registerType: 'autoUpdate', - includeAssets: ['favicon.svg', 'icon-192.svg', 'icon-512.svg', 'print.css'], - manifest: { - name: 'LeoCRM', - short_name: 'LeoCRM', - description: 'Self-hosted CRM system for small sales teams', - theme_color: '#3b82f6', - background_color: '#0f172a', - display: 'standalone', - start_url: '/', - icons: [ - { - src: '/icon-192.svg', - sizes: '192x192', - type: 'image/svg+xml', - purpose: 'any maskable', - }, - { - src: '/icon-512.svg', - sizes: '512x512', - type: 'image/svg+xml', - purpose: 'any maskable', - }, - ], - }, - workboxConfig: { - globPatterns: ['**/*.{js,css,html,svg,png,ico,woff2}'], - maximumFileSizeToCacheInBytes: 5 * 1024 * 1024, - runtimeCaching: [ - { - urlPattern: /^https:\/\/fonts\.googleapis\.com\/.*/i, - handler: 'CacheFirst', - options: { - cacheName: 'google-fonts-cache', - expiration: { - maxEntries: 10, - maxAgeSeconds: 60 * 60 * 24 * 365, - }, - }, - }, - { - urlPattern: /\/_app\/api\//i, - handler: 'NetworkOnly', - }, - ], - }, - devOptions: { - enabled: false, - }, - }), ], resolve: { alias: {