- Added SSL configuration to the backend, including self-signed certificate generation and management. - Updated `setup_myp.sh` to create SSL certificates during installation. - Enhanced `app.py` to support SSL context for secure communication. - Introduced a new SSL management menu in the setup script for easier certificate handling. - Updated frontend API calls to use HTTPS for secure data transmission. - Implemented kiosk mode features, including automatic browser launch with SSL support. - Improved documentation in `SUMMARY.md` to reflect new features and network topology changes.
68 lines
2.2 KiB
TypeScript
68 lines
2.2 KiB
TypeScript
// Basis-URL für Backend-API
|
|
export const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || "https://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 `https://${hostname}`;
|
|
}
|
|
}
|
|
|
|
// Priorität 3: Default für Localhost
|
|
return "https://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'
|
|
];
|
|
|
|
// Funktion zum Testen der SSL-Verbindung
|
|
export const testSSLConnection = async (): Promise<boolean> => {
|
|
try {
|
|
// Führe einen einfachen GET-Request zum Backend aus
|
|
const response = await fetch(`${API_BASE_URL}/health`, {
|
|
method: 'GET',
|
|
mode: 'no-cors', // Keine CORS-Fehler erzeugen
|
|
});
|
|
|
|
// Wenn kein Fehler auftritt, ist die SSL-Verbindung erfolgreich
|
|
return true;
|
|
} catch (error) {
|
|
console.warn('SSL-Verbindungstest fehlgeschlagen:', error);
|
|
return false;
|
|
}
|
|
};
|
|
|
|
// 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`,
|
|
}
|
|
}; |