Terminplaner: websiteUrl verweist auf die Live-Domain statt auf die Vorschau

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude Sonnet 5.5 committed 2026-10-03 08:17:43 +00:00
1 parent 30d40ad6ce
commit 8e25cd2d13
3 files changed
+37 -13

No files matched your search

+13 -4
View File
@@ -177,14 +177,23 @@ export async function speichereEinstellung(feature, einstellung, { version, by =
}
/**
* Adresse der Website des Betriebs (Link auf Gaesteseiten): betrieb.websiteUrl oder https:// + erster gespeicherter Host
* des Projekts (analyseHosts); sonst null.
* Adresse der Website des Betriebs (Link auf Gaesteseiten und im Mailfuss), immer die echte Seite statt der Vorschau:
* betrieb.websiteUrl; sonst https:// + Live-Domain des Projekts (wenn project.liveDomain einen gueltigen Host ergibt);
* sonst https:// + <subdomain>.project.webklar.com; sonst die Portal-Adresse (config.publicBaseUrl).
*/
export function websiteUrl(ctx) {
const eigene = ctx?.einstellung?.betrieb?.websiteUrl
if (typeof eigene === 'string' && eigene !== '') return eigene
const [host] = ctx?.project ? analyseHosts(ctx.project) : []
return host ? `https://${host}` : null
const project = ctx?.project
if (project) {
// analyseHosts: [<subdomain>.project.webklar.com, Live-Domain], ungueltige und doppelte Hosts fehlen
const hosts = analyseHosts(project)
const vorschau = project.subdomain ? `${String(project.subdomain).trim().toLowerCase()}.project.webklar.com` : null
const live = project.liveDomain ? hosts.find((host) => host !== vorschau) : undefined
const host = live ?? hosts.find((h) => h === vorschau)
if (host) return `https://${host}`
}
return config.publicBaseUrl
}
/** Leert den Speicher von kontextPerSiteKey (Tests). */