Terminplaner TP2 C4a: Nachbesserung 1
Die Wahl des Live-Hosts steht jetzt nur noch in liveHost() (kontext.js); websiteUrl() und der Betriebsvorschlag des Fragebogens (routes/termine.js) nutzen dieselbe Funktion. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
250fc0c4df
commit
42a3befc5f
3 files changed
+43
-13
No files matched your search
@@ -301,10 +301,26 @@ export async function speichereFragebogen(feature, aendere, { by = '', now = new
|
||||
})
|
||||
}
|
||||
|
||||
/** Vorschau-Host des Projekts (<subdomain>.project.webklar.com, klein) oder null; gleiche Schreibweise wie in analyseHosts. */
|
||||
function vorschauHost(project) {
|
||||
return project.subdomain ? `${String(project.subdomain).trim().toLowerCase()}.project.webklar.com` : null
|
||||
}
|
||||
|
||||
/**
|
||||
* Host der echten (Live-)Website eines Projekts: nur wenn project.liveDomain gesetzt ist, der erste gueltige Host aus
|
||||
* analyseHosts(project), der nicht die Vorschau-Adresse <subdomain>.project.webklar.com ist; sonst undefined.
|
||||
* Einzige Quelle fuer websiteUrl() und den Betriebsvorschlag des Fragebogens (routes/termine.js).
|
||||
*/
|
||||
export function liveHost(project) {
|
||||
if (!project?.liveDomain) return undefined
|
||||
const vorschau = vorschauHost(project)
|
||||
return analyseHosts(project).find((host) => host !== vorschau)
|
||||
}
|
||||
|
||||
/**
|
||||
* 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).
|
||||
* betrieb.websiteUrl; sonst https:// + Live-Domain des Projekts (liveHost); sonst https:// + <subdomain>.project.webklar.com;
|
||||
* sonst die Portal-Adresse (config.publicBaseUrl).
|
||||
*/
|
||||
export function websiteUrl(ctx) {
|
||||
const eigene = ctx?.einstellung?.betrieb?.websiteUrl
|
||||
@@ -312,10 +328,8 @@ export function websiteUrl(ctx) {
|
||||
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)
|
||||
const vorschau = vorschauHost(project)
|
||||
const host = liveHost(project) ?? analyseHosts(project).find((h) => h === vorschau)
|
||||
if (host) return `https://${host}`
|
||||
}
|
||||
return config.publicBaseUrl
|
||||
|
||||
Reference in new issue
Block a user