Website-Analyse: AVV als Seite, www/Apex-Domains, Abo-Check unabhängig vom Schalter, Dev-Hinweis
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7ead59ff73
commit
714687fe3b
10 files changed
+267
-20
No files matched your search
@@ -58,8 +58,8 @@ export async function analyseEligibility(customerId, projectId) {
|
||||
|
||||
const HOSTNAME_RE = /^(?=.{4,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z][a-z0-9-]{0,61}[a-z0-9]$/
|
||||
|
||||
/** `<subdomain>.project.webklar.com` plus Live-Domain (klein, ohne Schema/Pfad), ohne Doppelte; ungueltige Hosts werden uebersprungen. */
|
||||
export function analyseDomains(project) {
|
||||
/** Gespeicherte Hosts: `<subdomain>.project.webklar.com` plus Live-Domain (klein, ohne Schema/Pfad), ohne Doppelte; ungueltige werden uebersprungen. */
|
||||
export function analyseHosts(project) {
|
||||
const domains = []
|
||||
if (project.subdomain) domains.push(`${String(project.subdomain).trim().toLowerCase()}.project.webklar.com`)
|
||||
const live = String(project.liveDomain || '')
|
||||
@@ -71,6 +71,17 @@ export function analyseDomains(project) {
|
||||
return [...new Set(domains)].filter((d) => HOSTNAME_RE.test(d))
|
||||
}
|
||||
|
||||
/** Erlaubte Origin-Domains des Messdienstes: gespeicherte Hosts plus www-/Apex-Gegenstueck der Live-Domain (Besucher kommen mit und ohne www), max. 5. */
|
||||
export function analyseDomains(project) {
|
||||
const hosts = analyseHosts(project)
|
||||
const live = project.liveDomain ? hosts[hosts.length - 1] : ''
|
||||
const extra = live && hosts.length > 1 ? (live.startsWith('www.') ? live.slice(4) : `www.${live}`) : ''
|
||||
return [...new Set([...hosts, extra].filter(Boolean))].filter((d) => HOSTNAME_RE.test(d)).slice(0, 5)
|
||||
}
|
||||
|
||||
/** Dev-Server-Projekte (previewDetected 'dev…') bekommen kein Messskript: der Runner injiziert nur in veroeffentlichte Ordner. */
|
||||
export const isDevPreview = (project) => String(project?.previewDetected || '').startsWith('dev')
|
||||
|
||||
async function customerOf(customerId) {
|
||||
try {
|
||||
return await getDocument(config.collections.customers, customerId)
|
||||
@@ -111,7 +122,7 @@ async function mailSafe(customerId, template, project) {
|
||||
|
||||
function privacyTicket(customerId, project, siteKey) {
|
||||
const name = project.projectName || project.subdomain || ''
|
||||
const domains = analyseDomains(project)
|
||||
const domains = analyseHosts(project)
|
||||
return analyseDeps.ticket({
|
||||
customerId,
|
||||
project,
|
||||
|
||||
Reference in new issue
Block a user