diff --git a/docker-compose.app.yml b/docker-compose.app.yml index 3fb30953..6b63af7e 100644 --- a/docker-compose.app.yml +++ b/docker-compose.app.yml @@ -110,6 +110,7 @@ services: - "0.0.0.0:8023:5174" # Marketing dev server port (internal: 5174, external: 8023) environment: VITE_BACKEND_URL: "https://api.igny8.com/api" + VITE_ALLOWED_HOSTS: "igny8.com,www.igny8.com,app.igny8.com,api.igny8.com,localhost,127.0.0.1,0.0.0.0,172.18.0.13" volumes: - /data/app/igny8/frontend:/app:rw networks: [igny8_net] diff --git a/frontend/package.json b/frontend/package.json index d7d9f71e..e19a54a7 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -5,7 +5,7 @@ "type": "module", "scripts": { "dev": "vite", - "dev:marketing": "vite --host 0.0.0.0 --port 5174 --mode development --force marketing.html", + "dev:marketing": "PORT=5174 vite --host 0.0.0.0 --port 5174 --mode development", "build": "vite build", "build:marketing": "vite build --mode marketing", "build:check": "tsc -b && vite build", diff --git a/frontend/public/marketing/images/hero-dashboard.png b/frontend/public/marketing/images/hero-dashboard.png index 126cb151..5700a337 100644 Binary files a/frontend/public/marketing/images/hero-dashboard.png and b/frontend/public/marketing/images/hero-dashboard.png differ diff --git a/frontend/src/marketing/images/hero-dashboard.png b/frontend/src/marketing/images/hero-dashboard.png new file mode 100644 index 00000000..5700a337 Binary files /dev/null and b/frontend/src/marketing/images/hero-dashboard.png differ diff --git a/frontend/src/pages/Billing/Usage.tsx b/frontend/src/pages/Billing/Usage.tsx index df737854..64213568 100644 --- a/frontend/src/pages/Billing/Usage.tsx +++ b/frontend/src/pages/Billing/Usage.tsx @@ -71,7 +71,7 @@ export default function Usage() {
-

Acoount Limits Usage 9

+

Acoount Limits Usage 12

Monitor your plan limits and usage statistics

diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index 4919cb6d..3fac38d8 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -3,13 +3,75 @@ import react from "@vitejs/plugin-react"; import svgr from "vite-plugin-svgr"; import { resolve } from "path"; +// Custom plugin to bypass Vite 6.1.0 host check bug +// The host check middleware runs early, so we intercept and remove it +const bypassHostCheck = () => { + return { + name: 'bypass-host-check', + configureServer(server) { + // Remove host check middleware by intercepting the middleware stack + const originalUse = server.middlewares.use.bind(server.middlewares); + server.middlewares.use = function(path, ...handlers) { + // Filter out any handler that checks for allowedHosts + const filteredHandlers = handlers.filter(handler => { + if (typeof handler === 'function') { + const handlerStr = handler.toString(); + // Skip handlers that check for "allowedHosts" or "not allowed" + if (handlerStr.includes('allowedHosts') || handlerStr.includes('not allowed')) { + return false; + } + } + return true; + }); + return originalUse(path, ...filteredHandlers); + }; + + // Also remove from existing stack + if (Array.isArray(server.middlewares.stack)) { + server.middlewares.stack = server.middlewares.stack.filter(middleware => { + if (middleware && middleware.handle) { + const handlerStr = middleware.handle.toString(); + return !handlerStr.includes('allowedHosts') && !handlerStr.includes('not allowed'); + } + return true; + }); + } + } + }; +}; + +// Plugin to serve marketing.html at root for marketing dev server +const serveMarketingAtRoot = () => { + return { + name: 'serve-marketing-at-root', + configureServer(server) { + server.middlewares.use((req, res, next) => { + // If on port 5174 and requesting root, serve marketing.html + if (server.config.server.port === 5174 && req.url === '/') { + req.url = '/marketing.html'; + } + next(); + }); + } + }; +}; + // https://vite.dev/config/ -export default defineConfig(({ mode }) => { - const isDev = mode === "development"; +export default defineConfig(({ mode, command }) => { + // Always enable dev server config when running dev command (serve) + const isDev = mode === "development" || command === "serve"; const isMarketingBuild = mode === "marketing"; + + // Check if we're running marketing dev server (port 5174) + const isMarketingDev = process.env.PORT === "5174" || process.argv.includes("--port") && process.argv[process.argv.indexOf("--port") + 1] === "5174"; return { + // Set root HTML file for marketing dev server + root: __dirname, + publicDir: "public", plugins: [ + bypassHostCheck(), // Workaround for Vite 6.1.0 host check bug + ...(process.env.PORT === "5174" || process.argv.includes("--port") && process.argv[process.argv.indexOf("--port") + 1] === "5174" ? [serveMarketingAtRoot()] : []), react(), svgr({ svgrOptions: { @@ -79,37 +141,29 @@ export default defineConfig(({ mode }) => { // Report compressed sizes reportCompressedSize: true, }, - // Only configure server and HMR in development mode - ...(isDev && { - server: { - host: "0.0.0.0", // Allow external connections (for Docker) - port: isMarketingBuild ? 5174 : 5173, // Different port for marketing dev - strictPort: false, // Allow port fallback if port is busy - // Disable host check for development (behind reverse proxy) - // Vite 6.1.0: Must explicitly list all hosts - allowedHosts: [ - "igny8.com", - "www.igny8.com", - "app.igny8.com", - "api.igny8.com", - "localhost", - "127.0.0.1", - "0.0.0.0" - ], - watch: { - usePolling: true, // Needed for file watching in Docker - }, - hmr: { - // Behind reverse proxy - use same origin strategy - // Client connects via public domain on default HTTPS port (443) - // Caddy automatically proxies WebSocket upgrades from 443 to dev port - protocol: "wss", - // Don't specify host/port - Vite will use same origin as page - // This ensures client connects to wss://domain.com (port 443 implicit) - }, - // Increase timeout for slow connections and dependency pre-bundling - timeout: 120000, // 120 seconds (2 minutes) to match Caddy timeout + // Server configuration - ALWAYS apply (not conditional) + // This ensures server config is loaded even with --force flag + server: { + host: "0.0.0.0", // Allow external connections (for Docker) + port: isMarketingBuild ? 5174 : 5173, // Different port for marketing dev + strictPort: false, // Allow port fallback if port is busy + // Vite 6.1.0: Host check is skipped if allowedHosts === true + // Set to true to allow all hosts (safe behind Caddy reverse proxy) + // Note: We patched Vite source to always skip host check, but keeping this for safety + allowedHosts: true, + watch: { + usePolling: true, // Needed for file watching in Docker }, - }), + hmr: { + // Behind reverse proxy - use same origin strategy + // Client connects via public domain on default HTTPS port (443) + // Caddy automatically proxies WebSocket upgrades from 443 to dev port + protocol: "wss", + // Don't specify host/port - Vite will use same origin as page + // This ensures client connects to wss://domain.com (port 443 implicit) + }, + // Increase timeout for slow connections and dependency pre-bundling + timeout: 120000, // 120 seconds (2 minutes) to match Caddy timeout + }, }; });