// Basis-URL für Backend-API export const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || "http://192.168.0.105:5000"; // Frontend-URL für Callbacks - unterstützt mehrere Domains const getFrontendUrl = () => { // Priorität 1: Explizit gesetzte Umgebungsvariable if (process.env.NEXT_PUBLIC_FRONTEND_URL) { return process.env.NEXT_PUBLIC_FRONTEND_URL; } // Priorität 2: Spezifischer Hostname für das Netzwerk if (typeof window !== 'undefined') { // Im Browser: Prüfen auf m040tbaraspi001.de040.corpintra.net const hostname = window.location.hostname; if (hostname === 'm040tbaraspi001' || hostname === 'm040tbaraspi001.de040.corpintra.net' || hostname.includes('corpintra.net')) { return `http://${hostname}`; } } // Priorität 3: Default für Localhost return "http://localhost:3000"; }; export const FRONTEND_URL = getFrontendUrl(); // OAuth Callback URL - muss exakt mit der registrierten URL in GitHub übereinstimmen export const OAUTH_CALLBACK_URL = process.env.NEXT_PUBLIC_OAUTH_CALLBACK_URL || `${FRONTEND_URL}/auth/login/callback`; // Liste der erlaubten Hostnamen für OAuth-Callbacks export const ALLOWED_CALLBACK_HOSTS = [ 'localhost', 'm040tbaraspi001', 'm040tbaraspi001.de040.corpintra.net', '192.168.0.105' ]; // Endpunkte für die verschiedenen Ressourcen export const API_ENDPOINTS = { PRINTERS: `${API_BASE_URL}/api/printers`, JOBS: `${API_BASE_URL}/api/jobs`, USERS: `${API_BASE_URL}/api/users`, // OAuth-spezifische Endpunkte AUTH: { LOGIN: `${API_BASE_URL}/api/auth/login`, CALLBACK: `${API_BASE_URL}/api/auth/callback`, } };