import type { CapacitorConfig } from '@capacitor/cli'; // The native app has TWO build targets: // * default → thin WebView shell that loads the live /mobile site (server.url). // * CAP_BUNDLED=1 → static SPA: no server.url, the bundled webDir is served locally and // data is fetched from config.public.apiBase via the app's fetch // interceptor + server CORS. Build it with `npm run build:app`. // Override the remote URL for a local live-reload build with CAP_SERVER_URL + CAP_ENV=dev. const SERVER_URL = process.env.CAP_SERVER_URL || 'https://app.logship.de'; const isDev = process.env.CAP_ENV === 'dev'; const BUNDLED = process.env.CAP_BUNDLED === '1'; const config: CapacitorConfig = { appId: 'com.logship.mobile', appName: 'LogShip Mobile', webDir: '.output/public', // Bundled target omits `server` entirely → the WebView loads the local bundle. The remote-URL // target keeps the existing live-site behavior unchanged. ...(BUNDLED ? {} : { server: { url: `${SERVER_URL}/mobile`, ...(isDev ? { cleartext: true } : {}), }, }), android: { // https scheme → app origin `https://localhost`: a secure context (required for getUserMedia // camera/mic) and the clean CORS origin the app-auth middleware allow-lists. androidScheme: 'https', initialFocus: false, ...(isDev && !BUNDLED ? { allowMixedContent: true } : {}), buildOptions: { signingType: 'apksigner', }, }, // No CapacitorHttp: the bundled app uses the normal WebView fetch (so multipart/binary uploads // work natively) + server CORS emitted by server/middleware/00.app-auth.ts. plugins: {}, }; export default config;