refactor: basePath als Umgebungsvariable eingeführt (NEXT_PUBLIC_BASE_PATH)

- alle festen "/talas5/" Pfade entfernt
- dynamischer basePath für API-Links und Station öffnen
- README.md und CHANGELOG.md aktualisiert
- Version erhöht auf 1.1.188
This commit is contained in:
ISA
2025-05-27 11:58:28 +02:00
parent 1a4d5e6112
commit cdca624874
17 changed files with 99 additions and 28 deletions

View File

@@ -1,6 +1,8 @@
// utils/openInNewTab.js
export function openInNewTab(e, target) {
const mode = process.env.NEXT_PUBLIC_API_PORT_MODE;
const basePath = process.env.NEXT_PUBLIC_BASE_PATH || "";
const url = new URL(window.location.origin);
const originWithoutPort = `${url.protocol}//${url.hostname}`; // Protokoll und Hostname, ohne Port
@@ -16,13 +18,13 @@ export function openInNewTab(e, target) {
}
if (target instanceof L.Marker && target.options.link) {
link = `${originWithoutPort}/talas5/devices/${target.options.link}`;
link = `${originWithoutPort}${basePath}/devices/${target.options.link}`;
console.log("Link des Markers", link);
} else if (target instanceof L.Polyline) {
const idLD = target.options.idLD;
console.log("idLD der Linie", idLD);
if (idLD) {
link = `${originWithoutPort}/talas5/devices/cpl.aspx?id=${idLD}`;
link = `${originWithoutPort}${basePath}/devices/cpl.aspx?id=${idLD}`;
} else {
console.error("Keine gültige 'idLD' für die Linie gefunden.");
return;