Seperater CHeck inserver auf Port 3334

This commit is contained in:
Carsten Graf
2026-01-23 11:08:53 +01:00
parent 70c106ec1a
commit 0f10f35149
2 changed files with 137 additions and 111 deletions

View File

@@ -115,14 +115,25 @@
}
}
// URLs mit aktueller Domain aktualisieren
// URLs mit aktueller Domain aktualisieren (Port 3334 für Check-in)
document.addEventListener('DOMContentLoaded', function() {
const userId = '<%= user.id %>';
const baseUrl = window.location.origin;
// Check-in URLs verwenden Port 3334
// Ersetze Port in URL oder füge Port hinzu falls nicht vorhanden
let checkinBaseUrl;
if (baseUrl.match(/:\d+$/)) {
// Port vorhanden - ersetze ihn
checkinBaseUrl = baseUrl.replace(/:\d+$/, ':3334');
} else {
// Kein Port - füge Port hinzu
const url = new URL(baseUrl);
checkinBaseUrl = `${url.protocol}//${url.hostname}:3334`;
}
const checkinInput = document.getElementById('checkinUrl');
const checkoutInput = document.getElementById('checkoutUrl');
if (checkinInput) checkinInput.value = `${baseUrl}/api/checkin/${userId}`;
if (checkoutInput) checkoutInput.value = `${baseUrl}/api/checkout/${userId}`;
if (checkinInput) checkinInput.value = `${checkinBaseUrl}/api/checkin/${userId}`;
if (checkoutInput) checkoutInput.value = `${checkinBaseUrl}/api/checkout/${userId}`;
// Rollenwechsel-Handler
const roleSwitcher = document.getElementById('roleSwitcher');